What is the fastest way to communicate with Java application?
Consider a setting of a large database and an application which needs to
interact with the database. If you were building it from scratch, what
communication technology would you use, if the objective is to maximize
throughput? Important requirement is, however, that the application using
the database is not written in Java. There is however a relaxed
requirement: it needs not to run on anything other then Linux, and if only
a particular JVM provides this feature, but not the others, I'm ok with
that too.
In other words, I would imagine there must be some kind of foreign
function interface and a way to represent Java objects (at least the most
basic types) in memory and pass them to the Java database w/o ever needing
to print them, open sockets, write on pipes, because all of that would
imply tons of memory de/allocation, de/serialization and so on. But since
I'm not really a Java person, I don't know what I'm looking for.
Thursday, 3 October 2013
Wednesday, 2 October 2013
Coniditions for a Random Variable which is differentiable to be simple
Coniditions for a Random Variable which is differentiable to be simple
Assume that $\Omega=[0,1]$ with Lebesgue measure. Under what conditions is
a random variable $X$ which is differentiable also simple?
Thanks!
Assume that $\Omega=[0,1]$ with Lebesgue measure. Under what conditions is
a random variable $X$ which is differentiable also simple?
Thanks!
jQuery $.each() update div using webservice
jQuery $.each() update div using webservice
I have the following webservice working:
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public List<ServerRoomDisplay> GetData(List<string> urls)
{
List<ServerRoomDisplay> returnList = new List<ServerRoomDisplay>();
foreach (var uri in urls)
{
XDocument xdoc = XDocument.Load(uri);
IEnumerable<XElement> serv = xdoc.Elements();
string ur = "";
string room = "";
string temp = "";
string hum = "";
string dew = "";
foreach (var ser in serv)
{
room = ser.Attribute("host").Value;
ur = "http://" + ser.Attribute("address");
temp =
ser.Descendants("devices").Descendants("device").Descendants("field").Where(x
=> (string)x.Attribute("key").Value ==
"Temp").FirstOrDefault().Attribute("value").Value.ToString();
hum =
ser.Descendants("devices").Descendants("device").Descendants("field").Where(x
=> (string)x.Attribute("key").Value ==
"Humidity").FirstOrDefault().Attribute("value").Value.ToString();
dew =
ser.Descendants("devices").Descendants("device").Descendants("field").Where(x
=> (string)x.Attribute("key").Value ==
"Dewpt").FirstOrDefault().Attribute("value").Value.ToString();
returnList.Add(new ServerRoomDisplay
{
RoomName = room,
Url = ur,
Temperature = temp,
Humidity = hum,
DewPoint = dew,
});
}
}
return returnList;
}
I then pass the parameters via an ajax call. Please note that this method
runs RECURSIVELY as to update the data within the div... like a stock
ticker on eTrade or something.
(function poll() {
var pageUrl = '<%=ResolveUrl("~/Reporting/GetXMLData.asmx")%>'
var urls = ["http://aaa/data.xml", "http://bbb/data.xml",
"http://ccc/data.xml"];
var jsonText = JSON.stringify({ urls: urls });
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: pageUrl + "/GetData",
data: jsonText,
success: function (msg) {
var res = msg.d;
$.each(res, function (i, item) {
$('#<%=lblOutput.ClientID%>').html(res[i].RoomName);
});
},
dataType: "json",
complete: poll,
timeout: 3000
});
})();
which then produces this response:
[{"__type":"ServerRoomDisplay",
"Url":"http://address=\"aaa\"",
"RoomName":"aaa MDF Room 500",
"Temperature":"74.99",
"Humidity":"38",
"DewPoint":"47.65",
"AlarmOne":null,
"AlarmTwo":null,
"AlarmThree":null,
"AlarmFour":null
},
{"__type":"ServerRoomDisplay",
"Url":"http://address=\"bbb\"",
"RoomName":"bbb Room 298",
"Temperature":"77.73",
"Humidity":"39",
"DewPoint":"50.79",
"AlarmOne":null,
"AlarmTwo":null,
"AlarmThree":null,
"AlarmFour":null
},
{"__type":"ServerRoomDisplay",
"Url":"http://address=\"ccc\"",
"RoomName":"ccc Room 601",
"Temperature":"75.32",
"Humidity":"49",
"DewPoint":"54.83",
"AlarmOne":null,
"AlarmTwo":null,
"AlarmThree":null,
"AlarmFour":null
}];
As you can see, it is 3 full objects returned in the json response. I then
have output div to place the data
<div>
<asp:Label ID="lblOutput" runat="server" />
</div>
from the jquery above, i'm testing by trying to list only the "RoomName"
into the div. When I do so, it only ever prints out the LAST item, which
is "ccc Room 601" and that's the only thing in the div.
Can someone please help me to be able to list all of the objects and then
only update the data that changes? basically it should re-write the
lblOutput again and change only the temperature, humidity and dewpoint
info. But it should print out all 3 of the objects. In other words, I
should get the following (for RoomName only right now)
aaa MDF Room 500
bbb Room 298
ccc Room 601
I hope I've explained this well enough. Thank you in advance.
I have the following webservice working:
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public List<ServerRoomDisplay> GetData(List<string> urls)
{
List<ServerRoomDisplay> returnList = new List<ServerRoomDisplay>();
foreach (var uri in urls)
{
XDocument xdoc = XDocument.Load(uri);
IEnumerable<XElement> serv = xdoc.Elements();
string ur = "";
string room = "";
string temp = "";
string hum = "";
string dew = "";
foreach (var ser in serv)
{
room = ser.Attribute("host").Value;
ur = "http://" + ser.Attribute("address");
temp =
ser.Descendants("devices").Descendants("device").Descendants("field").Where(x
=> (string)x.Attribute("key").Value ==
"Temp").FirstOrDefault().Attribute("value").Value.ToString();
hum =
ser.Descendants("devices").Descendants("device").Descendants("field").Where(x
=> (string)x.Attribute("key").Value ==
"Humidity").FirstOrDefault().Attribute("value").Value.ToString();
dew =
ser.Descendants("devices").Descendants("device").Descendants("field").Where(x
=> (string)x.Attribute("key").Value ==
"Dewpt").FirstOrDefault().Attribute("value").Value.ToString();
returnList.Add(new ServerRoomDisplay
{
RoomName = room,
Url = ur,
Temperature = temp,
Humidity = hum,
DewPoint = dew,
});
}
}
return returnList;
}
I then pass the parameters via an ajax call. Please note that this method
runs RECURSIVELY as to update the data within the div... like a stock
ticker on eTrade or something.
(function poll() {
var pageUrl = '<%=ResolveUrl("~/Reporting/GetXMLData.asmx")%>'
var urls = ["http://aaa/data.xml", "http://bbb/data.xml",
"http://ccc/data.xml"];
var jsonText = JSON.stringify({ urls: urls });
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: pageUrl + "/GetData",
data: jsonText,
success: function (msg) {
var res = msg.d;
$.each(res, function (i, item) {
$('#<%=lblOutput.ClientID%>').html(res[i].RoomName);
});
},
dataType: "json",
complete: poll,
timeout: 3000
});
})();
which then produces this response:
[{"__type":"ServerRoomDisplay",
"Url":"http://address=\"aaa\"",
"RoomName":"aaa MDF Room 500",
"Temperature":"74.99",
"Humidity":"38",
"DewPoint":"47.65",
"AlarmOne":null,
"AlarmTwo":null,
"AlarmThree":null,
"AlarmFour":null
},
{"__type":"ServerRoomDisplay",
"Url":"http://address=\"bbb\"",
"RoomName":"bbb Room 298",
"Temperature":"77.73",
"Humidity":"39",
"DewPoint":"50.79",
"AlarmOne":null,
"AlarmTwo":null,
"AlarmThree":null,
"AlarmFour":null
},
{"__type":"ServerRoomDisplay",
"Url":"http://address=\"ccc\"",
"RoomName":"ccc Room 601",
"Temperature":"75.32",
"Humidity":"49",
"DewPoint":"54.83",
"AlarmOne":null,
"AlarmTwo":null,
"AlarmThree":null,
"AlarmFour":null
}];
As you can see, it is 3 full objects returned in the json response. I then
have output div to place the data
<div>
<asp:Label ID="lblOutput" runat="server" />
</div>
from the jquery above, i'm testing by trying to list only the "RoomName"
into the div. When I do so, it only ever prints out the LAST item, which
is "ccc Room 601" and that's the only thing in the div.
Can someone please help me to be able to list all of the objects and then
only update the data that changes? basically it should re-write the
lblOutput again and change only the temperature, humidity and dewpoint
info. But it should print out all 3 of the objects. In other words, I
should get the following (for RoomName only right now)
aaa MDF Room 500
bbb Room 298
ccc Room 601
I hope I've explained this well enough. Thank you in advance.
Regex - word that contains a defined number letters between a series of letters
Regex - word that contains a defined number letters between a series of
letters
For example, I have these letters: a b c d e f g h l m n i i a b, how do I
find the words with a regex that can be formed with 5 of these letters?
letters
For example, I have these letters: a b c d e f g h l m n i i a b, how do I
find the words with a regex that can be formed with 5 of these letters?
How to stop supporting iOS7
How to stop supporting iOS7
I have just installed xCode 5, and I have an application the should be
targetted only to iOS 6.0 and iOS 6.1 devices.
How can I stop supporting iOS 7.0 ??
I have just installed xCode 5, and I have an application the should be
targetted only to iOS 6.0 and iOS 6.1 devices.
How can I stop supporting iOS 7.0 ??
Tuesday, 1 October 2013
how to create an array with default value in scala?
how to create an array with default value in scala?
I'm working on eclipse under ubuntu 12.04 with scala 2.10 and Akka 2.2.1.
val algorithm = if(args(0) > 1)()=> new A else ()=> new B // A and B
are derived from Node
class work(algorithm: ()=> Node, num: Int){
val a = new Array[Node](num)(algorithm) // here I wanna create an
array with num slots
// and objects of A or B in it
}
I read this post Default value for generic data structure, it does not
work. Eclipse reports
"type mismatch; found: ()=>Node required: Int".
I have no idea how to fix it. Thanks!
I'm working on eclipse under ubuntu 12.04 with scala 2.10 and Akka 2.2.1.
val algorithm = if(args(0) > 1)()=> new A else ()=> new B // A and B
are derived from Node
class work(algorithm: ()=> Node, num: Int){
val a = new Array[Node](num)(algorithm) // here I wanna create an
array with num slots
// and objects of A or B in it
}
I read this post Default value for generic data structure, it does not
work. Eclipse reports
"type mismatch; found: ()=>Node required: Int".
I have no idea how to fix it. Thanks!
Can't call event from button
Can't call event from button
I have three different events:
form_load
button_click
pnlTiles_Paint
My button click event I have:
private void btnUpdate_Click(object sender, EventArgs e)
{
pnlTiles.Paint += pnlTiles_Paint;
}
My form_load event I have:
private void frmMain_Load(object sender, EventArgs e)
{
pnlTiles.Paint += pnlTiles_Paint;
}
Now my problem is that the event gets called when I use it in form_load
but when I use it in the button event; it just skips over the event, I
tried to step into the event when debugging the button click. But I made
no progress on trying to figure out why the event doesn't get called from
the button.
I have three different events:
form_load
button_click
pnlTiles_Paint
My button click event I have:
private void btnUpdate_Click(object sender, EventArgs e)
{
pnlTiles.Paint += pnlTiles_Paint;
}
My form_load event I have:
private void frmMain_Load(object sender, EventArgs e)
{
pnlTiles.Paint += pnlTiles_Paint;
}
Now my problem is that the event gets called when I use it in form_load
but when I use it in the button event; it just skips over the event, I
tried to step into the event when debugging the button click. But I made
no progress on trying to figure out why the event doesn't get called from
the button.
cannot see RS232 serial data on Raspberry Pi [migrated]
cannot see RS232 serial data on Raspberry Pi [migrated]
I have a Model B Raspberry Pi and an Serial Pi RS232 Interface. I am
running Raspbian Wheezy on my RPi.
I configured the RPi using a Serial Guide, with particular attention to
the section titled "Reconfigure the RPi console port to to be used as a
standard serial port".
I used a null modem to connect a Windows PC to the RPi. The PC ran
TeraTerm and the RPi ran minicom. I configured both as follows:
Baud Rate = 115200, Data Bits = 8, Parity = NONE, Stop Bits = 1, Flow
Control = NONE
This worked perfectly in both directions.
I need to log the data, I assumed something like this would work:
cat /dev/ttyAMA0 > /var/log/ttyAMA0.log
But it doesn't log anything. I tried just this, and nothing is output to
the screen:
cat /dev/ttyAMA0
Does anyone have any ideas or suggestions?
I have a Model B Raspberry Pi and an Serial Pi RS232 Interface. I am
running Raspbian Wheezy on my RPi.
I configured the RPi using a Serial Guide, with particular attention to
the section titled "Reconfigure the RPi console port to to be used as a
standard serial port".
I used a null modem to connect a Windows PC to the RPi. The PC ran
TeraTerm and the RPi ran minicom. I configured both as follows:
Baud Rate = 115200, Data Bits = 8, Parity = NONE, Stop Bits = 1, Flow
Control = NONE
This worked perfectly in both directions.
I need to log the data, I assumed something like this would work:
cat /dev/ttyAMA0 > /var/log/ttyAMA0.log
But it doesn't log anything. I tried just this, and nothing is output to
the screen:
cat /dev/ttyAMA0
Does anyone have any ideas or suggestions?
install_driver(mysql) failed: Unable to get DBI state function. DBI not loaded
install_driver(mysql) failed: Unable to get DBI state function. DBI not
loaded
I installed OTRS from a rpm and the web installer /orts/installer.pl stops
with:
Error during AJAX communication. Status: error, Error: Internal Server Error
Apache error_log
install_driver(mysql) failed: Unable to get DBI state function. DBI not
loaded.
/opt/otrs/bin/otrs.CheckModules.pl
DBD::mysql.......................FAILED! Not all prerequisites for this
module correctly installed. YAML::XS.........................Not
installed! (required - use "perl -MCPAN -e shell;" - )
But sudo zypper install perl-DBD-mysql-4.021-27.2.x86_64.rpm has Nothing
to do. and mysql configuration is set as the manual requested.
System is SLES 11 SP2 (x86_64) and special thing: No internet connection!
I guess the question is: Why doesn't perl find DBI:mysql while it's
installed?
loaded
I installed OTRS from a rpm and the web installer /orts/installer.pl stops
with:
Error during AJAX communication. Status: error, Error: Internal Server Error
Apache error_log
install_driver(mysql) failed: Unable to get DBI state function. DBI not
loaded.
/opt/otrs/bin/otrs.CheckModules.pl
DBD::mysql.......................FAILED! Not all prerequisites for this
module correctly installed. YAML::XS.........................Not
installed! (required - use "perl -MCPAN -e shell;" - )
But sudo zypper install perl-DBD-mysql-4.021-27.2.x86_64.rpm has Nothing
to do. and mysql configuration is set as the manual requested.
System is SLES 11 SP2 (x86_64) and special thing: No internet connection!
I guess the question is: Why doesn't perl find DBI:mysql while it's
installed?
Monday, 30 September 2013
Unable to send data with tp-link router
Unable to send data with tp-link router
I'm posting this question on Windows because when I try to do "sending
activities", like posting on forums or uploading image files to image host
websites on my recently installed Ubuntu system, the operation does not
conclude.
When I plug my laptop direcly on my modem, the connection works perfectly,
even on Ubuntu, but when I try to access my router, (installed for
internet sharing purpose) both by wi-fi connection and by an ethernet
cable, I face the mentioned problem (just under Ubuntu).
I looked out for the solution on the web until I get exhausted. Hope some
of you have things to teach me.
I'm posting this question on Windows because when I try to do "sending
activities", like posting on forums or uploading image files to image host
websites on my recently installed Ubuntu system, the operation does not
conclude.
When I plug my laptop direcly on my modem, the connection works perfectly,
even on Ubuntu, but when I try to access my router, (installed for
internet sharing purpose) both by wi-fi connection and by an ethernet
cable, I face the mentioned problem (just under Ubuntu).
I looked out for the solution on the web until I get exhausted. Hope some
of you have things to teach me.
ubuntu 12.04 lts not restarting to finish installation
ubuntu 12.04 lts not restarting to finish installation
So I have installed ubuntu 12.o4.3 lts from a CD. Everything went fine,
but I noticed after sometime using the it, it still hasn't told me that
the installation is complete nor ask me to restart/reboot ubuntu to finish
the installation.
And there is no shutdown and logout button, only suspend.
I am currently on a Lenovo y410p Intel® Core™ i7-4700MQ CPU @ 2.40GHz × 8
I just got it so their should be no problems regarding the hardware.
So I have installed ubuntu 12.o4.3 lts from a CD. Everything went fine,
but I noticed after sometime using the it, it still hasn't told me that
the installation is complete nor ask me to restart/reboot ubuntu to finish
the installation.
And there is no shutdown and logout button, only suspend.
I am currently on a Lenovo y410p Intel® Core™ i7-4700MQ CPU @ 2.40GHz × 8
I just got it so their should be no problems regarding the hardware.
A school would like a private channel to post videos accessable by login or QR code only
A school would like a private channel to post videos accessable by login
or QR code only
I am working with a school who would like to post some videos but do to
privacy issues do not want them visible unless someone with the access to
the QR codes scans one. Is there an option for a private channel like
that?
Thank you!
Ellen Sillery ellen@entourageyearbooks.com
or QR code only
I am working with a school who would like to post some videos but do to
privacy issues do not want them visible unless someone with the access to
the QR codes scans one. Is there an option for a private channel like
that?
Thank you!
Ellen Sillery ellen@entourageyearbooks.com
Python CAPTCHA-like image disortion
Python CAPTCHA-like image disortion
I would like to disort some images the same way standard CAPTCHA disorts
fonts. How would I achieve it in python? What libraries/algorithms I
should use? Any proof-of-concept?
DISCLAIMER: I was googling for some time before I asked this question but
I couldn't find any satisfying answer. I'm new to the field so I can't
provide any code proving my 'research effort'...
I would like to disort some images the same way standard CAPTCHA disorts
fonts. How would I achieve it in python? What libraries/algorithms I
should use? Any proof-of-concept?
DISCLAIMER: I was googling for some time before I asked this question but
I couldn't find any satisfying answer. I'm new to the field so I can't
provide any code proving my 'research effort'...
Sunday, 29 September 2013
Recieve 400 Bad Request when using Jquery Form Plugin
Recieve 400 Bad Request when using Jquery Form Plugin
I changed my code to using the Jquery Form Plugin so that I could upload
pictures. My original form was simple
$.ajax({
type: "POST",
url: "register.htm",
data:{
account_name: $('#regAccount_name').val(),
pwd: MD5($('#regPwd').val()),
fname: $('#regFname').val(),
lname: $('#regLname').val(),
},
success: function(data){
changeMainIFrame('MenuFrame.jsp?regStatus=User Successfully
Registered');
},
error:function(e){
console.log("sendRegistration(): " + e);
}
});
but changed to this
var options = {
beforeSend: function()
{
//alert(MD5($('#regPwd').val()));
// document.getElementById('regPwd').value =
MD5($('#regPwd').val());
},
uploadProgress: function(event, position, total, percentComplete)
{
},
success: function()
{
changeMainIFrame('MenuFrame.jsp?regStatus=User Successfully
Registered');
},
complete: function(response)
{
},
error: function(e)
{
console.log("sendRegistration(): " + e);
}
};
$("#regForm").ajaxForm(options);
However now I get a 400 Bad Request which I take it to mean the my
controller isn't even picking up the request. Here's my controller code:
@RequestMapping("/register.htm")
public String register(// @RequestParam("regProfilePic") File pic,
@RequestParam("regAccount_name") String account_name,
@RequestParam("pwd") String pwd,
@RequestParam("fname") String fname,
@RequestParam("lname") String lname,
ModelMap params){
setup();
System.out.println("Register");
service.registerUser(fname, lname, account_name, pwd);
return "MenuFrame";
}
Here's My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID"
version="3.0">
<display-name>Volt</display-name>
<welcome-file-list>
<welcome-file>Mugenjou.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>volts</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>volts</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
and here's my servlet
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.mugenjou.control" />
<!-- /WEB-INF/jsp/VIEWNAME.jsp -->
<bean id="viewNameTranslator"
class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator"/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- <property name="prefix" value="/WEB-INF/jsp/"/> -->
<property value="" name="prefix"/> <property value=".jsp"
name="suffix"/>
</bean>
</beans>
the html
<form id ='regForm' action="register.htm" method="POST"
enctype="multipart/form-data">
<table cellpadding=5>
<!-- <tr>
<td>Profile Picture <br> <input type = "file" id
="regProfilePic" name ="regProfilePic" /></td>
</tr> -->
<tr>
<td> *Account Name <br> <input id
="regAccount_name" name = "regAccount_name"
type="text" size ="20"
onblur="isAccount_name();registerBtn();"/></td>
<td>
<div id ="chkUserLb"></div>
</td>
</tr>
<tr>
<td> *Password <br> <input id = "regPwd" name =
"pwd" type="text" size ="20"
onblur="isPwd();registerBtn();"/></td>
<td id=chkPwdLb></td>
</tr>
<tr>
<td> *First Name <br> <input id = "regFname" name
="fname" type="text" size ="20"
onblur="isFname();registerBtn();"/></td>
<td id=chkFnameLb></td>
</tr>
<tr>
<td> *Last Name <br> <input id = "regLname" name =
"lname" type="text" size ="20"
onblur="isLname();registerBtn();"/></td>
<td id=chkLnameLb></td>
</tr>
<tr>
<td><input id = "regSubmitBtn" type="submit"
value="Submit" disabled></td>
</tr>
</table>
*Required
</form>
I changed my code to using the Jquery Form Plugin so that I could upload
pictures. My original form was simple
$.ajax({
type: "POST",
url: "register.htm",
data:{
account_name: $('#regAccount_name').val(),
pwd: MD5($('#regPwd').val()),
fname: $('#regFname').val(),
lname: $('#regLname').val(),
},
success: function(data){
changeMainIFrame('MenuFrame.jsp?regStatus=User Successfully
Registered');
},
error:function(e){
console.log("sendRegistration(): " + e);
}
});
but changed to this
var options = {
beforeSend: function()
{
//alert(MD5($('#regPwd').val()));
// document.getElementById('regPwd').value =
MD5($('#regPwd').val());
},
uploadProgress: function(event, position, total, percentComplete)
{
},
success: function()
{
changeMainIFrame('MenuFrame.jsp?regStatus=User Successfully
Registered');
},
complete: function(response)
{
},
error: function(e)
{
console.log("sendRegistration(): " + e);
}
};
$("#regForm").ajaxForm(options);
However now I get a 400 Bad Request which I take it to mean the my
controller isn't even picking up the request. Here's my controller code:
@RequestMapping("/register.htm")
public String register(// @RequestParam("regProfilePic") File pic,
@RequestParam("regAccount_name") String account_name,
@RequestParam("pwd") String pwd,
@RequestParam("fname") String fname,
@RequestParam("lname") String lname,
ModelMap params){
setup();
System.out.println("Register");
service.registerUser(fname, lname, account_name, pwd);
return "MenuFrame";
}
Here's My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID"
version="3.0">
<display-name>Volt</display-name>
<welcome-file-list>
<welcome-file>Mugenjou.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>volts</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>volts</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
and here's my servlet
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.mugenjou.control" />
<!-- /WEB-INF/jsp/VIEWNAME.jsp -->
<bean id="viewNameTranslator"
class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator"/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- <property name="prefix" value="/WEB-INF/jsp/"/> -->
<property value="" name="prefix"/> <property value=".jsp"
name="suffix"/>
</bean>
</beans>
the html
<form id ='regForm' action="register.htm" method="POST"
enctype="multipart/form-data">
<table cellpadding=5>
<!-- <tr>
<td>Profile Picture <br> <input type = "file" id
="regProfilePic" name ="regProfilePic" /></td>
</tr> -->
<tr>
<td> *Account Name <br> <input id
="regAccount_name" name = "regAccount_name"
type="text" size ="20"
onblur="isAccount_name();registerBtn();"/></td>
<td>
<div id ="chkUserLb"></div>
</td>
</tr>
<tr>
<td> *Password <br> <input id = "regPwd" name =
"pwd" type="text" size ="20"
onblur="isPwd();registerBtn();"/></td>
<td id=chkPwdLb></td>
</tr>
<tr>
<td> *First Name <br> <input id = "regFname" name
="fname" type="text" size ="20"
onblur="isFname();registerBtn();"/></td>
<td id=chkFnameLb></td>
</tr>
<tr>
<td> *Last Name <br> <input id = "regLname" name =
"lname" type="text" size ="20"
onblur="isLname();registerBtn();"/></td>
<td id=chkLnameLb></td>
</tr>
<tr>
<td><input id = "regSubmitBtn" type="submit"
value="Submit" disabled></td>
</tr>
</table>
*Required
</form>
Drawable in string resource - andorid
Drawable in string resource - andorid
I want to show AlertDialog that shows its message with string and icons
together.
Is it possible to insert icons/images/drawables in string resource? Is
there any way to show drawables with the string in the AlertDialog.
EDIT
If its was not clear, the drawables need to be inside the string. like
"click the icon [icon-image] and then click on..."
I want to show AlertDialog that shows its message with string and icons
together.
Is it possible to insert icons/images/drawables in string resource? Is
there any way to show drawables with the string in the AlertDialog.
EDIT
If its was not clear, the drawables need to be inside the string. like
"click the icon [icon-image] and then click on..."
How can I make an android ViewGroup and all its child Views dynamically maintain equal width based on the widest child?
How can I make an android ViewGroup and all its child Views dynamically
maintain equal width based on the widest child?
I want my android layout to behave like so: Suppose SomeLayout is a parent
of Widget1, Layout2, and Widget2, which are displayed in that order from
top to bottom, like so:
|-------SomeLayout-------|
||--------Widget1-------||
||______________________||
||--------Layout2-------||
||______________________||
||--------Widget2-------||
||______________________||
|________________________|
The 3 children have content that is changing. Dynamically as they change,
I always want the one with the widest content to wrap to content. I want
SomeLayout to wrap around that widest child, and I want all other children
to match that widest one. Even if which one is widest changes.
I have been trying for some time to accomplish this using more methods
than I can count. All failures. Does anyone know haw to achieve this
effect via the android layout XML? I would be willing to use a Java
programmatic solution if that's all that anyone can provide, but I would
prefer to do it via just the XML.
maintain equal width based on the widest child?
I want my android layout to behave like so: Suppose SomeLayout is a parent
of Widget1, Layout2, and Widget2, which are displayed in that order from
top to bottom, like so:
|-------SomeLayout-------|
||--------Widget1-------||
||______________________||
||--------Layout2-------||
||______________________||
||--------Widget2-------||
||______________________||
|________________________|
The 3 children have content that is changing. Dynamically as they change,
I always want the one with the widest content to wrap to content. I want
SomeLayout to wrap around that widest child, and I want all other children
to match that widest one. Even if which one is widest changes.
I have been trying for some time to accomplish this using more methods
than I can count. All failures. Does anyone know haw to achieve this
effect via the android layout XML? I would be willing to use a Java
programmatic solution if that's all that anyone can provide, but I would
prefer to do it via just the XML.
Another thread for prevent freezing
Another thread for prevent freezing
I need to put this def in another process because shutil when work
freezing the graphic interface:
def creabackuno():
startbar()
messagebox.showinfo( "Wait..","I am creating the backup, please wait...")
try:
copytree(path,r"backup\dirbackup1\.minecraft")
messagebox.showinfo( "OK!","Backup (1) created!")
stopbar()
except OSError:
messagebox.showerror( "Nope!","There is already a backup to restore")
stopbar()
I have tried with this but not work and the programm crash:
def creabackuno():
startbar()
messagebox.showinfo( "Wait..","I am creating the backup, please wait...")
try:
copytree(path,r"backup\dirbackup1\.minecraft")
messagebox.showinfo( "OK!","Backup (1) created!")
stopbar()
except OSError:
messagebox.showerror( "Nope!","There is already a backup to restore")
stopbar()
def startprocess():
t=threading.Thread(target=creabackuno)
t.start()
(startbar() and stopbar() start/stop the prgress bar in indeterminate
mode, the problem is the interface freezing and the progressbar not work)
I'm using python 3.3
sorry for my poor english
thanks
I need to put this def in another process because shutil when work
freezing the graphic interface:
def creabackuno():
startbar()
messagebox.showinfo( "Wait..","I am creating the backup, please wait...")
try:
copytree(path,r"backup\dirbackup1\.minecraft")
messagebox.showinfo( "OK!","Backup (1) created!")
stopbar()
except OSError:
messagebox.showerror( "Nope!","There is already a backup to restore")
stopbar()
I have tried with this but not work and the programm crash:
def creabackuno():
startbar()
messagebox.showinfo( "Wait..","I am creating the backup, please wait...")
try:
copytree(path,r"backup\dirbackup1\.minecraft")
messagebox.showinfo( "OK!","Backup (1) created!")
stopbar()
except OSError:
messagebox.showerror( "Nope!","There is already a backup to restore")
stopbar()
def startprocess():
t=threading.Thread(target=creabackuno)
t.start()
(startbar() and stopbar() start/stop the prgress bar in indeterminate
mode, the problem is the interface freezing and the progressbar not work)
I'm using python 3.3
sorry for my poor english
thanks
Saturday, 28 September 2013
Run background function in MainWindow while modal Dialog is open
Run background function in MainWindow while modal Dialog is open
In my project, I have a "save as" button. However, the saving process for
what I have to do takes a minute or so. I would like to open a modal
dialog with a progress bar and some text displaying what is going on.
Easy enough, but how can I send "updates" from the main window to the
modal dialog. Basically, run both windows at once, where all the saving is
being done from the main window, but the progress is being shown in the
dialog. I do not want the dialog to be modeless, since I don't want the
user to interact with the main window during saving. I also don't want the
saving process to take place from the dialog.
Currently, my program just saves everything from the main window and no
dialog is shown.
Thanks for your time. :)
In my project, I have a "save as" button. However, the saving process for
what I have to do takes a minute or so. I would like to open a modal
dialog with a progress bar and some text displaying what is going on.
Easy enough, but how can I send "updates" from the main window to the
modal dialog. Basically, run both windows at once, where all the saving is
being done from the main window, but the progress is being shown in the
dialog. I do not want the dialog to be modeless, since I don't want the
user to interact with the main window during saving. I also don't want the
saving process to take place from the dialog.
Currently, my program just saves everything from the main window and no
dialog is shown.
Thanks for your time. :)
Query pulling 12-15 GB data From more than 120 tables
Query pulling 12-15 GB data From more than 120 tables
I have a query which is pulling data from almost 125 different tables, I
have created some 13 nested Stored Procedures calling other stored
procedures to pull all the required data. Surprise Surprise Surprise The
query takes ages to execute and sometimes I have to kill he connection and
rerun it.
I have been advised to make use of staging table, Move required data there
using SSIS packages and pull data from there, but I am a bit reluctant to
use SSIS as Im not very comfortable with SSIS and This report is requested
once in a while and also moving around 10-15 gb data for one report seems
a lot of hassle.
Any suggestion any ideas please to make this hell of task a bit simpler,
quicker and less error prone ???
I have a query which is pulling data from almost 125 different tables, I
have created some 13 nested Stored Procedures calling other stored
procedures to pull all the required data. Surprise Surprise Surprise The
query takes ages to execute and sometimes I have to kill he connection and
rerun it.
I have been advised to make use of staging table, Move required data there
using SSIS packages and pull data from there, but I am a bit reluctant to
use SSIS as Im not very comfortable with SSIS and This report is requested
once in a while and also moving around 10-15 gb data for one report seems
a lot of hassle.
Any suggestion any ideas please to make this hell of task a bit simpler,
quicker and less error prone ???
Keeping model after form submission
Keeping model after form submission
I have the following model used for a quiz, I am trying to submit a form
and pass the existing model back to the Action as it has already been
initialized in the Index action.
public class QuizModel
{
private List<string> _Responses;
public List<string> Responses
{
get
{
if (_Responses == null)
{
_Responses = new List<string>() { "Response A", "Response
B", "Response C", "Response D" };
}
return _Responses;
}
}
public int? SelectedIndex { get; set; }
public string Question { get; set; }
}
With the following View:
<div class="title">Question</div>
<span id="question">@Model.Question</span>
@if (!Model.UserHasAnswered)
{
using (Html.BeginForm("Submit", "Quiz", FormMethod.Post))
{
for (int i = 0; i < Model.Responses.Count; i++)
{
<div class="reponse">@Html.RadioButtonFor(m => m.SelectedIndex,
i)@Model.Responses[i]</div>
}
<input type="submit" value="This is the value" />
}
}
else
{
<div id="explanation">@Model.Explanation</div>
}
And Controller...
//
// GET: /Quiz/
public ActionResult Index()
{
QuizModel model = new QuizModel()
{
Question = "This is the question",
Explanation = "This is the explanation",
UserHasAnswered = false
};
return PartialView(model);
}
//
// POST: /Quiz/Submit
[HttpPost]
public ActionResult Submit(QuizModel model)
{
if (ModelState.IsValid)
{
int? selected = model.SelectedIndex;
model.UserHasAnswered = true;
}
return View("Index", model);
}
When the model comes to the Submit action it only contains the
SelectedIndex and not Question or Explanation properties. How can I tell
my view to pass the original model it received back to the Submit action?
I have the following model used for a quiz, I am trying to submit a form
and pass the existing model back to the Action as it has already been
initialized in the Index action.
public class QuizModel
{
private List<string> _Responses;
public List<string> Responses
{
get
{
if (_Responses == null)
{
_Responses = new List<string>() { "Response A", "Response
B", "Response C", "Response D" };
}
return _Responses;
}
}
public int? SelectedIndex { get; set; }
public string Question { get; set; }
}
With the following View:
<div class="title">Question</div>
<span id="question">@Model.Question</span>
@if (!Model.UserHasAnswered)
{
using (Html.BeginForm("Submit", "Quiz", FormMethod.Post))
{
for (int i = 0; i < Model.Responses.Count; i++)
{
<div class="reponse">@Html.RadioButtonFor(m => m.SelectedIndex,
i)@Model.Responses[i]</div>
}
<input type="submit" value="This is the value" />
}
}
else
{
<div id="explanation">@Model.Explanation</div>
}
And Controller...
//
// GET: /Quiz/
public ActionResult Index()
{
QuizModel model = new QuizModel()
{
Question = "This is the question",
Explanation = "This is the explanation",
UserHasAnswered = false
};
return PartialView(model);
}
//
// POST: /Quiz/Submit
[HttpPost]
public ActionResult Submit(QuizModel model)
{
if (ModelState.IsValid)
{
int? selected = model.SelectedIndex;
model.UserHasAnswered = true;
}
return View("Index", model);
}
When the model comes to the Submit action it only contains the
SelectedIndex and not Question or Explanation properties. How can I tell
my view to pass the original model it received back to the Submit action?
two consecutive fwrites on same file
two consecutive fwrites on same file
i have read all sources and I tried to understand why this code is giving
such output, but i couldn't understand. Please if someone could give me
specific answers....
#include<stdio.h>
int main()
{
FILE *fp1;
FILE *fp2;
fp1=fopen("abc","w");
fp2=fopen("abc","w");
fwrite("BASIC",1,5,fp1);
fwrite("BBBBB CONCEPTS",1,14,fp2);
return 0;
}
The output is BASIC CONCEPTS when i opened the file "abc". Why has second
fwrite not overwritten the contents of file "abc"? the expected output
should be BBBBB CONCEPTS
i have read all sources and I tried to understand why this code is giving
such output, but i couldn't understand. Please if someone could give me
specific answers....
#include<stdio.h>
int main()
{
FILE *fp1;
FILE *fp2;
fp1=fopen("abc","w");
fp2=fopen("abc","w");
fwrite("BASIC",1,5,fp1);
fwrite("BBBBB CONCEPTS",1,14,fp2);
return 0;
}
The output is BASIC CONCEPTS when i opened the file "abc". Why has second
fwrite not overwritten the contents of file "abc"? the expected output
should be BBBBB CONCEPTS
Friday, 27 September 2013
Undesired result using eval on divide
Undesired result using eval on divide
The code
eval("7/2")
yields the result 3. I would prefer that it returned 3.5. How can I
achieve this please?
The code
eval("7/2")
yields the result 3. I would prefer that it returned 3.5. How can I
achieve this please?
ADT Set (array set) in java, removing items and intersection and union of sets
ADT Set (array set) in java, removing items and intersection and union of
sets
Note: This is for an assignment
I can't figure out how to write the intersecting & union methods-- this is
one of my first CS classes that I've taken and I'm having a difficult
time. Can anyone offer any assistance?
public class ArraySet<T> implements SetInterface<T>
{
private final T[] set;
private static final int defaultCapacity = 10;
private int count;
public ArraySet(int aCapacity)
{
count = 0;
T[] tempSet = (T[]) new Object [aCapacity];
set = tempSet;
}
public ArraySet()
{
this (defaultCapacity);
}
public void insert(T anElement)
{
if (set.equals(anElement))
{
return;
} else {
set[count] = anElement;
count ++;
}
}
public T remove()
{
T result = remove (count - 1);
return result;
}
public int getCurrentSize()
{
return count;
}
public boolean isEmpty()
{
return count == 0;
}
public String toString()
{
String temp = new String ();
}
public boolean in(T anElement)
{
boolean result = true;
if (a.equals(anElement))
{
result = false;
} else {
}
public SetInterface<T> intersect(SetInterface<T> rhsSet)
{
/**
* Perform union operation between this set and the rhsSet.
* @param rhsSet the set to be unioned with.
* @return a new set which is the result of this set unions with
* rhsSet.
*/
}
public SetInterface<T> union(SetInterface<T> rhsSet)
{
/**
* Perform diff operation between this set and the rhsSet.
* @param rhsSet the set to be diffed with.
* @return a new set which is the result of this set diffs with
* rhsSet.
*/
}
public SetInterface<T> diff(SetInterface<T> rhsSet)
{
/**
* See whether this set is a subset of rhsSet.
* @param rhsSet an input set.
* @return true if this set is a subset of rhsSet, false otherwise.
*/
}
public boolean subsetOf(SetInterface<T> rhsSet)
{
/**
* See whether this set is equal to the set otherObject.
* Note that this method overrides the method equals of the class
* Object.
* @param otherObject an input set.
* @return true if this set is equal the set otherObject.
*/
}
public boolean equals(Object otherObject)
{
/**
* Creates an array of all elements that are in this set.
* @return a newly allocated array of all the entries in this set.
*/
}
public T[] toArray()
{
T[] result = (T[]) new Object [count];
for (int index = 0; index < count; index++)
{
result [index] = set [index];
}
return result;
}
}
sets
Note: This is for an assignment
I can't figure out how to write the intersecting & union methods-- this is
one of my first CS classes that I've taken and I'm having a difficult
time. Can anyone offer any assistance?
public class ArraySet<T> implements SetInterface<T>
{
private final T[] set;
private static final int defaultCapacity = 10;
private int count;
public ArraySet(int aCapacity)
{
count = 0;
T[] tempSet = (T[]) new Object [aCapacity];
set = tempSet;
}
public ArraySet()
{
this (defaultCapacity);
}
public void insert(T anElement)
{
if (set.equals(anElement))
{
return;
} else {
set[count] = anElement;
count ++;
}
}
public T remove()
{
T result = remove (count - 1);
return result;
}
public int getCurrentSize()
{
return count;
}
public boolean isEmpty()
{
return count == 0;
}
public String toString()
{
String temp = new String ();
}
public boolean in(T anElement)
{
boolean result = true;
if (a.equals(anElement))
{
result = false;
} else {
}
public SetInterface<T> intersect(SetInterface<T> rhsSet)
{
/**
* Perform union operation between this set and the rhsSet.
* @param rhsSet the set to be unioned with.
* @return a new set which is the result of this set unions with
* rhsSet.
*/
}
public SetInterface<T> union(SetInterface<T> rhsSet)
{
/**
* Perform diff operation between this set and the rhsSet.
* @param rhsSet the set to be diffed with.
* @return a new set which is the result of this set diffs with
* rhsSet.
*/
}
public SetInterface<T> diff(SetInterface<T> rhsSet)
{
/**
* See whether this set is a subset of rhsSet.
* @param rhsSet an input set.
* @return true if this set is a subset of rhsSet, false otherwise.
*/
}
public boolean subsetOf(SetInterface<T> rhsSet)
{
/**
* See whether this set is equal to the set otherObject.
* Note that this method overrides the method equals of the class
* Object.
* @param otherObject an input set.
* @return true if this set is equal the set otherObject.
*/
}
public boolean equals(Object otherObject)
{
/**
* Creates an array of all elements that are in this set.
* @return a newly allocated array of all the entries in this set.
*/
}
public T[] toArray()
{
T[] result = (T[]) new Object [count];
for (int index = 0; index < count; index++)
{
result [index] = set [index];
}
return result;
}
}
sorting and grouping in SAS
sorting and grouping in SAS
Hello I have a data set that looks like this:
Basket ItemCount TotalAmount CategoryDescription
102030 3 40 books
205060 1 5 produce
102030 3 40 deli
102030 3 40 dairy
708359 25 120 meat
456023 1 1 candy
Using SAS I want to sort/group the data so that I have: all the baskets
that have only a total of any one category in a new dataset, all the
baskets that have a total of only two categories in another dataset, all
the baskets that have a total of only three categories in another
dataset,..etc. . Given that I have 1134 different categories. Then I want
one dataset that contain all the newly sorted variables.
Many thanks ļ
Hello I have a data set that looks like this:
Basket ItemCount TotalAmount CategoryDescription
102030 3 40 books
205060 1 5 produce
102030 3 40 deli
102030 3 40 dairy
708359 25 120 meat
456023 1 1 candy
Using SAS I want to sort/group the data so that I have: all the baskets
that have only a total of any one category in a new dataset, all the
baskets that have a total of only two categories in another dataset, all
the baskets that have a total of only three categories in another
dataset,..etc. . Given that I have 1134 different categories. Then I want
one dataset that contain all the newly sorted variables.
Many thanks ļ
Password and username displaying in input fields?
Password and username displaying in input fields?
I have a silly problem that i just cant figure out. when i refresh my
login page the password and username appears in the input fields. here is
my code:
<?php include_once "includes/scripts.php"; ?>
<?php
session_start();
include_once ("includes/connect.php");
if (isset($_SESSION['logged_in'])) {
header('location: admin_cms.php');
}else{
if (isset($_POST['username'], $_POST['password'])){
$username = $_POST['username'];
$password = md5($_POST['password']);
if (empty($username) or empty($password)){
$error = '<p>NOTE: Fields are blank</p>';
}else{
$query = $pdo->prepare("SELECT * FROM users WHERE user_name =
? AND user_password =?");
$query->bindValue(1, $username);
$query->bindValue(2, $password);
$query->execute();
$num = $query->rowCount();
if ($num == 1){
$_SESSION['logged_in'] = true;
header('location: admin_cms.php');
exit();
}else{
$error = "<p>NOTE: The username or password is
incorrect</p>";
}
}
}
?>
<div id="login_container">
<br><img src="images/camelhorst_logo_full.png"
style="margin-top:38px;">
<h1>LOGIN<img src="images/three_column_grid_line.png"
alt="line"></h1>
<form acton = "admin.php" method="post" autocompleate="off">
<label>Username:</label>
<input type="text" name="username" placeholder="Your Username"
required>
<label>Password:</label>
<input type="password" name="password" placeholder="Your
Password" required>
<input type="submit" value="Login" name="submit_login">
</form>
<?php if (isset($error))
{echo $error;}?>
<p id="copyright_admin"> © CAMELHORSE CREATIVE STUDIO 2013 </p>
</div><!--login_container-->
<?php } ?>
</body>
</html>
Please can someone help me with this and also if anyone sees a issue that
might be a security issue please correct me?
I have a silly problem that i just cant figure out. when i refresh my
login page the password and username appears in the input fields. here is
my code:
<?php include_once "includes/scripts.php"; ?>
<?php
session_start();
include_once ("includes/connect.php");
if (isset($_SESSION['logged_in'])) {
header('location: admin_cms.php');
}else{
if (isset($_POST['username'], $_POST['password'])){
$username = $_POST['username'];
$password = md5($_POST['password']);
if (empty($username) or empty($password)){
$error = '<p>NOTE: Fields are blank</p>';
}else{
$query = $pdo->prepare("SELECT * FROM users WHERE user_name =
? AND user_password =?");
$query->bindValue(1, $username);
$query->bindValue(2, $password);
$query->execute();
$num = $query->rowCount();
if ($num == 1){
$_SESSION['logged_in'] = true;
header('location: admin_cms.php');
exit();
}else{
$error = "<p>NOTE: The username or password is
incorrect</p>";
}
}
}
?>
<div id="login_container">
<br><img src="images/camelhorst_logo_full.png"
style="margin-top:38px;">
<h1>LOGIN<img src="images/three_column_grid_line.png"
alt="line"></h1>
<form acton = "admin.php" method="post" autocompleate="off">
<label>Username:</label>
<input type="text" name="username" placeholder="Your Username"
required>
<label>Password:</label>
<input type="password" name="password" placeholder="Your
Password" required>
<input type="submit" value="Login" name="submit_login">
</form>
<?php if (isset($error))
{echo $error;}?>
<p id="copyright_admin"> © CAMELHORSE CREATIVE STUDIO 2013 </p>
</div><!--login_container-->
<?php } ?>
</body>
</html>
Please can someone help me with this and also if anyone sees a issue that
might be a security issue please correct me?
will range based for loop in c++ reserve the index order
will range based for loop in c++ reserve the index order
in c++11, if I use a range based for loop on vector, will it guarantee the
iterating order? say, will the following code blocks are guaranteed for
same output?
vector<T> output;
vector<U> V;
for( auto v: V) output.push_back(f(v));
vs
for(int i =0; i < V.size(); ++i) output.push_back(f(v));
what if it is not vector but map etc?
in c++11, if I use a range based for loop on vector, will it guarantee the
iterating order? say, will the following code blocks are guaranteed for
same output?
vector<T> output;
vector<U> V;
for( auto v: V) output.push_back(f(v));
vs
for(int i =0; i < V.size(); ++i) output.push_back(f(v));
what if it is not vector but map etc?
Android Fragments - How to implement Backstacking
Android Fragments - How to implement Backstacking
I have android screen layout shown below
Apps screen divided into 3 fragments, Header, Footer and Content. Header
and Footer fragments are fixed. Content fragment is changing according to
content. I replaces fragment1-fragment3 according to need. Initially
Fragment1 is shows in content area. When i press a next button fragment1
is replace by fragment2. This is the order. I have question, if i press
another button previous, how can i return to previous fragment ( fragment2
-> fragment1). Is any built in mechanism available in fragment class.
Please guide me...
thanks in advance
I have android screen layout shown below
Apps screen divided into 3 fragments, Header, Footer and Content. Header
and Footer fragments are fixed. Content fragment is changing according to
content. I replaces fragment1-fragment3 according to need. Initially
Fragment1 is shows in content area. When i press a next button fragment1
is replace by fragment2. This is the order. I have question, if i press
another button previous, how can i return to previous fragment ( fragment2
-> fragment1). Is any built in mechanism available in fragment class.
Please guide me...
thanks in advance
Thursday, 26 September 2013
getting "unfortunately has stopped" error when using resources
getting "unfortunately has stopped" error when using resources
I think I don't need to tell what I try to but I want to tell. There is 2
<string-array> first is for android:entries second for values of these
entries. When user select the item I want to get value of that item.
Also I want to ask, When application is opened, dialog run. I want to make
it run just when after user select a item.
public class Select extends Activity implements OnItemSelectedListener{
Resources rsc = getResources();
@SuppressLint("Recycle")
final TypedArray itemValues = rsc.obtainTypedArray(R.array.selectValues);
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.select);
Spinner form = (Spinner) findViewById(R.id.sSelect);
form.setOnItemSelectedListener(this);
}
@Override
public void onItemSelected(AdapterView<?> item, View arg1, int sort,
long arg3) {
// TODO Auto-generated method stub
int selectedItem = itemValues.getInt(sort, 1);
Dialog d = new Dialog(this);
TextView t = new TextView(this);
t.setText(selectedItem);
d.setContentView(t);
d.setTitle("Sonuc!");
d.show();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
}
Problem appear when I use Resources. Also logcat is here. What's the
problem and solution of this problem?
I think I don't need to tell what I try to but I want to tell. There is 2
<string-array> first is for android:entries second for values of these
entries. When user select the item I want to get value of that item.
Also I want to ask, When application is opened, dialog run. I want to make
it run just when after user select a item.
public class Select extends Activity implements OnItemSelectedListener{
Resources rsc = getResources();
@SuppressLint("Recycle")
final TypedArray itemValues = rsc.obtainTypedArray(R.array.selectValues);
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.select);
Spinner form = (Spinner) findViewById(R.id.sSelect);
form.setOnItemSelectedListener(this);
}
@Override
public void onItemSelected(AdapterView<?> item, View arg1, int sort,
long arg3) {
// TODO Auto-generated method stub
int selectedItem = itemValues.getInt(sort, 1);
Dialog d = new Dialog(this);
TextView t = new TextView(this);
t.setText(selectedItem);
d.setContentView(t);
d.setTitle("Sonuc!");
d.show();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
}
Problem appear when I use Resources. Also logcat is here. What's the
problem and solution of this problem?
Thursday, 19 September 2013
Database Searching function using Plone + MySQL
Database Searching function using Plone + MySQL
I successfully made the inserting, updating and deleting data in Plone
using MySql database. Drop down menu thing that i used for inserting,
updating and deleting in Plone and MySql: Z Mysql database connection, Z
Sql method, z page template, script(python)
Question: How to do the database searching in Plone using MySql database?
I successfully made the inserting, updating and deleting data in Plone
using MySql database. Drop down menu thing that i used for inserting,
updating and deleting in Plone and MySql: Z Mysql database connection, Z
Sql method, z page template, script(python)
Question: How to do the database searching in Plone using MySql database?
Xcode 5 crashes -- Xcode quit unexpectedly
Xcode 5 crashes -- Xcode quit unexpectedly
Xcode 5 from the App Store crashes when I select any file in the Project
Navigator or when I try to edit it. I have deleted all plugins and the
derived data for the app and it keeps crashing.
Does anyone know how to fix this and why this is happening?
Below is the first part of the error.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 5A1412
ASSERTION FAILURE in
/SourceCache/DVTFoundation/DVTFoundation-3532/Framework/Classes/Protocols/DVTInvalidation.m:243
Details: <IDESourceControlCredentialsValidator, 0x7faec5e3c9b0> was never
invalidated.
I am not sure this helps but here is the Backtrace
Backtrace for allocation (if _creationBacktrace is set):
(null)
Object: <IDESourceControlCredentialsValidator: 0x7f86dceeb080>
Method: -dealloc
Thread: <NSThread: 0x7f86d8414c80>{name = (null), num = 1}
Hints: None
Backtrace:
0 0x000000010e3a1188 -[IDEAssertionHandler
handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:]
(in IDEKit)
1 0x000000010d137655 _DVTAssertionHandler (in DVTFoundation)
2 0x000000010d137984 _DVTAssertionFailureHandler (in DVTFoundation)
3 0x000000010d20c6a6 _DVTInvalidation_DeallocSuper (in DVTFoundation)
4 0x000000010e33e2a3
-[IDESourceControlSSLAuthenticationWindowController .cxx_destruct] (in
IDEKit)
5 0x00007fff8c00bfcc object_cxxDestructFromClass(objc_object*,
objc_class*) (in libobjc.A.dylib)
6 0x00007fff8c005922 objc_destructInstance (in libobjc.A.dylib)
7 0x00007fff8c005fa0 object_dispose (in libobjc.A.dylib)
8 0x000000010d161995 __DVTSetupKVODeallocAssertions_block_invoke_371
(in DVTFoundation)
9 0x00007fff865797fa -[NSResponder dealloc] (in AppKit)
10 0x00007fff864af162 -[NSWindowController dealloc] (in AppKit)
11 0x00007fff86623901 -[NSWindowController release] (in AppKit)
12 0x00007fff867595b0 -[NSAutounbinder dealloc] (in AppKit)
13 0x00007fff8c006230 (anonymous
namespace)::AutoreleasePoolPage::pop(void*) (in libobjc.A.dylib)
14 0x00007fff87a0cd72 _CFAutoreleasePoolPop (in CoreFoundation)
15 0x00007fff8c52447a -[NSAutoreleasePool drain] (in Foundation)
16 0x00007fff8657a27e -[NSApplication run] (in AppKit)
17 0x00007fff8651ebd6 NSApplicationMain (in AppKit)
18 0x00007fff91f377e1 start (in libdyld.dylib)
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff903ad212 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff8a7fcb54 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff8a840dce abort + 143
3 com.apple.dt.IDEKit 0x000000010e3a0a93
+[IDEAssertionHandler _handleAssertionWithLogString:reason:] + 763
4 com.apple.dt.IDEKit 0x000000010e3a12ee
-[IDEAssertionHandler
handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:]
+ 1117
5 com.apple.dt.DVTFoundation 0x000000010d137655
_DVTAssertionHandler + 421
6 com.apple.dt.DVTFoundation 0x000000010d137984
_DVTAssertionFailureHandler + 322
7 com.apple.dt.DVTFoundation 0x000000010d20c6a6
_DVTInvalidation_DeallocSuper + 480
8 com.apple.dt.IDEKit 0x000000010e33e2a3
-[IDESourceControlSSLAuthenticationWindowController .cxx_destruct] + 94
9 libobjc.A.dylib 0x00007fff8c00bfcc
object_cxxDestructFromClass(objc_object*, objc_class*) + 100
10 libobjc.A.dylib 0x00007fff8c005922
objc_destructInstance + 91
11 libobjc.A.dylib 0x00007fff8c005fa0 object_dispose + 22
12 com.apple.dt.DVTFoundation 0x000000010d161995
__DVTSetupKVODeallocAssertions_block_invoke_371 + 264
13 com.apple.AppKit 0x00007fff865797fa -[NSResponder
dealloc] + 129
14 com.apple.AppKit 0x00007fff864af162
-[NSWindowController dealloc] + 616
15 com.apple.AppKit 0x00007fff86623901
-[NSWindowController release] + 159
16 com.apple.AppKit 0x00007fff867595b0 -[NSAutounbinder
dealloc] + 51
17 libobjc.A.dylib 0x00007fff8c006230 (anonymous
namespace)::AutoreleasePoolPage::pop(void*) + 464
18 com.apple.CoreFoundation 0x00007fff87a0cd72
_CFAutoreleasePoolPop + 34
19 com.apple.Foundation 0x00007fff8c52447a -[NSAutoreleasePool
drain] + 154
20 com.apple.AppKit 0x00007fff8657a27e -[NSApplication
run] + 736
21 com.apple.AppKit 0x00007fff8651ebd6 NSApplicationMain +
869
22 libdyld.dylib 0x00007fff91f377e1 start + 1
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff903add16 kevent + 10
1 libdispatch.dylib 0x00007fff8641cdea
_dispatch_mgr_invoke + 883
2 libdispatch.dylib 0x00007fff8641c9ee
_dispatch_mgr_thread + 54
Thread 2:: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.Foundation 0x00007fff8c501546
+[NSURLConnection(Loader) _resourceLoadLoop:] + 356
6 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
7 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
8 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 3:
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.DTDeviceKitBase 0x000000011466875a
-[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 164
6 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
7 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
8 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 4:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x00007fff903ad322 __select + 10
1 com.apple.CoreFoundation 0x00007fff87a50f46 __CFSocketManager +
1302
2 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
3 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 5:: DYMobileDeviceManager
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.Foundation 0x00007fff8c5647ee
-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
6 com.apple.Foundation 0x00007fff8c4fd1aa
-[NSRunLoop(NSRunLoop) run] + 74
7 com.apple.GPUToolsMobileFoundation 0x0000000118afe9bb
-[DYMobileDeviceManager _deviceNotificationThread:] + 132
8 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
9 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
10 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 6:: CVDisplayLink
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.CoreVideo 0x00007fff8b5872a1
CVDisplayLink::runIOThread() + 689
3 com.apple.CoreVideo 0x00007fff8b586fd7
startIOThread(void*) + 148
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 7:
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.Xcode.DevToolsCore 0x0000000113436166 -[XCBlockQueue
_processBlocksInThreadSlotNumber:] + 506
3 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 8:
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.Xcode.DevToolsCore 0x0000000113436166 -[XCBlockQueue
_processBlocksInThreadSlotNumber:] + 506
3 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 9:
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.Xcode.DevToolsCore 0x0000000113436166 -[XCBlockQueue
_processBlocksInThreadSlotNumber:] + 506
3 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 10:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 11:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 12:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 13:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 14:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 15:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 16:
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.DebugSymbols 0x00007fff8728a590
SpotlightQueryThread(void*) + 356
6 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
7 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 17:
0 libsystem_kernel.dylib 0x00007fff903ad386 __semwait_signal + 10
1 libsystem_c.dylib 0x00007fff8a885800 nanosleep + 163
2 com.apple.CoreSymbolication 0x00007fff8fee2358 0x7fff8fecc000 + 90968
3 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
4 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx:
0x00007fff52b72108 rdx: 0x0000000000000000
rdi: 0x0000000000000c07 rsi: 0x0000000000000006 rbp:
0x00007fff52b72130 rsp: 0x00007fff52b72108
r8: 0x00007fff769b7278 r9: 0x0000000000000141 r10:
0x0000000020000000 r11: 0x0000000000000206
r12: 0x00007fff52b72248 r13: 0x000000010ea71680 r14:
0x00007fff769b8180 r15: 0x00007fff52b721f0
rip: 0x00007fff903ad212 rfl: 0x0000000000000206 cr2: 0x00007f86d883a400
Logical CPU: 0
Xcode 5 from the App Store crashes when I select any file in the Project
Navigator or when I try to edit it. I have deleted all plugins and the
derived data for the app and it keeps crashing.
Does anyone know how to fix this and why this is happening?
Below is the first part of the error.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 5A1412
ASSERTION FAILURE in
/SourceCache/DVTFoundation/DVTFoundation-3532/Framework/Classes/Protocols/DVTInvalidation.m:243
Details: <IDESourceControlCredentialsValidator, 0x7faec5e3c9b0> was never
invalidated.
I am not sure this helps but here is the Backtrace
Backtrace for allocation (if _creationBacktrace is set):
(null)
Object: <IDESourceControlCredentialsValidator: 0x7f86dceeb080>
Method: -dealloc
Thread: <NSThread: 0x7f86d8414c80>{name = (null), num = 1}
Hints: None
Backtrace:
0 0x000000010e3a1188 -[IDEAssertionHandler
handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:]
(in IDEKit)
1 0x000000010d137655 _DVTAssertionHandler (in DVTFoundation)
2 0x000000010d137984 _DVTAssertionFailureHandler (in DVTFoundation)
3 0x000000010d20c6a6 _DVTInvalidation_DeallocSuper (in DVTFoundation)
4 0x000000010e33e2a3
-[IDESourceControlSSLAuthenticationWindowController .cxx_destruct] (in
IDEKit)
5 0x00007fff8c00bfcc object_cxxDestructFromClass(objc_object*,
objc_class*) (in libobjc.A.dylib)
6 0x00007fff8c005922 objc_destructInstance (in libobjc.A.dylib)
7 0x00007fff8c005fa0 object_dispose (in libobjc.A.dylib)
8 0x000000010d161995 __DVTSetupKVODeallocAssertions_block_invoke_371
(in DVTFoundation)
9 0x00007fff865797fa -[NSResponder dealloc] (in AppKit)
10 0x00007fff864af162 -[NSWindowController dealloc] (in AppKit)
11 0x00007fff86623901 -[NSWindowController release] (in AppKit)
12 0x00007fff867595b0 -[NSAutounbinder dealloc] (in AppKit)
13 0x00007fff8c006230 (anonymous
namespace)::AutoreleasePoolPage::pop(void*) (in libobjc.A.dylib)
14 0x00007fff87a0cd72 _CFAutoreleasePoolPop (in CoreFoundation)
15 0x00007fff8c52447a -[NSAutoreleasePool drain] (in Foundation)
16 0x00007fff8657a27e -[NSApplication run] (in AppKit)
17 0x00007fff8651ebd6 NSApplicationMain (in AppKit)
18 0x00007fff91f377e1 start (in libdyld.dylib)
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff903ad212 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff8a7fcb54 pthread_kill + 90
2 libsystem_c.dylib 0x00007fff8a840dce abort + 143
3 com.apple.dt.IDEKit 0x000000010e3a0a93
+[IDEAssertionHandler _handleAssertionWithLogString:reason:] + 763
4 com.apple.dt.IDEKit 0x000000010e3a12ee
-[IDEAssertionHandler
handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:]
+ 1117
5 com.apple.dt.DVTFoundation 0x000000010d137655
_DVTAssertionHandler + 421
6 com.apple.dt.DVTFoundation 0x000000010d137984
_DVTAssertionFailureHandler + 322
7 com.apple.dt.DVTFoundation 0x000000010d20c6a6
_DVTInvalidation_DeallocSuper + 480
8 com.apple.dt.IDEKit 0x000000010e33e2a3
-[IDESourceControlSSLAuthenticationWindowController .cxx_destruct] + 94
9 libobjc.A.dylib 0x00007fff8c00bfcc
object_cxxDestructFromClass(objc_object*, objc_class*) + 100
10 libobjc.A.dylib 0x00007fff8c005922
objc_destructInstance + 91
11 libobjc.A.dylib 0x00007fff8c005fa0 object_dispose + 22
12 com.apple.dt.DVTFoundation 0x000000010d161995
__DVTSetupKVODeallocAssertions_block_invoke_371 + 264
13 com.apple.AppKit 0x00007fff865797fa -[NSResponder
dealloc] + 129
14 com.apple.AppKit 0x00007fff864af162
-[NSWindowController dealloc] + 616
15 com.apple.AppKit 0x00007fff86623901
-[NSWindowController release] + 159
16 com.apple.AppKit 0x00007fff867595b0 -[NSAutounbinder
dealloc] + 51
17 libobjc.A.dylib 0x00007fff8c006230 (anonymous
namespace)::AutoreleasePoolPage::pop(void*) + 464
18 com.apple.CoreFoundation 0x00007fff87a0cd72
_CFAutoreleasePoolPop + 34
19 com.apple.Foundation 0x00007fff8c52447a -[NSAutoreleasePool
drain] + 154
20 com.apple.AppKit 0x00007fff8657a27e -[NSApplication
run] + 736
21 com.apple.AppKit 0x00007fff8651ebd6 NSApplicationMain +
869
22 libdyld.dylib 0x00007fff91f377e1 start + 1
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff903add16 kevent + 10
1 libdispatch.dylib 0x00007fff8641cdea
_dispatch_mgr_invoke + 883
2 libdispatch.dylib 0x00007fff8641c9ee
_dispatch_mgr_thread + 54
Thread 2:: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.Foundation 0x00007fff8c501546
+[NSURLConnection(Loader) _resourceLoadLoop:] + 356
6 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
7 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
8 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 3:
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.DTDeviceKitBase 0x000000011466875a
-[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 164
6 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
7 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
8 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 4:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x00007fff903ad322 __select + 10
1 com.apple.CoreFoundation 0x00007fff87a50f46 __CFSocketManager +
1302
2 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
3 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 5:: DYMobileDeviceManager
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.Foundation 0x00007fff8c5647ee
-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
6 com.apple.Foundation 0x00007fff8c4fd1aa
-[NSRunLoop(NSRunLoop) run] + 74
7 com.apple.GPUToolsMobileFoundation 0x0000000118afe9bb
-[DYMobileDeviceManager _deviceNotificationThread:] + 132
8 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
9 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
10 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 6:: CVDisplayLink
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.CoreVideo 0x00007fff8b5872a1
CVDisplayLink::runIOThread() + 689
3 com.apple.CoreVideo 0x00007fff8b586fd7
startIOThread(void*) + 148
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 7:
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.Xcode.DevToolsCore 0x0000000113436166 -[XCBlockQueue
_processBlocksInThreadSlotNumber:] + 506
3 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 8:
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.Xcode.DevToolsCore 0x0000000113436166 -[XCBlockQueue
_processBlocksInThreadSlotNumber:] + 506
3 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 9:
0 libsystem_kernel.dylib 0x00007fff903ad0fa __psynch_cvwait + 10
1 libsystem_c.dylib 0x00007fff8a7fffe9 _pthread_cond_wait
+ 869
2 com.apple.Xcode.DevToolsCore 0x0000000113436166 -[XCBlockQueue
_processBlocksInThreadSlotNumber:] + 506
3 com.apple.Foundation 0x00007fff8c55f562 __NSThread__main__
+ 1345
4 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
5 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 10:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 11:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 12:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 13:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 14:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 15:
0 libsystem_kernel.dylib 0x00007fff903ad6d6 __workq_kernreturn
+ 10
1 libsystem_c.dylib 0x00007fff8a7fdf4c
_pthread_workq_return + 25
2 libsystem_c.dylib 0x00007fff8a7fdd13 _pthread_wqthread +
412
3 libsystem_c.dylib 0x00007fff8a7e81d1 start_wqthread + 13
Thread 16:
0 libsystem_kernel.dylib 0x00007fff903ab686 mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff903aac42 mach_msg + 70
2 com.apple.CoreFoundation 0x00007fff87a0c233
__CFRunLoopServiceMachPort + 195
3 com.apple.CoreFoundation 0x00007fff87a11916 __CFRunLoopRun + 1078
4 com.apple.CoreFoundation 0x00007fff87a110e2
CFRunLoopRunSpecific + 290
5 com.apple.DebugSymbols 0x00007fff8728a590
SpotlightQueryThread(void*) + 356
6 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
7 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 17:
0 libsystem_kernel.dylib 0x00007fff903ad386 __semwait_signal + 10
1 libsystem_c.dylib 0x00007fff8a885800 nanosleep + 163
2 com.apple.CoreSymbolication 0x00007fff8fee2358 0x7fff8fecc000 + 90968
3 libsystem_c.dylib 0x00007fff8a7fb7a2 _pthread_start + 327
4 libsystem_c.dylib 0x00007fff8a7e81e1 thread_start + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx:
0x00007fff52b72108 rdx: 0x0000000000000000
rdi: 0x0000000000000c07 rsi: 0x0000000000000006 rbp:
0x00007fff52b72130 rsp: 0x00007fff52b72108
r8: 0x00007fff769b7278 r9: 0x0000000000000141 r10:
0x0000000020000000 r11: 0x0000000000000206
r12: 0x00007fff52b72248 r13: 0x000000010ea71680 r14:
0x00007fff769b8180 r15: 0x00007fff52b721f0
rip: 0x00007fff903ad212 rfl: 0x0000000000000206 cr2: 0x00007f86d883a400
Logical CPU: 0
Best way to classify labeled sentences from a set of documents
Best way to classify labeled sentences from a set of documents
I have a classification problem and I need to figure out the best approach
to solve it. I have a set of training documents, where some the sentences
and/or paragraphs within the documents are labeled with some tags. Not all
sentences/paragraphs are labeled. A sentence or paragraph may have more
than one tag/label. What I want to do is make some model, where given a
new documents, it will give me suggested labels for each of the
sentences/paragraphs within the document. Ideally, it would only give me
high-probability suggestions.
If I use something like nltk NaiveBayesClassifier, it gives poor results,
I think because it does not take into account the "unlabeled" sentences
from the training documents, which will contain many similar words and
phrases as the labeled sentences. The documents are legal/financial in
nature and are filled with legal/financial jargon most of which should be
discounted in the classification model.
Is there some better classification algorithm that Naive Bayes, or is
there some way to push the unlabelled data into naive bayes, in addition
to the labelled data from the training set?
I have a classification problem and I need to figure out the best approach
to solve it. I have a set of training documents, where some the sentences
and/or paragraphs within the documents are labeled with some tags. Not all
sentences/paragraphs are labeled. A sentence or paragraph may have more
than one tag/label. What I want to do is make some model, where given a
new documents, it will give me suggested labels for each of the
sentences/paragraphs within the document. Ideally, it would only give me
high-probability suggestions.
If I use something like nltk NaiveBayesClassifier, it gives poor results,
I think because it does not take into account the "unlabeled" sentences
from the training documents, which will contain many similar words and
phrases as the labeled sentences. The documents are legal/financial in
nature and are filled with legal/financial jargon most of which should be
discounted in the classification model.
Is there some better classification algorithm that Naive Bayes, or is
there some way to push the unlabelled data into naive bayes, in addition
to the labelled data from the training set?
CakePHP: Trackable Behavior with associated models
CakePHP: Trackable Behavior with associated models
I'm trying to use trackable behavior in CakePHP but with associated models.
I've taken TrackableBehavior as a Model Behavior from Croogo which is
based upon a plugin from Jose Gonzalez.
It works like a charm, but I'm trying to find a way to make it work
properly when the data of the child/associated model are returned in a
view of the "parent" model.
The associations are:
Clients hasMany Notes
Notes belongTo Clients
To be more clear: Both Models use Trackable Behavior. In the Clients
"view" view ( ugh ) I list all the notes that are owned by the Client. I'd
like Trackable Behavior to return the trackable records ( created_by /
modified_by ) for each note that is listed, yet it only returns the
Trackable Array for the parent model ( Clients ).
Any ideas?
I'm trying to use trackable behavior in CakePHP but with associated models.
I've taken TrackableBehavior as a Model Behavior from Croogo which is
based upon a plugin from Jose Gonzalez.
It works like a charm, but I'm trying to find a way to make it work
properly when the data of the child/associated model are returned in a
view of the "parent" model.
The associations are:
Clients hasMany Notes
Notes belongTo Clients
To be more clear: Both Models use Trackable Behavior. In the Clients
"view" view ( ugh ) I list all the notes that are owned by the Client. I'd
like Trackable Behavior to return the trackable records ( created_by /
modified_by ) for each note that is listed, yet it only returns the
Trackable Array for the parent model ( Clients ).
Any ideas?
Show Hide With Jquery Want to add a Minus Sign when it is showing
Show Hide With Jquery Want to add a Minus Sign when it is showing
I am using the following code, which is working great but I would like to
switch out the <div id"Show"> with the <div id"hide"> when the Show is
active. Does anyone know how to do this?
<!--Script for Show Hide-->
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#hide").click(function(){
$("#aboutcontent").hide();
});
$("#show").click(function(){
$("#aboutcontent").show();
});
});
</script>
<!--/script for show hide-->
HTML:
<div class="homepage-acecontent">
<div id="show"><img align="left" style="margin-right:5px;"
src="/template/images/btn-expand.png" border="0" alt="" /> ABOUT GENUINE
H-D<sup>®</sup> WORK WEAR</div>
<div id="hide"><img align="left" style="margin-right:5px;"
src="/template/images/btn-close.png" border="0" alt="" /></div>
<div id="aboutcontent">Content to show and hide goes
here<!--/aboutcontent--></div>
<!--/homepage-acecontent--></div>
CSS:
.homepage-acecontent{float:left; width: 1148px; color:#ff6418;
font-size:11px; font-weight:bold; margin-left:40px;}
#aboutcontent{float:left; width: 1148px; color:#fff; font-size:14px;
font-weight:normal; **display:none;**}
#aboutcontent a:link, #aboutcontent a:visited{color:#ff6418;
text-decoration:none;}
#aboutcontent a:hover{color:#f68428;}
#show{cursor:pointer;}
I am using the following code, which is working great but I would like to
switch out the <div id"Show"> with the <div id"hide"> when the Show is
active. Does anyone know how to do this?
<!--Script for Show Hide-->
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#hide").click(function(){
$("#aboutcontent").hide();
});
$("#show").click(function(){
$("#aboutcontent").show();
});
});
</script>
<!--/script for show hide-->
HTML:
<div class="homepage-acecontent">
<div id="show"><img align="left" style="margin-right:5px;"
src="/template/images/btn-expand.png" border="0" alt="" /> ABOUT GENUINE
H-D<sup>®</sup> WORK WEAR</div>
<div id="hide"><img align="left" style="margin-right:5px;"
src="/template/images/btn-close.png" border="0" alt="" /></div>
<div id="aboutcontent">Content to show and hide goes
here<!--/aboutcontent--></div>
<!--/homepage-acecontent--></div>
CSS:
.homepage-acecontent{float:left; width: 1148px; color:#ff6418;
font-size:11px; font-weight:bold; margin-left:40px;}
#aboutcontent{float:left; width: 1148px; color:#fff; font-size:14px;
font-weight:normal; **display:none;**}
#aboutcontent a:link, #aboutcontent a:visited{color:#ff6418;
text-decoration:none;}
#aboutcontent a:hover{color:#f68428;}
#show{cursor:pointer;}
I need to see which lines in my javascript files were run
I need to see which lines in my javascript files were run
I did a big refactoring in javascript application which not have a tests.
I'd like to see what lines are processed(just highlight) when I use the
site. What tools are there for this purpose?
I did a big refactoring in javascript application which not have a tests.
I'd like to see what lines are processed(just highlight) when I use the
site. What tools are there for this purpose?
Unit testing handling of date inputs in JavaScript regardless of time zone
Unit testing handling of date inputs in JavaScript regardless of time zone
I have a form where a user can enter a date, i.e. <input type="date"> the
value is submitted in yyyy-MM-dd format. When I create a Date object with
the string it assumes the time zone is the one the user's browser is set
to – this is the behavior I want.
I'm then using the date value to make queries against a REST API that
expects ISO date/time strings. That's no problem as the toISOString
function on the Date object handles everything correctly.
However, when I'm unit testing this code – setting my input to a
yyyy-MM-dd string then asserting that the output is an expected ISO
timestamp string the tests can only work in a particular time zone. Is
there a way I can force the time zone in the test?
I've tried using Jasmine spies to do something like:
var fixedTime = moment().zone(60).toDate()
spyOn(window, 'Date').andCallFake(function() {
return fixedTime;
});
But given there are so many variants of the constructor and so many ways
it gets called by moment.js this is pretty impractical and is getting me
into infinite loops.
I have a form where a user can enter a date, i.e. <input type="date"> the
value is submitted in yyyy-MM-dd format. When I create a Date object with
the string it assumes the time zone is the one the user's browser is set
to – this is the behavior I want.
I'm then using the date value to make queries against a REST API that
expects ISO date/time strings. That's no problem as the toISOString
function on the Date object handles everything correctly.
However, when I'm unit testing this code – setting my input to a
yyyy-MM-dd string then asserting that the output is an expected ISO
timestamp string the tests can only work in a particular time zone. Is
there a way I can force the time zone in the test?
I've tried using Jasmine spies to do something like:
var fixedTime = moment().zone(60).toDate()
spyOn(window, 'Date').andCallFake(function() {
return fixedTime;
});
But given there are so many variants of the constructor and so many ways
it gets called by moment.js this is pretty impractical and is getting me
into infinite loops.
How to create custom image gallery on m2epro
How to create custom image gallery on m2epro
Im using m2e pro a extension for magento to list a prodcut on ebay. i want
to create custom image gallery with pop up feature. There's anybody here
know the html tag for image for m2epro
Thanks in advance
Mark
Im using m2e pro a extension for magento to list a prodcut on ebay. i want
to create custom image gallery with pop up feature. There's anybody here
know the html tag for image for m2epro
Thanks in advance
Mark
Wednesday, 18 September 2013
Async Task cancellation best practices: user versus program
Async Task cancellation best practices: user versus program
I'm working on a library which does some lazy idle background work on a UI
thread (it has to be that way because of the legacy COM use). The task can
be cancelled by the consuming app via cancellation token, or it can be
explicitly cancelled as a result of user action (via
IUserFeedback.Continue). I'm trying to follow the MSDN pattern for task
cancellation.
My question is, should I make the difference between cancellation by user
(and return false) and by the calling app (throw), as IdleWorker1 does. Or
should I treat both cases equally and just throw, as with IdleWorker2?
I don't have any strict requirements from the designers of the interface
(the task is essentially never ending, so they only care about how much
work has actually been done so far, and they're receiving the progress via
IUserFeedback.Continue).
In a nutshell, IdleWorker1:
interface IUserFeedback
{
bool Continue(int n);
}
class IdleWorker1
{
public async Task<bool> DoIdleWorkAsync(CancellationToken ct, int
timeSlice, IUserFeedback feedback)
{
bool more = true;
int n = 0;
while (more)
{
ct.ThrowIfCancellationRequested();
more = feedback.Continue(++n);
await Task.Delay(timeSlice);
}
return more;
}
}
IdleWorker2:
class IdleWorker2
{
public async Task DoIdleWorkAsync(CancellationToken ct, int timeSlice,
IUserFeedback feedback)
{
int n = 0;
for (;;)
{
ct.ThrowIfCancellationRequested();
if (!feedback.Continue(++n))
throw new TaskCanceledException();
await Task.Delay(timeSlice);
}
}
}
I'm working on a library which does some lazy idle background work on a UI
thread (it has to be that way because of the legacy COM use). The task can
be cancelled by the consuming app via cancellation token, or it can be
explicitly cancelled as a result of user action (via
IUserFeedback.Continue). I'm trying to follow the MSDN pattern for task
cancellation.
My question is, should I make the difference between cancellation by user
(and return false) and by the calling app (throw), as IdleWorker1 does. Or
should I treat both cases equally and just throw, as with IdleWorker2?
I don't have any strict requirements from the designers of the interface
(the task is essentially never ending, so they only care about how much
work has actually been done so far, and they're receiving the progress via
IUserFeedback.Continue).
In a nutshell, IdleWorker1:
interface IUserFeedback
{
bool Continue(int n);
}
class IdleWorker1
{
public async Task<bool> DoIdleWorkAsync(CancellationToken ct, int
timeSlice, IUserFeedback feedback)
{
bool more = true;
int n = 0;
while (more)
{
ct.ThrowIfCancellationRequested();
more = feedback.Continue(++n);
await Task.Delay(timeSlice);
}
return more;
}
}
IdleWorker2:
class IdleWorker2
{
public async Task DoIdleWorkAsync(CancellationToken ct, int timeSlice,
IUserFeedback feedback)
{
int n = 0;
for (;;)
{
ct.ThrowIfCancellationRequested();
if (!feedback.Continue(++n))
throw new TaskCanceledException();
await Task.Delay(timeSlice);
}
}
}
how to Design the Database if a customer can be a person or a company
how to Design the Database if a customer can be a person or a company
Its my first web apps to develop and I'm wondering how to design the
database if a customer can be either a person or a company? Do I need to
have a table person and a table for company and create another table for
customer with personID and companyID as foreign key. Thanks in advance
Its my first web apps to develop and I'm wondering how to design the
database if a customer can be either a person or a company? Do I need to
have a table person and a table for company and create another table for
customer with personID and companyID as foreign key. Thanks in advance
Generating all n-bit strings whose hamming distance is n/2.
Generating all n-bit strings whose hamming distance is n/2.
I'm playing with some variant of Hadamard matrices. I want to generate all
n-bit binary strings which satisfy these requirements:
You can assume that n is a multiple of 4.
The first string is 0n.
Ë a string of all 0s.
The remaining strings are sorted in alphabetic order.
Ë 0 comes before 1.
Every two distinct n-bit strings have Hamming distance n/2.
Ë Two distinct n-bit strings agree in exactly n/2 positions and disagree
in exactly n/2 positions.
Due to the above condition, every string except for the first string must
have the same number of 0s and 1s.
Ë Every string other than the first string must have n/2 ones and n/2 zeros.
For example, this is the list that I want for when n=4.
0000
0011
0110
0101
You can easily see that every two distinct rows have hamming distance n/2
= 4/2 = 2 and the list satisfies all the other requirements as well.
Note that I want to generate all such strings. My algorithm may just
output three strings 0000, 0011, and 0101 before terminating. This list
satisfies all the requirements above but it misses 0110.
What would be a good way to generate such sets?
A python pseudo-code is preferred but any high-level description will do.
What is the maximum number of such strings for a given n?
For example, when n=4, the max number of such strings happen to be 4. I'm
wondering whether there can be any closed form solution for this upper
bound.
Thanks.
I'm playing with some variant of Hadamard matrices. I want to generate all
n-bit binary strings which satisfy these requirements:
You can assume that n is a multiple of 4.
The first string is 0n.
Ë a string of all 0s.
The remaining strings are sorted in alphabetic order.
Ë 0 comes before 1.
Every two distinct n-bit strings have Hamming distance n/2.
Ë Two distinct n-bit strings agree in exactly n/2 positions and disagree
in exactly n/2 positions.
Due to the above condition, every string except for the first string must
have the same number of 0s and 1s.
Ë Every string other than the first string must have n/2 ones and n/2 zeros.
For example, this is the list that I want for when n=4.
0000
0011
0110
0101
You can easily see that every two distinct rows have hamming distance n/2
= 4/2 = 2 and the list satisfies all the other requirements as well.
Note that I want to generate all such strings. My algorithm may just
output three strings 0000, 0011, and 0101 before terminating. This list
satisfies all the requirements above but it misses 0110.
What would be a good way to generate such sets?
A python pseudo-code is preferred but any high-level description will do.
What is the maximum number of such strings for a given n?
For example, when n=4, the max number of such strings happen to be 4. I'm
wondering whether there can be any closed form solution for this upper
bound.
Thanks.
301 redirect not working for page ending in /
301 redirect not working for page ending in /
I'm trying to set up a 301 redirect a WordPress page ending in / to a .php
page on my site. I've tried this:
Redirect 301 http://www.mydomain.com/blog/old-page/
http://www.mydomain.com/new-page.php
After searching this site I also tried this:
RewriteRule ^http://www.mydomain.com/blog/old-page/ý$
http://www.mydomain.com/new-page.php [R=301,L]
Neither one works. Any idea what I'm doing wrong?
I'm trying to set up a 301 redirect a WordPress page ending in / to a .php
page on my site. I've tried this:
Redirect 301 http://www.mydomain.com/blog/old-page/
http://www.mydomain.com/new-page.php
After searching this site I also tried this:
RewriteRule ^http://www.mydomain.com/blog/old-page/ý$
http://www.mydomain.com/new-page.php [R=301,L]
Neither one works. Any idea what I'm doing wrong?
My app shuts down and says "unfortunatel(appname) has stopped working"..I'm completely new to programming . Please Help. Thanks
My app shuts down and says "unfortunatel(appname) has stopped
working"..I'm completely new to programming . Please Help. Thanks
THIS IS MY LOGCAT
09-18 17:19:50.770: D/AndroidRuntime(797): Shutting down VM
09-18 17:19:50.770: W/dalvikvm(797): threadid=1: thread exiting with
uncaught exception (group=0x40a71930)
09-18 17:19:50.800: E/AndroidRuntime(797): FATAL EXCEPTION: main
09-18 17:19:50.800: E/AndroidRuntime(797): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.thenewboston.honey/com.thenewboston.honey.StartingPoint}:
java.lang.NullPointerException
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.os.Looper.loop(Looper.java:137)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.main(ActivityThread.java:5041)
09-18 17:19:50.800: E/AndroidRuntime(797): at
java.lang.reflect.Method.invokeNative(Native Method)
09-18 17:19:50.800: E/AndroidRuntime(797): at
java.lang.reflect.Method.invoke(Method.java:511)
09-18 17:19:50.800: E/AndroidRuntime(797): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-18 17:19:50.800: E/AndroidRuntime(797): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-18 17:19:50.800: E/AndroidRuntime(797): at
dalvik.system.NativeStart.main(Native Method)
09-18 17:19:50.800: E/AndroidRuntime(797): Caused by:
java.lang.NullPointerException
09-18 17:19:50.800: E/AndroidRuntime(797): at
com.thenewboston.honey.StartingPoint.onCreate(StartingPoint.java:26)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.Activity.performCreate(Activity.java:5104)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
09-18 17:19:50.800: E/AndroidRuntime(797): ... 11 more
working"..I'm completely new to programming . Please Help. Thanks
THIS IS MY LOGCAT
09-18 17:19:50.770: D/AndroidRuntime(797): Shutting down VM
09-18 17:19:50.770: W/dalvikvm(797): threadid=1: thread exiting with
uncaught exception (group=0x40a71930)
09-18 17:19:50.800: E/AndroidRuntime(797): FATAL EXCEPTION: main
09-18 17:19:50.800: E/AndroidRuntime(797): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.thenewboston.honey/com.thenewboston.honey.StartingPoint}:
java.lang.NullPointerException
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.os.Looper.loop(Looper.java:137)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.main(ActivityThread.java:5041)
09-18 17:19:50.800: E/AndroidRuntime(797): at
java.lang.reflect.Method.invokeNative(Native Method)
09-18 17:19:50.800: E/AndroidRuntime(797): at
java.lang.reflect.Method.invoke(Method.java:511)
09-18 17:19:50.800: E/AndroidRuntime(797): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-18 17:19:50.800: E/AndroidRuntime(797): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-18 17:19:50.800: E/AndroidRuntime(797): at
dalvik.system.NativeStart.main(Native Method)
09-18 17:19:50.800: E/AndroidRuntime(797): Caused by:
java.lang.NullPointerException
09-18 17:19:50.800: E/AndroidRuntime(797): at
com.thenewboston.honey.StartingPoint.onCreate(StartingPoint.java:26)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.Activity.performCreate(Activity.java:5104)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
09-18 17:19:50.800: E/AndroidRuntime(797): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
09-18 17:19:50.800: E/AndroidRuntime(797): ... 11 more
Sting Matching in Shell script
Sting Matching in Shell script
I am trying to match two strings (IpAddress) as below. But its not matching.
i=192.168.2.29
ipCheckInConfig="SG_1=192.168.2.24,192.168.2.29
> SG_2=192.168.2.20,192.168.2.23,192.168.2.31"
if echo "$i" | egrep -q "$ipCheckInConfig" ; then
echo "Matched"
else
echo "Not Matched"
fi
Could someone please help?
I am trying to match two strings (IpAddress) as below. But its not matching.
i=192.168.2.29
ipCheckInConfig="SG_1=192.168.2.24,192.168.2.29
> SG_2=192.168.2.20,192.168.2.23,192.168.2.31"
if echo "$i" | egrep -q "$ipCheckInConfig" ; then
echo "Matched"
else
echo "Not Matched"
fi
Could someone please help?
C#: Can I use WebSockets for desktop applications?
C#: Can I use WebSockets for desktop applications?
That's it. It's a newbie question, probably. I'm almost giving up on
TcpClient/Listener because of NAT and firewall issues. I wanted to know if
theres an alternative. port 80 probably doesn't have to deal with any of
these annoying things. I hope the answer is Yes.
That's it. It's a newbie question, probably. I'm almost giving up on
TcpClient/Listener because of NAT and firewall issues. I wanted to know if
theres an alternative. port 80 probably doesn't have to deal with any of
these annoying things. I hope the answer is Yes.
Is it required to nullify ArrayList before recreating an object?
Is it required to nullify ArrayList before recreating an object?
I am not sure if it is going to consume more & more memory while working
with the arraylist. I am confused when going through following block of
code:
List<String> headerRow = new ArrayList<String>();
headerRow = new ArrayList<>();
headerRow.add("");
xlHeader.add(headerRow);
// headerRow = null; //<----- This is the line of
confusion.
headerRow = new ArrayList<>();
Should the headerRow be nullified ?
What will happed to the Blank String Object ("") added to headerRow ?
I am not sure if it is going to consume more & more memory while working
with the arraylist. I am confused when going through following block of
code:
List<String> headerRow = new ArrayList<String>();
headerRow = new ArrayList<>();
headerRow.add("");
xlHeader.add(headerRow);
// headerRow = null; //<----- This is the line of
confusion.
headerRow = new ArrayList<>();
Should the headerRow be nullified ?
What will happed to the Blank String Object ("") added to headerRow ?
Tuesday, 17 September 2013
clojure :use not working
clojure :use not working
When I try to use
(ns eight-puzzle.core
(:use [clojure.contrib.seq :only (positions)]))
i get this error
java.io.FileNotFoundException: Could not locate
clojure/contrib/seq__init.class or clojure/contrib/seq.clj on
classpath:
RT.java:443 clojure.lang.RT.load
RT.java:411 clojure.lang.RT.load
core.clj:5530 clojure.core/load[fn]
core.clj:5529 clojure.core/load
RestFn.java:408 clojure.lang.RestFn.invoke
core.clj:5336 clojure.core/load-one
core.clj:5375 clojure.core/load-lib[fn]
core.clj:5374 clojure.core/load-lib
RestFn.java:142 clojure.lang.RestFn.applyTo
core.clj:619 clojure.core/apply
core.clj:5413 clojure.core/load-libs
RestFn.java:137 clojure.lang.RestFn.applyTo
core.clj:621 clojure.core/apply
core.clj:5507 clojure.core/use
RestFn.java:408 clojure.lang.RestFn.invoke
NO_SOURCE_FILE:1 eight-puzzle.core/eval8699[fn]
NO_SOURCE_FILE:1 eight-puzzle.core/eval8699
And this problem happens when ever i try to import anything in. Did i do
something wrong when setting up clojure?
When I try to use
(ns eight-puzzle.core
(:use [clojure.contrib.seq :only (positions)]))
i get this error
java.io.FileNotFoundException: Could not locate
clojure/contrib/seq__init.class or clojure/contrib/seq.clj on
classpath:
RT.java:443 clojure.lang.RT.load
RT.java:411 clojure.lang.RT.load
core.clj:5530 clojure.core/load[fn]
core.clj:5529 clojure.core/load
RestFn.java:408 clojure.lang.RestFn.invoke
core.clj:5336 clojure.core/load-one
core.clj:5375 clojure.core/load-lib[fn]
core.clj:5374 clojure.core/load-lib
RestFn.java:142 clojure.lang.RestFn.applyTo
core.clj:619 clojure.core/apply
core.clj:5413 clojure.core/load-libs
RestFn.java:137 clojure.lang.RestFn.applyTo
core.clj:621 clojure.core/apply
core.clj:5507 clojure.core/use
RestFn.java:408 clojure.lang.RestFn.invoke
NO_SOURCE_FILE:1 eight-puzzle.core/eval8699[fn]
NO_SOURCE_FILE:1 eight-puzzle.core/eval8699
And this problem happens when ever i try to import anything in. Did i do
something wrong when setting up clojure?
Jquery validate - needing at least 1 of 2 fields populated with anything other than default text
Jquery validate - needing at least 1 of 2 fields populated with anything
other than default text
I have an html contact form which has default values in each field - ie.
"First name" (wherein I'm using clearfield.js so that the values disappear
when the user clicks)
I have 2 fields which must be filled in, and 2 fields where either of
which must be filled in. Of course, all fields are already recognised as
being filled in as they all have default values. I've worked my way around
this by using validator.addMethod to ignore the default phrases.
I've also managed to tweak the validation to allow at least 1 of 2 fields
to be filled in using validator.addMethod, but only when I take out the
default values.
My problem occurs when I have the default values present and I wish to
have at least 1 of 2 fields filled in. I can't figure out how to have the
validation recognise when/if at least one field has a unique non-default
value.
I've included my code below.
I'm no expert in jquery/javascript, so hopefully there's a simple solution
out there.
<script type="text/javascript">
$(document).ready(function() {
jQuery.validator.addMethod("notEqual", function(value, element,
param) {
return this.optional(element) || value != param;
}, "This field is required.");
jQuery.validator.addMethod("require_from_group", function (value,
element, options) {
var numberRequired = options[0];
var selector = options[1];
var fields = $(selector, element.form);
var filled_fields = fields.filter(function () {
return $(this).val() != "";
});
var empty_fields = fields.not(filled_fields);
if (filled_fields.length < numberRequired && empty_fields[0]
== element) {
return false;
}
return true;
}, jQuery.format("Please enter either a phone number or email
address."));
$("#contact-form").validate({
groups: {
names: "phone email"
},
rules: {
fname: {
required: true,
notEqual: "First name*"
},
lname: {
required: true,
notEqual: "Last name*"
},
phone: {
require_from_group: [1, ".phoneEmail"]
},
email: {
require_from_group: [1, ".phoneEmail"]
},
}
});
});
jQuery.extend(jQuery.validator.messages, {
require_from_group: jQuery.format("'Please enter either username/
email address to recover password'/Please fill out at least {0} of
these fields.")
});
<form id="contact-form" method="post" action="contact-submitted.php" >
<input type="text" class="clearField" name="fname" id="fnameField"
value="First name*" />
<input type="text" class="clearField" name="lname" id="lnameField"
value="Last name*" />
<input type="text" class="hidden" name="subject" id="subjectField" />
<input type="text" class="clearField phoneEmail" name="phone"
id="phoneField" value="Phone number*" />
<input type="text" class="clearField phoneEmail" name="email"
id="emailField" value="Email" />
<textarea name="message" class="clearField" id="messageField">Your
message</textarea>
<span class="required-field">*required field</span>
<input type="submit" id="contact-submit" value="Start planning
now" />
</form>
other than default text
I have an html contact form which has default values in each field - ie.
"First name" (wherein I'm using clearfield.js so that the values disappear
when the user clicks)
I have 2 fields which must be filled in, and 2 fields where either of
which must be filled in. Of course, all fields are already recognised as
being filled in as they all have default values. I've worked my way around
this by using validator.addMethod to ignore the default phrases.
I've also managed to tweak the validation to allow at least 1 of 2 fields
to be filled in using validator.addMethod, but only when I take out the
default values.
My problem occurs when I have the default values present and I wish to
have at least 1 of 2 fields filled in. I can't figure out how to have the
validation recognise when/if at least one field has a unique non-default
value.
I've included my code below.
I'm no expert in jquery/javascript, so hopefully there's a simple solution
out there.
<script type="text/javascript">
$(document).ready(function() {
jQuery.validator.addMethod("notEqual", function(value, element,
param) {
return this.optional(element) || value != param;
}, "This field is required.");
jQuery.validator.addMethod("require_from_group", function (value,
element, options) {
var numberRequired = options[0];
var selector = options[1];
var fields = $(selector, element.form);
var filled_fields = fields.filter(function () {
return $(this).val() != "";
});
var empty_fields = fields.not(filled_fields);
if (filled_fields.length < numberRequired && empty_fields[0]
== element) {
return false;
}
return true;
}, jQuery.format("Please enter either a phone number or email
address."));
$("#contact-form").validate({
groups: {
names: "phone email"
},
rules: {
fname: {
required: true,
notEqual: "First name*"
},
lname: {
required: true,
notEqual: "Last name*"
},
phone: {
require_from_group: [1, ".phoneEmail"]
},
email: {
require_from_group: [1, ".phoneEmail"]
},
}
});
});
jQuery.extend(jQuery.validator.messages, {
require_from_group: jQuery.format("'Please enter either username/
email address to recover password'/Please fill out at least {0} of
these fields.")
});
<form id="contact-form" method="post" action="contact-submitted.php" >
<input type="text" class="clearField" name="fname" id="fnameField"
value="First name*" />
<input type="text" class="clearField" name="lname" id="lnameField"
value="Last name*" />
<input type="text" class="hidden" name="subject" id="subjectField" />
<input type="text" class="clearField phoneEmail" name="phone"
id="phoneField" value="Phone number*" />
<input type="text" class="clearField phoneEmail" name="email"
id="emailField" value="Email" />
<textarea name="message" class="clearField" id="messageField">Your
message</textarea>
<span class="required-field">*required field</span>
<input type="submit" id="contact-submit" value="Start planning
now" />
</form>
MVC Project cross talk
MVC Project cross talk
I am using Eclipse Juno with Spring STS 3.1.0. I have 2 mvc projects in
the same workspace. One of the projects can send and receive jms messages.
It uses a Spring JmsMessagListener bean to receive messages. The bean maps
to a listener class with an onMessage method. When I run the project
withoug jms in on the VMWare tc server, I get the following message in the
console every 5 seconds:
WARN : org.springframework.jms.listener.DefaultMessageListenerContainer -
Could not refresh JMS Connection for destination 'mht.alert.queue' -
retrying in 5000 ms. Cause: Could not connect to broker URL:
tcp://localhost:61616. Reason: java.net.ConnectException: Connection timed
out: connect
The project seems to be attempting to connect to my activemq broker which
is not running since I am not running the project with jms built in. I
don't understand why this should happen. I have included the web.xml files
for the two projects. Hopefully someone can give me a clue as to why this
is happening. It's not a showstopper as I can ignore the messages or bring
up the broker to silence them, however it would be best to deal with it
properly.
Thanks in advance
Here is the web.xml file for the project that does not have jms:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns
/javaee/web-app_3_0.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<listener>
<listenerclass>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Here is the web.xml file for the project with jms built in:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml,
/WEB-INF/spring/jms-config.xml,
/WEB-INF/spring/security-config.xml,
/WEB-INF/spring/datasource-tx.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--<start id="filter_security" /> -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<!--<end id="filter_security" />-->
<!--<start id="filter_mapping_security" /> -->
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--<end id="filter_mapping_security" />-->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- This servlet is mapped to all requests at the root level -->
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Here is the contents of my root-context.xml, not that spring-security.xml
is commented out
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<!-- Root Context: defines shared resources visible to all other web
components -->
<!-- Import the datasource-tx.xml file to configure the StudentDao
service and make
it visible to the entire application
-->
<import resource="classpath:datasource-tx.xml" />
<!-- <import resource="spring-security.xml" /> -->
</beans>
I am using Eclipse Juno with Spring STS 3.1.0. I have 2 mvc projects in
the same workspace. One of the projects can send and receive jms messages.
It uses a Spring JmsMessagListener bean to receive messages. The bean maps
to a listener class with an onMessage method. When I run the project
withoug jms in on the VMWare tc server, I get the following message in the
console every 5 seconds:
WARN : org.springframework.jms.listener.DefaultMessageListenerContainer -
Could not refresh JMS Connection for destination 'mht.alert.queue' -
retrying in 5000 ms. Cause: Could not connect to broker URL:
tcp://localhost:61616. Reason: java.net.ConnectException: Connection timed
out: connect
The project seems to be attempting to connect to my activemq broker which
is not running since I am not running the project with jms built in. I
don't understand why this should happen. I have included the web.xml files
for the two projects. Hopefully someone can give me a clue as to why this
is happening. It's not a showstopper as I can ignore the messages or bring
up the broker to silence them, however it would be best to deal with it
properly.
Thanks in advance
Here is the web.xml file for the project that does not have jms:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns
/javaee/web-app_3_0.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<listener>
<listenerclass>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Here is the web.xml file for the project with jms built in:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml,
/WEB-INF/spring/jms-config.xml,
/WEB-INF/spring/security-config.xml,
/WEB-INF/spring/datasource-tx.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--<start id="filter_security" /> -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<!--<end id="filter_security" />-->
<!--<start id="filter_mapping_security" /> -->
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--<end id="filter_mapping_security" />-->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- This servlet is mapped to all requests at the root level -->
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Here is the contents of my root-context.xml, not that spring-security.xml
is commented out
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<!-- Root Context: defines shared resources visible to all other web
components -->
<!-- Import the datasource-tx.xml file to configure the StudentDao
service and make
it visible to the entire application
-->
<import resource="classpath:datasource-tx.xml" />
<!-- <import resource="spring-security.xml" /> -->
</beans>
Can someone explain/give a breakdown of this shell parameter substitution? ${cfg+-f "$cfg"}
Can someone explain/give a breakdown of this shell parameter substitution?
${cfg+-f "$cfg"}
I was looking for a good workaround for keeping my .tmux.conf file
consistent across systems (I have both OS X and Ubuntu and they have
different techniques for copy/paste support) when I came across this
comment that offered a solution:
https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/issues/8#issuecomment-4134987
But before I use the code snippet in the comment, I'd like to fully
understand what it's doing. In particular, I don't quite understand the
last line, and the bash man page for parameter substitution didn't help
much.
This is the line:
exec /path/to/actual/tmux ${cfg+-f "$cfg"} "$@"
Specifically, what does the ${cfg+-f "$cfg"} part mean?
${cfg+-f "$cfg"}
I was looking for a good workaround for keeping my .tmux.conf file
consistent across systems (I have both OS X and Ubuntu and they have
different techniques for copy/paste support) when I came across this
comment that offered a solution:
https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/issues/8#issuecomment-4134987
But before I use the code snippet in the comment, I'd like to fully
understand what it's doing. In particular, I don't quite understand the
last line, and the bash man page for parameter substitution didn't help
much.
This is the line:
exec /path/to/actual/tmux ${cfg+-f "$cfg"} "$@"
Specifically, what does the ${cfg+-f "$cfg"} part mean?
Inspect WPF control implementation/template (KinectCircleButton)
Inspect WPF control implementation/template (KinectCircleButton)
I would like to view the complete standard template of a WPF control, in
particular the KinectCircleButton. Is it possible, and how can I do it?
I would like to view the complete standard template of a WPF control, in
particular the KinectCircleButton. Is it possible, and how can I do it?
Google Maps with D3.geo.path
Google Maps with D3.geo.path
I'm trying to follow the example in this videos:
https://www.youtube.com/watch?v=wqPGFs0cqxI
It's about drawing path with D3.js into Google Maps API. The console shows
me the error Uncaught TypeError: Object#<PolylineContext>" has no method
'setCurrent'.
The index.html
<head>
<title>powder</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100%; }
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false">
</script>
<script src="http://d3js.org/d3.v3.js" charset="utf-8"></script>
<script src="polyline_context.js"></script>
<script type="text/javascript">
var map;
var polyline;
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(53.567, 9.944),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
polyline = new google.maps.Polyline({
map: map
});
d3init();
}
var context;
var width;
var height;
var path;
var graticule;
var equator;
var projection;
function d3init() {
width = map.getDiv().offsetWidth;
height = map.getDiv().offsetHeight;
projection = d3.geo.equirectangular()
.translate([0, 0])
.scale(52.29578)
.precision(2)
context = new PolylineContext();
path = d3.geo.path().projection(projection).context(context);
equator = {type: 'LineString', coordinates: [[-180, 20], [-90, 0],
[0, -20], [90, 0], [180, 20]]};
render();
}
function render() {
polyline.setOptions({
strokeColor: 'red',
strokeWeight: 2
});
context.setCurrent(polyline.getPath());
path(equator);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas">
</div>
</body>
The Polyline_context.js
'use strict';
function PolylineContext () {
this.currentPath = null;
this.currentIndex = 0;
}
PolylineContext.prototype.beginPath = function() {};
PolylineContext.prototype.moveTo = function(x, y) {
if (this.currentPath) {
var latLng = new google.maps.LatLng(y, x);
this.currentPath.setAt(this.currentIndex, latLng);
this.currentIndex++;
}
};
PolylineContext.prototype.lineTo = function(x, y) {
if (this.currentPath) {
var latLng = new google.maps.LatLng(y, x);
this.currentPath.setAt(this.currentIndex, latLng);
this.currentIndex++;
}
};
PolylineContext.prototype.arc = function(x, y, radius, startAngle,
endAngle) {};
PolylineContext.prototype.closePath = function() {};
Any ideas of what's wrong in here?
I'm trying to follow the example in this videos:
https://www.youtube.com/watch?v=wqPGFs0cqxI
It's about drawing path with D3.js into Google Maps API. The console shows
me the error Uncaught TypeError: Object#<PolylineContext>" has no method
'setCurrent'.
The index.html
<head>
<title>powder</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100%; }
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false">
</script>
<script src="http://d3js.org/d3.v3.js" charset="utf-8"></script>
<script src="polyline_context.js"></script>
<script type="text/javascript">
var map;
var polyline;
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(53.567, 9.944),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
polyline = new google.maps.Polyline({
map: map
});
d3init();
}
var context;
var width;
var height;
var path;
var graticule;
var equator;
var projection;
function d3init() {
width = map.getDiv().offsetWidth;
height = map.getDiv().offsetHeight;
projection = d3.geo.equirectangular()
.translate([0, 0])
.scale(52.29578)
.precision(2)
context = new PolylineContext();
path = d3.geo.path().projection(projection).context(context);
equator = {type: 'LineString', coordinates: [[-180, 20], [-90, 0],
[0, -20], [90, 0], [180, 20]]};
render();
}
function render() {
polyline.setOptions({
strokeColor: 'red',
strokeWeight: 2
});
context.setCurrent(polyline.getPath());
path(equator);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas">
</div>
</body>
The Polyline_context.js
'use strict';
function PolylineContext () {
this.currentPath = null;
this.currentIndex = 0;
}
PolylineContext.prototype.beginPath = function() {};
PolylineContext.prototype.moveTo = function(x, y) {
if (this.currentPath) {
var latLng = new google.maps.LatLng(y, x);
this.currentPath.setAt(this.currentIndex, latLng);
this.currentIndex++;
}
};
PolylineContext.prototype.lineTo = function(x, y) {
if (this.currentPath) {
var latLng = new google.maps.LatLng(y, x);
this.currentPath.setAt(this.currentIndex, latLng);
this.currentIndex++;
}
};
PolylineContext.prototype.arc = function(x, y, radius, startAngle,
endAngle) {};
PolylineContext.prototype.closePath = function() {};
Any ideas of what's wrong in here?
Sunday, 15 September 2013
Java Line2D not drawing
Java Line2D not drawing
i am trying to draw lines according to a list. here is my code. i added an
"if" to see if line is draw
for(int m = 0; m < routecounter; m++){
if(route[m] != null){
if(route[m].routeType == 2){
if(route[m].xChange != 0){
System.out.println("xChange");
g.draw(new Line2D.Double(route[m].x1 - wellwide ,
routex[route[m].xChange ].y1, route[m].x1 - wellwide
+ routex[route[m].xChange].moveX,
routex[route[m].xChange].y2));
g.draw(new Line2D.Double(route[m].x1 + wellwide ,
routex[route[m].xChange ].y1, route[m].x1 + wellwide
+ routex[route[m].xChange].moveX,
routex[route[m].xChange].y2));
}
g.draw(new Line2D.Double(route[m].x1 - wellwide ,
route[m].y1, route[m].x1 - wellwide + route[m].moveX,
route[m].y2));
g.draw(new Line2D.Double(route[m].x1 + wellwide ,
route[m].y1, route[m].x1 + wellwide + route[m].moveX,
route[m].y2));
} else if(route[m].routeType == 1){
if(route[m].x1 == 475){
g.draw(new Line2D.Double((route[m].x1 - wellwide),
route[m].y1, (route[m].x1 - wellwide), route[m].y2));
g.draw(new Line2D.Double(route[m].x1 + wellwide,
route[m].y1, route[m].x1 + wellwide , route[m].y2));
System.out.println(m + " DIDNT DRAW " +
route[m].moveX + " X1: " + route[m].x1 + " X2: " +
route[m].x2 + " Y1: " + route[m].y1 + " Y2: " +
route[m].y2);
}else{
System.out.println("I AM : " + route[m].x1);
}
}
}
}
console output:
0 DIDNT DRAW 0.0 X1: 475.0 X2: 475.0 Y1: 301.42857142857144 Y2:
355.7142857142857
I AM : 509.7472422754954
I AM : 509.7472422754954
i couldnt understand why it is not drawing that line.
EDIT: here is my Route class
public class Route {
public Integer routeID;
public Integer routeType;
public Double x1;
public Double y1;
public Double x2;
public Double y2;
public Double moveX;
public Integer xChange = 0;
public Route(Integer routeID, Integer routeType, Double x1, Double y1,
Double x2, Double y2, Double moveX){
this.routeID = routeID;
this.routeType = routeType;
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.moveX = moveX;
}
}
and here how i am creating route array
Route[] route = new Route[200];
i am trying to draw lines according to a list. here is my code. i added an
"if" to see if line is draw
for(int m = 0; m < routecounter; m++){
if(route[m] != null){
if(route[m].routeType == 2){
if(route[m].xChange != 0){
System.out.println("xChange");
g.draw(new Line2D.Double(route[m].x1 - wellwide ,
routex[route[m].xChange ].y1, route[m].x1 - wellwide
+ routex[route[m].xChange].moveX,
routex[route[m].xChange].y2));
g.draw(new Line2D.Double(route[m].x1 + wellwide ,
routex[route[m].xChange ].y1, route[m].x1 + wellwide
+ routex[route[m].xChange].moveX,
routex[route[m].xChange].y2));
}
g.draw(new Line2D.Double(route[m].x1 - wellwide ,
route[m].y1, route[m].x1 - wellwide + route[m].moveX,
route[m].y2));
g.draw(new Line2D.Double(route[m].x1 + wellwide ,
route[m].y1, route[m].x1 + wellwide + route[m].moveX,
route[m].y2));
} else if(route[m].routeType == 1){
if(route[m].x1 == 475){
g.draw(new Line2D.Double((route[m].x1 - wellwide),
route[m].y1, (route[m].x1 - wellwide), route[m].y2));
g.draw(new Line2D.Double(route[m].x1 + wellwide,
route[m].y1, route[m].x1 + wellwide , route[m].y2));
System.out.println(m + " DIDNT DRAW " +
route[m].moveX + " X1: " + route[m].x1 + " X2: " +
route[m].x2 + " Y1: " + route[m].y1 + " Y2: " +
route[m].y2);
}else{
System.out.println("I AM : " + route[m].x1);
}
}
}
}
console output:
0 DIDNT DRAW 0.0 X1: 475.0 X2: 475.0 Y1: 301.42857142857144 Y2:
355.7142857142857
I AM : 509.7472422754954
I AM : 509.7472422754954
i couldnt understand why it is not drawing that line.
EDIT: here is my Route class
public class Route {
public Integer routeID;
public Integer routeType;
public Double x1;
public Double y1;
public Double x2;
public Double y2;
public Double moveX;
public Integer xChange = 0;
public Route(Integer routeID, Integer routeType, Double x1, Double y1,
Double x2, Double y2, Double moveX){
this.routeID = routeID;
this.routeType = routeType;
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.moveX = moveX;
}
}
and here how i am creating route array
Route[] route = new Route[200];
codeigniter bonfire php error after installing
codeigniter bonfire php error after installing
I'm trying to install codeigniter bonfire. After clicking the install
button on the create username screen, it takes a few moments and then it
loads this page. I watched some tutorials on how to install bonfire so I
know this isn't what I should be seeing.
Regardless, I updated the RewriteBase to /bonfire/ as it says..and now I'm
getting this error when I try to go to localhost/bonfire/index.php
Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting
identifier (T_STRING) in
/opt/lampp/htdocs/bonfire/bonfire/application/libraries/template.php on
line 305
I found this link on bonfire forums explaining the error. Bonfire forums link
It says to use PHP 5.4 and that's what I'm using. My operating system is
Linux Zorin and I'm using lampp, so I'm not sure if this could be a
permissions issue.
thx in advance and please let me know if you need more info.
I'm trying to install codeigniter bonfire. After clicking the install
button on the create username screen, it takes a few moments and then it
loads this page. I watched some tutorials on how to install bonfire so I
know this isn't what I should be seeing.
Regardless, I updated the RewriteBase to /bonfire/ as it says..and now I'm
getting this error when I try to go to localhost/bonfire/index.php
Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting
identifier (T_STRING) in
/opt/lampp/htdocs/bonfire/bonfire/application/libraries/template.php on
line 305
I found this link on bonfire forums explaining the error. Bonfire forums link
It says to use PHP 5.4 and that's what I'm using. My operating system is
Linux Zorin and I'm using lampp, so I'm not sure if this could be a
permissions issue.
thx in advance and please let me know if you need more info.
Unable to get this data structure to work (newbie)
Unable to get this data structure to work (newbie)
I'm pretty new to C, and I've been trying to make a program with this data
structure:
struct node {
char command[100];
char prereq[100][80];
char *targ;
int isUpdated;
} Node;
However, whenever I try to implement it in the code, like this:
Node n = malloc(sizeof(*n));
I get compiler errors such as "nmake.c:13:31: error: unknown type name
'Node'".
I've tried code such as:
typedef struct node *Node;
with similar results. What's wrong?
I'm pretty new to C, and I've been trying to make a program with this data
structure:
struct node {
char command[100];
char prereq[100][80];
char *targ;
int isUpdated;
} Node;
However, whenever I try to implement it in the code, like this:
Node n = malloc(sizeof(*n));
I get compiler errors such as "nmake.c:13:31: error: unknown type name
'Node'".
I've tried code such as:
typedef struct node *Node;
with similar results. What's wrong?
ASP.net MVC Login Page Theme/Customisation
ASP.net MVC Login Page Theme/Customisation
I am using ASP.net mvc to create a login page. However, I would like to
know if there are any ASP.net MVC login templates or themes I can
implement. I am going for a minimal theme. So something clean. I would
appreciate if you could direct me to any sites as I cannot find any help
on google.
Thanks
I am using ASP.net mvc to create a login page. However, I would like to
know if there are any ASP.net MVC login templates or themes I can
implement. I am going for a minimal theme. So something clean. I would
appreciate if you could direct me to any sites as I cannot find any help
on google.
Thanks
Custom my.cnf for a huge system with complex queries
Custom my.cnf for a huge system with complex queries
I am hosting a quite huge website, with millions of users visiting us weekly.
Currently we are using the file called "my-huge.cnf" as our configuration.
This is an example file from MySQL.
You can read more about the configuration files we use here:
http://dev.mysql.com/doc/refman/5.6/en/server-default-configuration-file.html
However, things are going a bit slow now, and we have upgraded our server,
and we got over 100 GB ram, multiple Xeon 8 cores cpu's. And we want to
customise the configuration. I am not asking for a ready configuration
file, I just want to know which values could I use with the specs, and
which of the options in the configuration should I change the value for?
Our tables are both of type InnoDB and MyISAM. We are considering
converting all to InnoDB.
Hope you understand my question here. Looking forward for an answer, so I
can learn more about this subject.
I am hosting a quite huge website, with millions of users visiting us weekly.
Currently we are using the file called "my-huge.cnf" as our configuration.
This is an example file from MySQL.
You can read more about the configuration files we use here:
http://dev.mysql.com/doc/refman/5.6/en/server-default-configuration-file.html
However, things are going a bit slow now, and we have upgraded our server,
and we got over 100 GB ram, multiple Xeon 8 cores cpu's. And we want to
customise the configuration. I am not asking for a ready configuration
file, I just want to know which values could I use with the specs, and
which of the options in the configuration should I change the value for?
Our tables are both of type InnoDB and MyISAM. We are considering
converting all to InnoDB.
Hope you understand my question here. Looking forward for an answer, so I
can learn more about this subject.
MySQL select data across 4 tables (multiple conditions)
MySQL select data across 4 tables (multiple conditions)
Thanks to another user I was finally able to collect some data using this
query:
SELECT r.form, s.value as email
FROM subrecords s join
records r
on s.record = r.id AND r.name = 'question-form'
WHERE s.title = 'email'
GROUP BY s.value, r.form
details on the tables involved in the above query are found at Finding
duplicates in MYSQL table where data is in multiple tables (multiple
conditions needed)
With the above query I get the list of emails that submitted a specific form.
I would need now to find out which of those email addresses is subscribed
to a specific mailing list, Using the "s.value" of the above query which
lists email addresses
I first need to find out the subscriber.subid which identifies each unique
subscriber and their email address, which is where I would join the result
from the query above
table -> subscriber schema
subid | email
Then select from the following table WHERE listid = '33'
table -> listsub schema
listid | subid | subdate | unsubdate | status
Thank you so much everyone for the incredible help!
Thanks to another user I was finally able to collect some data using this
query:
SELECT r.form, s.value as email
FROM subrecords s join
records r
on s.record = r.id AND r.name = 'question-form'
WHERE s.title = 'email'
GROUP BY s.value, r.form
details on the tables involved in the above query are found at Finding
duplicates in MYSQL table where data is in multiple tables (multiple
conditions needed)
With the above query I get the list of emails that submitted a specific form.
I would need now to find out which of those email addresses is subscribed
to a specific mailing list, Using the "s.value" of the above query which
lists email addresses
I first need to find out the subscriber.subid which identifies each unique
subscriber and their email address, which is where I would join the result
from the query above
table -> subscriber schema
subid | email
Then select from the following table WHERE listid = '33'
table -> listsub schema
listid | subid | subdate | unsubdate | status
Thank you so much everyone for the incredible help!
NodeJS/express: Cache and 304 status code
NodeJS/express: Cache and 304 status code
When I reload a website made with express, I get a blank page with Safari
(not with Chrome) because the NodeJS server sends me a 304 status code.
How to solve this?
Of course, this could also be just a problem of Safari, but actually it
works on all other websites fine, so it has to be a problem on my NodeJS
server, too.
To generate the pages, I'm using Jade with res.render.
When I reload a website made with express, I get a blank page with Safari
(not with Chrome) because the NodeJS server sends me a 304 status code.
How to solve this?
Of course, this could also be just a problem of Safari, but actually it
works on all other websites fine, so it has to be a problem on my NodeJS
server, too.
To generate the pages, I'm using Jade with res.render.
how can I reduce query execution time?
how can I reduce query execution time?
I have some insert, update, merge statements which are dealing with
billions of rows.
So if there is single update statement, it takes too much time to update
the table.
is there any technique in oracle to reduce this time
like in insert statement I just want to insert first 100 rows, afterwords
it should stop execution.
thanks in advance for your help..!
I have some insert, update, merge statements which are dealing with
billions of rows.
So if there is single update statement, it takes too much time to update
the table.
is there any technique in oracle to reduce this time
like in insert statement I just want to insert first 100 rows, afterwords
it should stop execution.
thanks in advance for your help..!
Saturday, 14 September 2013
Does kvo happen when a weak property is set to nil by ARC?
Does kvo happen when a weak property is set to nil by ARC?
I'm wondering if when a property that is set as weak gets cleared out via
arc when it is not strongly referable, does any KVO registered for the key
path pointing to that weak property fire? That would be a really handy
feature but I'm unaware if this happens currently. Anyone know if it does,
and if it doesn't by default can it be made to work?
I'm wondering if when a property that is set as weak gets cleared out via
arc when it is not strongly referable, does any KVO registered for the key
path pointing to that weak property fire? That would be a really handy
feature but I'm unaware if this happens currently. Anyone know if it does,
and if it doesn't by default can it be made to work?
How to display the concatenated value in localStorage to listbox
How to display the concatenated value in localStorage to listbox
I have a Object called (rowdata) and that object there is two concatenated
value separated by "\n", i want to display the two value in lisboxt. one
value one row, how to break the two concatenated value and display to
listbox.
code:
var myArray = [[rowdata]]; // assuming rowdata have two value separated by
\n in localstorage
function populate(){
for(i=0;i<myArray.length;i++){
var select = document.getElementById("test"); //ID of the listboxt
select.options[select.options.length] = new Option(myArray[i][0],
myArray[i][1]);
}
}
Is there a way to do that? thank you
I have a Object called (rowdata) and that object there is two concatenated
value separated by "\n", i want to display the two value in lisboxt. one
value one row, how to break the two concatenated value and display to
listbox.
code:
var myArray = [[rowdata]]; // assuming rowdata have two value separated by
\n in localstorage
function populate(){
for(i=0;i<myArray.length;i++){
var select = document.getElementById("test"); //ID of the listboxt
select.options[select.options.length] = new Option(myArray[i][0],
myArray[i][1]);
}
}
Is there a way to do that? thank you
Best way of building suite of internal mobile apps for Android and iOS
Best way of building suite of internal mobile apps for Android and iOS
My company has created a team to build internal business apps for iOS and
Android devices. The aim is to deliver a suite of applications to assist
with business tasks (expenses, leave, room booking that sort of thing) and
more specific workflow tools that hook into existing systems.
Most of the actual development work will be farmed out to contractors,
freelancers and app development companies. The team will manage the
lifecycle of the apps and the business requirements.
It seems to me that there are a couple of approaches here. I know this
might be subjective, but I feel there are at least a definite list of
options with definite positives and minuses which is why I ask the
question here.
My thoughts are:
Develop native apps for each platform using native tools. I suspect it
might be possible to build up a set of graphics and frameworks to simplify
development of apps as we go and standardise look and feel, but I've found
very few documented examples of this. I suspect this will result in a much
better user experience, but I'm worried this would be a prohibitive amount
of work. Are there any methods or strategies beyond what I've said that
could make this more possible?
Build web apps in HTML5 and Jquery These would, of course, be truly
multi-platform, but we wouldn't be able to take full advantages of all the
devices features and the user experience or performance probably wouldn't
be as good.
Use a system like Phonegap or Appcelerator This seems like a good idea,
but I believe the apps wouldn't perform as well as 1.) and I suspect we
might struggle more outsourcing development. It also ties us into one
system. Are there any particularly good or bad things about this sort of
approach?
Use some sort of MEAP or MAP system I'm thinking something like FeedHenry,
Antenna, Sybase. But I'm worried that this could tie us into one provider
and limit our options. It could also be expensive, so we might be better
spending the money on 1.)
My gut feel is that 1. is the best option, but probably the most expensive
and might not be possible.
My question really is: are there any other options I've missed, are my
assessments and theories correct and are there any other strategies we
could be using? Is there any agreed best practice in this area yet?
My company has created a team to build internal business apps for iOS and
Android devices. The aim is to deliver a suite of applications to assist
with business tasks (expenses, leave, room booking that sort of thing) and
more specific workflow tools that hook into existing systems.
Most of the actual development work will be farmed out to contractors,
freelancers and app development companies. The team will manage the
lifecycle of the apps and the business requirements.
It seems to me that there are a couple of approaches here. I know this
might be subjective, but I feel there are at least a definite list of
options with definite positives and minuses which is why I ask the
question here.
My thoughts are:
Develop native apps for each platform using native tools. I suspect it
might be possible to build up a set of graphics and frameworks to simplify
development of apps as we go and standardise look and feel, but I've found
very few documented examples of this. I suspect this will result in a much
better user experience, but I'm worried this would be a prohibitive amount
of work. Are there any methods or strategies beyond what I've said that
could make this more possible?
Build web apps in HTML5 and Jquery These would, of course, be truly
multi-platform, but we wouldn't be able to take full advantages of all the
devices features and the user experience or performance probably wouldn't
be as good.
Use a system like Phonegap or Appcelerator This seems like a good idea,
but I believe the apps wouldn't perform as well as 1.) and I suspect we
might struggle more outsourcing development. It also ties us into one
system. Are there any particularly good or bad things about this sort of
approach?
Use some sort of MEAP or MAP system I'm thinking something like FeedHenry,
Antenna, Sybase. But I'm worried that this could tie us into one provider
and limit our options. It could also be expensive, so we might be better
spending the money on 1.)
My gut feel is that 1. is the best option, but probably the most expensive
and might not be possible.
My question really is: are there any other options I've missed, are my
assessments and theories correct and are there any other strategies we
could be using? Is there any agreed best practice in this area yet?
Django: Model parameter in the URL template tag
Django: Model parameter in the URL template tag
I want to use the url template tag for my generic view.
I have been searching a lot about this and I didn't find what I want, but
it seems a simple issue.
I will use the example that the Django book, Making a View Generic, has used:
# urls.py
from django.conf.urls.defaults import *
from mysite import models, views
urlpatterns = patterns('',
(r'^events/$', views.object_list, {'model': models.Event}),
(r'^blog/entries/$', views.object_list, {'model': models.BlogEntry}),
)
# views.py
from django.shortcuts import render
def object_list(request, model):
obj_list = model.objects.all()
template_name = 'mysite/%s_list.html' % model.__name__.lower()
return render(request, template_name, {'object_list': obj_list})
So, I have one view for two URLs, my question is: How can I use the django
URL template tag for this two URLs?
I want to do something like this in the html template:
href={% url "mysite.views.object_list" model="Event" %}
href={% url "mysite.views.object_list" model="BlogEntry" %}
Thanks!
I want to use the url template tag for my generic view.
I have been searching a lot about this and I didn't find what I want, but
it seems a simple issue.
I will use the example that the Django book, Making a View Generic, has used:
# urls.py
from django.conf.urls.defaults import *
from mysite import models, views
urlpatterns = patterns('',
(r'^events/$', views.object_list, {'model': models.Event}),
(r'^blog/entries/$', views.object_list, {'model': models.BlogEntry}),
)
# views.py
from django.shortcuts import render
def object_list(request, model):
obj_list = model.objects.all()
template_name = 'mysite/%s_list.html' % model.__name__.lower()
return render(request, template_name, {'object_list': obj_list})
So, I have one view for two URLs, my question is: How can I use the django
URL template tag for this two URLs?
I want to do something like this in the html template:
href={% url "mysite.views.object_list" model="Event" %}
href={% url "mysite.views.object_list" model="BlogEntry" %}
Thanks!
Subscribe to:
Comments (Atom)