arrays does not null from beginning
I'm a beginner in C .... I have a little code:
#include <stdio.h>
#include <string.h>
int main(){
char str1[100];
char str2[100];
char str3[100];
char str4[100];
puts(str1)
puts(str2);
puts(str3);
puts(str4);
return 0;
}
I got result
2
èý(
'Q]wØ„ÃîþÿÿÿÀ"bwd&bw
I don't know why my array does not empty from the begin. And I have to set
first element to "\0" to clear content of array. Can anyone explain for
me. Thank a lot.
Saturday, 31 August 2013
How do I get a full page background in IE8?
How do I get a full page background in IE8?
How do I get a full page background in IE8? it works fine in firefox and
chrome. I specified the background of a 1000px div. But I am open to
specifying the background of the body or html. Thanks for your time.
Steven
<!doctype html>
<html>
<style>
html {
}
div.whole{width="1000px";margin:0 auto;border-style:solid;
border-width:0px;height:100%;padding:0px;
background: url(images/parchment.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
html, body {
margin: 0px;
padding: 0px;
border: 0px;
height:100%;
width:100%
}
div.image{position:relative; top:50px;left:900px;width:300px;
border-style:solid;border-width:0px;}
@font-face
{
font-family: myFirstFont;
src: url(pachs___.ttf);
}
div.text{position:relative;left:250px;top:-300px; font-family:myFirstFont;
font-size:250%;border-style:solid;border-width:1px;
width:600px;}
</style>
<body>
<div class="whole">
<div class="image">
<img src="images/tran.png" width="282px" height="381px" class="tran">
</div>
</div>
</body>
</html>
How do I get a full page background in IE8? it works fine in firefox and
chrome. I specified the background of a 1000px div. But I am open to
specifying the background of the body or html. Thanks for your time.
Steven
<!doctype html>
<html>
<style>
html {
}
div.whole{width="1000px";margin:0 auto;border-style:solid;
border-width:0px;height:100%;padding:0px;
background: url(images/parchment.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
html, body {
margin: 0px;
padding: 0px;
border: 0px;
height:100%;
width:100%
}
div.image{position:relative; top:50px;left:900px;width:300px;
border-style:solid;border-width:0px;}
@font-face
{
font-family: myFirstFont;
src: url(pachs___.ttf);
}
div.text{position:relative;left:250px;top:-300px; font-family:myFirstFont;
font-size:250%;border-style:solid;border-width:1px;
width:600px;}
</style>
<body>
<div class="whole">
<div class="image">
<img src="images/tran.png" width="282px" height="381px" class="tran">
</div>
</div>
</body>
</html>
This imacros code does not work
This imacros code does not work
Source code where program need to input data:
Code that iMacros uses to input data(that works):
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-submit ATTR=ID:last_name
CONTENT=english
Source code where program need to input data:
Code that iMacros uses to input data(doesn't work):
TAG POS=1 TYPE=INPUT:TYPE FORM=tel:frm-submit ATTR=PHONE:phoneNumber
CONTENT=3463475233
Source code where program need to input data:
Code that iMacros uses to input data(that works):
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-submit ATTR=ID:last_name
CONTENT=english
Source code where program need to input data:
Code that iMacros uses to input data(doesn't work):
TAG POS=1 TYPE=INPUT:TYPE FORM=tel:frm-submit ATTR=PHONE:phoneNumber
CONTENT=3463475233
VBScript equals problems
VBScript equals problems
I have been working on a vbs login and signup program I have a fully
functional working signup program but I am having troubles seeing if a
inputbox a.k.a the password is equal to the logged password from signup in
a file
uname = inputbox("Please type your Username.")
pword = inputbox("Please ebter your Password.")
Set objFileToRead =
CreateObject("Scripting.FileSystemObject").OpenTextFile(uname +
".txt",1)
strFileText = objFileToRead.ReadLine()
objFileToRead.Close
Set objFileToRead = Nothing
If strFileToRead = pword Then
document.write("Welcome!")
CreateObject("WScript.Shell").Run "forums.htm"
Else
msgbox("Incorrect Username or Password")
Wscript.Quit
End If
I have been working on a vbs login and signup program I have a fully
functional working signup program but I am having troubles seeing if a
inputbox a.k.a the password is equal to the logged password from signup in
a file
uname = inputbox("Please type your Username.")
pword = inputbox("Please ebter your Password.")
Set objFileToRead =
CreateObject("Scripting.FileSystemObject").OpenTextFile(uname +
".txt",1)
strFileText = objFileToRead.ReadLine()
objFileToRead.Close
Set objFileToRead = Nothing
If strFileToRead = pword Then
document.write("Welcome!")
CreateObject("WScript.Shell").Run "forums.htm"
Else
msgbox("Incorrect Username or Password")
Wscript.Quit
End If
Bean Creation Exception with JBoss 5.1.2
Bean Creation Exception with JBoss 5.1.2
I am facing problem while Deploying my app in JBoss 5.1.2 . I am getting
the below exception.
2013-08-31 22:16:07,968 ERROR
[org.springframework.web.context.ContextLoader] (HDScanner) Context
initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class
[com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer]
for bean with name 'applicationPropertyConfigurer' defined in
ServletContext resource [/WEB-INF/spring-config/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1250)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:885)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145)
at
org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
at
org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at
org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at
org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
at
org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at
org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
at
org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789)
at
org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
at
org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:409)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1271)
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1242)
... 73 more
Here is my bean creation code in applicationContext.xml file. Even if
create any bean apart from this i am getting the same Exception mention
above.
<bean id="applicationPropertyConfigurer"
class="com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
and web.xml contains below details.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-config/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
The Class for which i am getting exception is available in src folder and
it is in classpath of my application. Not sure what i am missing. here are
the jar file which i included for building the application in WEB-INF/lib.
spring-core, spring-beans, spring-context, spring-context.support,
spring-asm, spring-expression and i assume logging related jar not
required for the spring because in JBoss Server it will available.
But When i comment out the bean code creation in applicationContext.xml
application deployed successfully On the server. Please let me know what
exactly i am missing.
I am facing problem while Deploying my app in JBoss 5.1.2 . I am getting
the below exception.
2013-08-31 22:16:07,968 ERROR
[org.springframework.web.context.ContextLoader] (HDScanner) Context
initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class
[com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer]
for bean with name 'applicationPropertyConfigurer' defined in
ServletContext resource [/WEB-INF/spring-config/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1250)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:885)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145)
at
org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
at
org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at
org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at
org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
at
org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at
org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
at
org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789)
at
org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
at
org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:409)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1271)
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1242)
... 73 more
Here is my bean creation code in applicationContext.xml file. Even if
create any bean apart from this i am getting the same Exception mention
above.
<bean id="applicationPropertyConfigurer"
class="com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
and web.xml contains below details.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-config/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
The Class for which i am getting exception is available in src folder and
it is in classpath of my application. Not sure what i am missing. here are
the jar file which i included for building the application in WEB-INF/lib.
spring-core, spring-beans, spring-context, spring-context.support,
spring-asm, spring-expression and i assume logging related jar not
required for the spring because in JBoss Server it will available.
But When i comment out the bean code creation in applicationContext.xml
application deployed successfully On the server. Please let me know what
exactly i am missing.
FT_Read fails, UNLESS reading byte-by-byte where every FT_Read is followed by FT_Purge
FT_Read fails, UNLESS reading byte-by-byte where every FT_Read is followed
by FT_Purge
PROBLEM: Micro-controller is transmitting 10 bytes(ASCII
A,B,C,D,E,F,G,H,I,J) in for-loop under debugger control. Windows
application (C++/CLI Code abstracted below) is supposed to receive these
bytes.
Refer the two different FT_Read attempts in BOLD-text.
Case #1: Executing without debugger-stepping, both FT_Read attempts
receive first byte correctly as A but successive bytes received as junk.
Though FT_Read returns only when 10th byte is transmitted from
micro-controller. Post that dwhandled holds 0xa suggesting success in
reading 10 bytes
Case #2: Executing For-loop to execute second FT_Read followed by Purge,
under debugger stepping to receive byte-by-byte where micro-controller
also transmits byte-by-byte under respective debugger stepping. Array
RxMessage receives all 10 bytes correctly as A,B,C,D,E,F,G,H,I,J
private:
/// Required designer variable.
PVOID fth;
BOOL fSuccess, fthsuccess;
array<wchar_t> ^ TxMessage;
array<unsigned char> ^ RxMessage;
Form1(void) //Constructor
{
fthsuccess = false;
InitializeComponent();
TxMessage = gcnew array<wchar_t> (12);
RxMessage = gcnew array<unsigned char> (12);
}
/*PS. All the FT_xxxx calls below are tested for fsuccess before
proceeding ahead */
FT_Open(0, ppfthandle);
FT_SetBaudRate(*ppfthandle, 9600);
unsigned char LatencyTimer;
FT_SetLatencyTimer(*ppfthandle, 2);
FT_GetLatencyTimer(*ppfthandle, &LatencyTimer);
FT_SetDataCharacteristics(*ppfthandle, FT_BITS_8, FT_STOP_BITS_1,
FT_PARITY_NONE);
res = FT_SetTimeouts(*ppfthandle, 10000/*read*/, 1000/*write*/);
pin_ptr<FT_HANDLE> ppfthandle = &fth;
pin_ptr<unsigned char> ppRx = &RxMessage[0];
fSuccess = FT_Read(*ppfthandle,ppRx,10,&dwhandled);//reading 10 bytes
in one go
for(int i=0;i<10;i++)//reading byte-by-byte in debug steps
{
fSuccess = FT_Read(*ppfthandle,&ppRx[i],1,&dwhandled);
/*in absence of Purge below, alternate characters are read as 0xFF
ultimately workaround would be needed to avoid Purging of real
time RxData at runtime
*/
FT_Purge(*ppfthandle, FT_PURGE_RX | FT_PURGE_TX);
}
by FT_Purge
PROBLEM: Micro-controller is transmitting 10 bytes(ASCII
A,B,C,D,E,F,G,H,I,J) in for-loop under debugger control. Windows
application (C++/CLI Code abstracted below) is supposed to receive these
bytes.
Refer the two different FT_Read attempts in BOLD-text.
Case #1: Executing without debugger-stepping, both FT_Read attempts
receive first byte correctly as A but successive bytes received as junk.
Though FT_Read returns only when 10th byte is transmitted from
micro-controller. Post that dwhandled holds 0xa suggesting success in
reading 10 bytes
Case #2: Executing For-loop to execute second FT_Read followed by Purge,
under debugger stepping to receive byte-by-byte where micro-controller
also transmits byte-by-byte under respective debugger stepping. Array
RxMessage receives all 10 bytes correctly as A,B,C,D,E,F,G,H,I,J
private:
/// Required designer variable.
PVOID fth;
BOOL fSuccess, fthsuccess;
array<wchar_t> ^ TxMessage;
array<unsigned char> ^ RxMessage;
Form1(void) //Constructor
{
fthsuccess = false;
InitializeComponent();
TxMessage = gcnew array<wchar_t> (12);
RxMessage = gcnew array<unsigned char> (12);
}
/*PS. All the FT_xxxx calls below are tested for fsuccess before
proceeding ahead */
FT_Open(0, ppfthandle);
FT_SetBaudRate(*ppfthandle, 9600);
unsigned char LatencyTimer;
FT_SetLatencyTimer(*ppfthandle, 2);
FT_GetLatencyTimer(*ppfthandle, &LatencyTimer);
FT_SetDataCharacteristics(*ppfthandle, FT_BITS_8, FT_STOP_BITS_1,
FT_PARITY_NONE);
res = FT_SetTimeouts(*ppfthandle, 10000/*read*/, 1000/*write*/);
pin_ptr<FT_HANDLE> ppfthandle = &fth;
pin_ptr<unsigned char> ppRx = &RxMessage[0];
fSuccess = FT_Read(*ppfthandle,ppRx,10,&dwhandled);//reading 10 bytes
in one go
for(int i=0;i<10;i++)//reading byte-by-byte in debug steps
{
fSuccess = FT_Read(*ppfthandle,&ppRx[i],1,&dwhandled);
/*in absence of Purge below, alternate characters are read as 0xFF
ultimately workaround would be needed to avoid Purging of real
time RxData at runtime
*/
FT_Purge(*ppfthandle, FT_PURGE_RX | FT_PURGE_TX);
}
Friday, 30 August 2013
make menuconfig when build a kernel
make menuconfig when build a kernel
I am using OpenSUSE now, when I type uname -r it shows
3.7.10-1.16-desktop. However, when I try to build some other project, it
need the kernels/2.6.21-s915g5-i386 file.
I am not familiar with the kernel source/build. I downloaded linux-2.6.21,
read the README file and ran make menuconfig. Then I got confused, can I
just run make oldconfig
Or if I run make menuconfig, what should I select?
I am using OpenSUSE now, when I type uname -r it shows
3.7.10-1.16-desktop. However, when I try to build some other project, it
need the kernels/2.6.21-s915g5-i386 file.
I am not familiar with the kernel source/build. I downloaded linux-2.6.21,
read the README file and ran make menuconfig. Then I got confused, can I
just run make oldconfig
Or if I run make menuconfig, what should I select?
Thursday, 29 August 2013
Continue FOR loop after a function finished
Continue FOR loop after a function finished
I have a for loop from which a function is called.In that function i have
a AJAX call.After ajax finishes then it returns a value to the for loop.
then only for loop has to be continued.
for ( var j = 0; j < req.questionId.length; j++) {
var getanswer = getAnswers();
}
function getAnswers(){
$.getJSON("getAnswers?question_id="+questionId,function(data){
return "success";
});
}
I have a for loop from which a function is called.In that function i have
a AJAX call.After ajax finishes then it returns a value to the for loop.
then only for loop has to be continued.
for ( var j = 0; j < req.questionId.length; j++) {
var getanswer = getAnswers();
}
function getAnswers(){
$.getJSON("getAnswers?question_id="+questionId,function(data){
return "success";
});
}
Postgres: How to implement a flexible table
Postgres: How to implement a flexible table
I am a novice database user (not designer). I would like to implement the
following item in the postgres database.
I would like to implement a database which contain the following information
Table1
Classroom | Classroom Type | Student1 | Student2 | ... | Student36
1A | 'Square' | 'Anson' | 'Antonie'| ... | 'Zalda'
1B | 'Rectangle' | 'Allen' | 'Andy' | ... | 'Zeth'
There is another table to store the seating plan for each student, that's
why I created another table
Table2
Classroom Type | Student1 Position | Student2 Position | ... | Student36
Position
'Square' | (1,1) | (1,2) | ... | (6,6)
'Rectangle' | (1,1) | (1,2) | ... | (4,9)
The reason of this implementation is to draw a seating plan. However I
don't think this is a good implementation. Therefore I would like to find
another way which will give me some flexibility when I want to scale it
up.
Thanks in advance.
I am a novice database user (not designer). I would like to implement the
following item in the postgres database.
I would like to implement a database which contain the following information
Table1
Classroom | Classroom Type | Student1 | Student2 | ... | Student36
1A | 'Square' | 'Anson' | 'Antonie'| ... | 'Zalda'
1B | 'Rectangle' | 'Allen' | 'Andy' | ... | 'Zeth'
There is another table to store the seating plan for each student, that's
why I created another table
Table2
Classroom Type | Student1 Position | Student2 Position | ... | Student36
Position
'Square' | (1,1) | (1,2) | ... | (6,6)
'Rectangle' | (1,1) | (1,2) | ... | (4,9)
The reason of this implementation is to draw a seating plan. However I
don't think this is a good implementation. Therefore I would like to find
another way which will give me some flexibility when I want to scale it
up.
Thanks in advance.
Wednesday, 28 August 2013
MVC 4 Controller will not show view
MVC 4 Controller will not show view
I have a controller with a ActionResult I added after the initial build
Named SubAlertModal
[HttpPost]
public ActionResult SubAlertModal(int alertid)
{
var SubAlerts = from sa in db.csSubAlerts
where sa.AlertID == alertid
select sa;
// csAlert cssubalert = db.csAlerts.Find(alertid);
// return View();
return Request.IsAjaxRequest() ? PartialView(SubAlerts) :
PartialView(SubAlerts);
}
on the Index.cshtml page I add an HTML.ActionLink the looks like the folling
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink("Sub_Alert", "SubAlertModal", new { id =
item.AlertID }, new {
@class = "ModalOpener" })
</td>
<td>
@Html.DisplayFor(modelItem => item.Routes)
</td>
<td>
@Html.DisplayFor(modelItem => item.Issue)
</td>
<td>
@Html.DisplayFor(modelItem => item.Detour)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateEntered)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.SendEmail)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.AlertID }, new {
@class="ModalOpener" }) |
@Html.ActionLink("Details", "Details", new {id = item.AlertID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.AlertID})
</td>
</tr>
}
the one inquestion is the first . when i click on the Sub_Alert in the
list it gives me a 404 error. the url is correct. is the controller not
matching up with the view. this is the view i want to load in a modal
window or any window at this point @model IEnumerable
@{
ViewBag.Title = "SubAlerts";
}
<h2>SubAlert</h2>
<div id="SubAlertModal" title="Sub Alert for the Alert">
This is a test modal
and it appears to be working !!
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.Issue)
</th>
<th>
@Html.DisplayNameFor(model => model.Detour)
</th>
<th>
@Html.DisplayNameFor(model => model.DateEntered)
</th>
<th>
@Html.DisplayNameFor(model => model.EnteredBy)
</th>
<th>
@Html.DisplayNameFor(model => model.SendEmail)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Issue)
</td>
<td>
@Html.DisplayFor(modelItem => item.Detour)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateEntered)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.SendEmail)
</td>
</tr>
}
</table>
</div>
Thanks
Joe
I have a controller with a ActionResult I added after the initial build
Named SubAlertModal
[HttpPost]
public ActionResult SubAlertModal(int alertid)
{
var SubAlerts = from sa in db.csSubAlerts
where sa.AlertID == alertid
select sa;
// csAlert cssubalert = db.csAlerts.Find(alertid);
// return View();
return Request.IsAjaxRequest() ? PartialView(SubAlerts) :
PartialView(SubAlerts);
}
on the Index.cshtml page I add an HTML.ActionLink the looks like the folling
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink("Sub_Alert", "SubAlertModal", new { id =
item.AlertID }, new {
@class = "ModalOpener" })
</td>
<td>
@Html.DisplayFor(modelItem => item.Routes)
</td>
<td>
@Html.DisplayFor(modelItem => item.Issue)
</td>
<td>
@Html.DisplayFor(modelItem => item.Detour)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateEntered)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.SendEmail)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.AlertID }, new {
@class="ModalOpener" }) |
@Html.ActionLink("Details", "Details", new {id = item.AlertID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.AlertID})
</td>
</tr>
}
the one inquestion is the first . when i click on the Sub_Alert in the
list it gives me a 404 error. the url is correct. is the controller not
matching up with the view. this is the view i want to load in a modal
window or any window at this point @model IEnumerable
@{
ViewBag.Title = "SubAlerts";
}
<h2>SubAlert</h2>
<div id="SubAlertModal" title="Sub Alert for the Alert">
This is a test modal
and it appears to be working !!
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.Issue)
</th>
<th>
@Html.DisplayNameFor(model => model.Detour)
</th>
<th>
@Html.DisplayNameFor(model => model.DateEntered)
</th>
<th>
@Html.DisplayNameFor(model => model.EnteredBy)
</th>
<th>
@Html.DisplayNameFor(model => model.SendEmail)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Issue)
</td>
<td>
@Html.DisplayFor(modelItem => item.Detour)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateEntered)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.SendEmail)
</td>
</tr>
}
</table>
</div>
Thanks
Joe
Making website type a random number
Making website type a random number
Hello im new to html and php. Just programming in general. Anyways, im
pretty sure this should be a working code for making a random number
between 1 to 6:
<?php
echo (rand(1,6))
?>
Problem is when i put it inside my php document, and test it in browser it
doesnt show anything really.
Hello im new to html and php. Just programming in general. Anyways, im
pretty sure this should be a working code for making a random number
between 1 to 6:
<?php
echo (rand(1,6))
?>
Problem is when i put it inside my php document, and test it in browser it
doesnt show anything really.
AngularJS service does not work correctly
AngularJS service does not work correctly
I want to create dynamic page title in my webapp. I've created service
which should helps me, but it does not work. PageTitleService.getTitle()
always returns undefined. Is there someting wrong? What should be corected
to run this code? Here is the code:
app.js
var app = angular.module('app', ['restangular'])
.config(function ($routeProvider) {
$routeProvider.when('/index', {
templateUrl: 'views/main/index.html',
controller: 'PageController'
});
$routeProvider.when('/pages/:name', {
templateUrl: 'views/page/show.html',
controller: 'PageController'
});
$routeProvider.otherwise({
redirectTo: '/index'
});
});
app.defaultPageName = 'home';
app.name = 'Custom name';
PageTitleService.js:
app.factory('PageTitleService',
function() {
var title;
return {
setTitle : function(t) {
title = t;
},
getTitle : function() {
return title + ' - ' + app.name;
}
}
});
AppController.js
app.controller('AppController', ['$scope', 'PageTitleService',
function($scope, PageTitleService) {
$scope.pageTitle = PageTitleService.getTitle();
}]);
PageContorller.js
app.controller('PageController',
['$location', '$routeParams', '$scope', 'PageService', 'PageTitleService',
function($location, $routeParams, $scope, PageService,
PageTitleService) {
var pageName = $routeParams.name !== undefined ? $routeParams.name
: app.defaultPageName;
var page = PageService.getPage(pageName);
PageTitleService.setTitle(page.title); //page.title is always a
string
$scope.title = page.title;
$scope.content = page.content;
}
]);
index.html (begin):
<!DOCTYPE html>
<html lang="en" data-ng-app="app" data-ng-controller="AppController">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<meta name="description" content="">
<title>{{ pageTitle }}</title>
</head>
I want to create dynamic page title in my webapp. I've created service
which should helps me, but it does not work. PageTitleService.getTitle()
always returns undefined. Is there someting wrong? What should be corected
to run this code? Here is the code:
app.js
var app = angular.module('app', ['restangular'])
.config(function ($routeProvider) {
$routeProvider.when('/index', {
templateUrl: 'views/main/index.html',
controller: 'PageController'
});
$routeProvider.when('/pages/:name', {
templateUrl: 'views/page/show.html',
controller: 'PageController'
});
$routeProvider.otherwise({
redirectTo: '/index'
});
});
app.defaultPageName = 'home';
app.name = 'Custom name';
PageTitleService.js:
app.factory('PageTitleService',
function() {
var title;
return {
setTitle : function(t) {
title = t;
},
getTitle : function() {
return title + ' - ' + app.name;
}
}
});
AppController.js
app.controller('AppController', ['$scope', 'PageTitleService',
function($scope, PageTitleService) {
$scope.pageTitle = PageTitleService.getTitle();
}]);
PageContorller.js
app.controller('PageController',
['$location', '$routeParams', '$scope', 'PageService', 'PageTitleService',
function($location, $routeParams, $scope, PageService,
PageTitleService) {
var pageName = $routeParams.name !== undefined ? $routeParams.name
: app.defaultPageName;
var page = PageService.getPage(pageName);
PageTitleService.setTitle(page.title); //page.title is always a
string
$scope.title = page.title;
$scope.content = page.content;
}
]);
index.html (begin):
<!DOCTYPE html>
<html lang="en" data-ng-app="app" data-ng-controller="AppController">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<meta name="description" content="">
<title>{{ pageTitle }}</title>
</head>
DeviceToken as anonymous identifier IOS
DeviceToken as anonymous identifier IOS
can I use the deveciToken to register user in my server but not for push
notification service.It's possible fetch devToken without using push
notification delegate method? Thank's
can I use the deveciToken to register user in my server but not for push
notification service.It's possible fetch devToken without using push
notification delegate method? Thank's
serializing to JSON that would retain hebrew charcters
serializing to JSON that would retain hebrew charcters
I have the following use case:
from data I produce a json with data, part of it hebrew words. for example:
import json
j = {}
city =u'çéôä' #native unicode
j['results']= []
j['results'].append({'city':city}) #Also tried to city.encode('utf-8') and
other encodings
In order to produce a json file that doubles as my app db (a micro geoapp)
and as a file my users can edit and fix data directly I use the json lib
and:
to_save = json.dumps(j)
with open('test.json','wb') as f: #also tried with w instead of wb flag.
f.write(to_save)
f.close()
The problem is I get a unicode decoded json with u'çéôä' represented for
example as: u'\u05d7\u05d9\u05e4\u05d4'
most of the script and app don't have any problem reading the
Unicodestring but my USERS have one!, and since contributing to the
opensource project they need to edit the JSON directly, they can't figure
out the Hebrew text.
so, THE QUESTION: how should I write the json while opening it in another
editor would show Hebrew characters?
I'm not sure this is solvable because I suspect JSON is unicode all the
way and I can't use asccii in it, but not sure about that.
Thanks for the help
I have the following use case:
from data I produce a json with data, part of it hebrew words. for example:
import json
j = {}
city =u'çéôä' #native unicode
j['results']= []
j['results'].append({'city':city}) #Also tried to city.encode('utf-8') and
other encodings
In order to produce a json file that doubles as my app db (a micro geoapp)
and as a file my users can edit and fix data directly I use the json lib
and:
to_save = json.dumps(j)
with open('test.json','wb') as f: #also tried with w instead of wb flag.
f.write(to_save)
f.close()
The problem is I get a unicode decoded json with u'çéôä' represented for
example as: u'\u05d7\u05d9\u05e4\u05d4'
most of the script and app don't have any problem reading the
Unicodestring but my USERS have one!, and since contributing to the
opensource project they need to edit the JSON directly, they can't figure
out the Hebrew text.
so, THE QUESTION: how should I write the json while opening it in another
editor would show Hebrew characters?
I'm not sure this is solvable because I suspect JSON is unicode all the
way and I can't use asccii in it, but not sure about that.
Thanks for the help
Tuesday, 27 August 2013
How to properly use time zone in Rails
How to properly use time zone in Rails
The logic: I want to show placeholder exercises if no log entries for
today exists. If log entries for today exists, then don't show placeholder
exercises even if they exist.
.log-entries
- unless exercise.log_entries.for_user(workout.user).blank? ||
exercise.last_log_date(workout.user) ==
Time.zone.today.beginning_of_day
%p Nice job performing this #{timeago
exercise.last_log_date(workout.user)}. Try going up in
difficulty this time.
= exercise.last_log_date(workout.user).to_date
= exercise.last_log_entry(workout.user).created_at.to_date
%br
= Time.current.to_date
%br
- for log_entry in exercise.placeholder_log_entries!(workout.user)
= render 'log_entries/form', log_entry: log_entry, exercise:
exercise
- for log_entry in
exercise.log_entries.for_today.order("created_at
ASC").for_user(workout.user) do
= render 'log_entries/form', log_entry: log_entry, exercise:
exercise
- if exercise.log_entries.blank?
%p.hint.not-performed-yet You haven't performed this exercise yet.
= link_to exercise.render_add_text,
user_workout_exercise_log_entries_path(workout, workout.user,
exercise), class: "button radius", remote: true, method: :post
Whats driving me nuts... is that I recorded log entries for today, yet
placeholder exercises are still showing up. So that first unless is
passing.
Upon debugging I'll get values like this:
exercise last log date: 2013-08-26 00:00:00 -0700
today: 2013-08-27 00:00:00 -0700
But that exer last log date is actually recorded today, just right now!
Why is it a day behind?
#<LogEntry id: 226, reps: 8, weight: 55, effort: nil, description: nil,
loggable_id: 3, loggable_type: "Exercise", created_at: "2013-08-27
06:00:12", updated_at: "2013-08-28 03:06:56", user_id: 1, rest_after_set:
nil, difficulty: nil, distance: nil, duration: nil, measurement: nil,
placeholder: false>
Created at is 2013-08-27!!! Why is it rendering 26 in the view? I'm losing
my mind.
The logic: I want to show placeholder exercises if no log entries for
today exists. If log entries for today exists, then don't show placeholder
exercises even if they exist.
.log-entries
- unless exercise.log_entries.for_user(workout.user).blank? ||
exercise.last_log_date(workout.user) ==
Time.zone.today.beginning_of_day
%p Nice job performing this #{timeago
exercise.last_log_date(workout.user)}. Try going up in
difficulty this time.
= exercise.last_log_date(workout.user).to_date
= exercise.last_log_entry(workout.user).created_at.to_date
%br
= Time.current.to_date
%br
- for log_entry in exercise.placeholder_log_entries!(workout.user)
= render 'log_entries/form', log_entry: log_entry, exercise:
exercise
- for log_entry in
exercise.log_entries.for_today.order("created_at
ASC").for_user(workout.user) do
= render 'log_entries/form', log_entry: log_entry, exercise:
exercise
- if exercise.log_entries.blank?
%p.hint.not-performed-yet You haven't performed this exercise yet.
= link_to exercise.render_add_text,
user_workout_exercise_log_entries_path(workout, workout.user,
exercise), class: "button radius", remote: true, method: :post
Whats driving me nuts... is that I recorded log entries for today, yet
placeholder exercises are still showing up. So that first unless is
passing.
Upon debugging I'll get values like this:
exercise last log date: 2013-08-26 00:00:00 -0700
today: 2013-08-27 00:00:00 -0700
But that exer last log date is actually recorded today, just right now!
Why is it a day behind?
#<LogEntry id: 226, reps: 8, weight: 55, effort: nil, description: nil,
loggable_id: 3, loggable_type: "Exercise", created_at: "2013-08-27
06:00:12", updated_at: "2013-08-28 03:06:56", user_id: 1, rest_after_set:
nil, difficulty: nil, distance: nil, duration: nil, measurement: nil,
placeholder: false>
Created at is 2013-08-27!!! Why is it rendering 26 in the view? I'm losing
my mind.
Apache Load Balancing Algorithm Wrong Behaviour
Apache Load Balancing Algorithm Wrong Behaviour
Apache has 3 load balancing algorith: 1. Request Counting Algorithm 2.
Weighted Traffic Algorithm 3. Pending Request Counting Algorithm
Theoritically, pending request counting algorithm is better than the other
two because it will always try to choose web server with the least-active
connection.
I have 3 web servers and 1 load balancer. My question is, when I try
pending request counting algorithm, it didn't work as expected. It always
choose web server in round-robin basis (web server 1 -> web server 2 ->
web server 3 -> web server 1, and so on) Based on the theory, i expected
the result will be (web server 1 -> web server 1 -> web server 1, and so
on)
So, why is the pending request counting algorithm didn't work as expected?
NOTE: 1. No keep-alive connection. 2. To test the load balancer, i open a
simple page (less than 0,1s load time) and refresh it manually every 5 sec
to know which cluster it chose. 3. No changes made to configuration of
pending request counting algorithm.
Any help appreciated! Thanks before!
Apache has 3 load balancing algorith: 1. Request Counting Algorithm 2.
Weighted Traffic Algorithm 3. Pending Request Counting Algorithm
Theoritically, pending request counting algorithm is better than the other
two because it will always try to choose web server with the least-active
connection.
I have 3 web servers and 1 load balancer. My question is, when I try
pending request counting algorithm, it didn't work as expected. It always
choose web server in round-robin basis (web server 1 -> web server 2 ->
web server 3 -> web server 1, and so on) Based on the theory, i expected
the result will be (web server 1 -> web server 1 -> web server 1, and so
on)
So, why is the pending request counting algorithm didn't work as expected?
NOTE: 1. No keep-alive connection. 2. To test the load balancer, i open a
simple page (less than 0,1s load time) and refresh it manually every 5 sec
to know which cluster it chose. 3. No changes made to configuration of
pending request counting algorithm.
Any help appreciated! Thanks before!
handlebars conditional block
handlebars conditional block
Apologies for such a novice question. I'm very new to handlebars and not
sure what approach to take here.
I have this JSON:
{
"fieldName": "amount",
"locked": false,
"visible": true,
"visibilityCheckBox": "UNCHECKED",
"values": [],
"domain": null
},
{
"fieldName": "awardType",
"locked": false,
"visible": true,
"visibilityCheckBox": "UNCHECKED",
"values": [],
"domain": null
},
{
"fieldName": "currencyCode",
"locked": false,
"visible": true,
"visibilityCheckBox": "UNCHECKED",
"values": [],
"domain": null
}
I want to populate following HTML from JSON using handlebars:
<input id="timeUnspecified" type="radio" name="awardType" value="from JSON"/>
How can I compare name with key in JSON using handlebars?
Apologies for such a novice question. I'm very new to handlebars and not
sure what approach to take here.
I have this JSON:
{
"fieldName": "amount",
"locked": false,
"visible": true,
"visibilityCheckBox": "UNCHECKED",
"values": [],
"domain": null
},
{
"fieldName": "awardType",
"locked": false,
"visible": true,
"visibilityCheckBox": "UNCHECKED",
"values": [],
"domain": null
},
{
"fieldName": "currencyCode",
"locked": false,
"visible": true,
"visibilityCheckBox": "UNCHECKED",
"values": [],
"domain": null
}
I want to populate following HTML from JSON using handlebars:
<input id="timeUnspecified" type="radio" name="awardType" value="from JSON"/>
How can I compare name with key in JSON using handlebars?
Finding the java dependencies
Finding the java dependencies
I've a java stand alone application in which it has a lot of dependencies.
I've the source code but it is not followed with the code fabrics. It
calls various native libraries. Is there are any way to determine the
native dependencies or native calls using spring aop or any other tools.
I've a java stand alone application in which it has a lot of dependencies.
I've the source code but it is not followed with the code fabrics. It
calls various native libraries. Is there are any way to determine the
native dependencies or native calls using spring aop or any other tools.
Monday, 26 August 2013
How do I force Chrome Postman to return application/xml instead of application/octect-stream
How do I force Chrome Postman to return application/xml instead of
application/octect-stream
pI am using google chrome plugin Postman for testing some restful web
services. Some of my webservices have a produces annotation that has
several types defined. Each time I run one of my services though, it seems
postman's results are determined to always return in octect-stream form.
Is there a way to force postman (or potentially my service) to return
application/xml results? I would prefer not to change the annotation but
will if thats my only choice./p pMy service definition - /p precode@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
application/x-javascript, MediaType.APPLICATION_OCTET_STREAM } ) @Path(
/getCustomers/ ) public Response getCustomers /code/pre pMy postman call
is just a GET call with no parameters on the header like this:/p
precodehttp://myserver:8080/test/getCustomers /code/pre
application/octect-stream
pI am using google chrome plugin Postman for testing some restful web
services. Some of my webservices have a produces annotation that has
several types defined. Each time I run one of my services though, it seems
postman's results are determined to always return in octect-stream form.
Is there a way to force postman (or potentially my service) to return
application/xml results? I would prefer not to change the annotation but
will if thats my only choice./p pMy service definition - /p precode@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
application/x-javascript, MediaType.APPLICATION_OCTET_STREAM } ) @Path(
/getCustomers/ ) public Response getCustomers /code/pre pMy postman call
is just a GET call with no parameters on the header like this:/p
precodehttp://myserver:8080/test/getCustomers /code/pre
Bad encoding in HttpEntity
Bad encoding in HttpEntity
pI have read topics about it but can't get the response entity have a
utf-8 encoding. this is the code I use:/p
precoderequest.setHeader(User-Agent, USER_AGENT);
request.setHeader(Accept,
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8);
request.setHeader(Accept-Charset, UTF-8); /code/pre pand then:/p
precodeBufferedReader rd = new BufferedReader(new
InputStreamReader(response .getEntity().getContent())); /code/pre pgives
unrecognized characters. BTW, the website I use displays the characters
correctly, so the problem is not in the server Thanks in advance/p pEDIT:
found an answer: a
href=http://stackoverflow.com/a/18434549/2719361http://stackoverflow.com/a/18434549/2719361/a
the problem was in my eclipse configurations./p
pI have read topics about it but can't get the response entity have a
utf-8 encoding. this is the code I use:/p
precoderequest.setHeader(User-Agent, USER_AGENT);
request.setHeader(Accept,
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8);
request.setHeader(Accept-Charset, UTF-8); /code/pre pand then:/p
precodeBufferedReader rd = new BufferedReader(new
InputStreamReader(response .getEntity().getContent())); /code/pre pgives
unrecognized characters. BTW, the website I use displays the characters
correctly, so the problem is not in the server Thanks in advance/p pEDIT:
found an answer: a
href=http://stackoverflow.com/a/18434549/2719361http://stackoverflow.com/a/18434549/2719361/a
the problem was in my eclipse configurations./p
how do I change app icons/ launch images etc on target build
how do I change app icons/ launch images etc on target build
I want to have two build targets for release one for app1 and one for app2
both apps are the same apart from specific customer logo / launch screen
etc
I know how to make sure my server side can distinguish between the two
apps, (I send a code tag with the app name) but how do I make xcode build
two different apps with different logo, launch screen etc
thanks
I want to have two build targets for release one for app1 and one for app2
both apps are the same apart from specific customer logo / launch screen
etc
I know how to make sure my server side can distinguish between the two
apps, (I send a code tag with the app name) but how do I make xcode build
two different apps with different logo, launch screen etc
thanks
How to emit a signal when its member emits one?
How to emit a signal when its member emits one?
For example, I have a class Document which has a private member QUndoStack
which has a signal cleanChanged(). When the member emits the signal, I
wish the containing class Document emits a signal with the same name or
the signal from the member can be transferred to the containing class.
Thus the outside know cleanChanged happened.
For example, I have a class Document which has a private member QUndoStack
which has a signal cleanChanged(). When the member emits the signal, I
wish the containing class Document emits a signal with the same name or
the signal from the member can be transferred to the containing class.
Thus the outside know cleanChanged happened.
How to make Laravel's Validator $rules optional
How to make Laravel's Validator $rules optional
Let's say I have User model with two methods:
User.php
class User extends Eloquent
{
/* Validation rules */
private static $rules = array(
'user' => 'unique:users|required|alpha_num',
'email' => 'required|email'
);
/* Validate against registration form */
public static function register($data)
{
$validator = Validator::make($data, static::$rules);
if($validator->fails())
{
/*... do someting */
}
else
{
/* .. do something else */
}
}
/* Validate against update form */
public static function update($data)
{
$validator = Validator::make($data, static::$rules);
if($validator->fails())
{
/*... do someting */
}
else
{
/* .. do something else */
}
}
}
My question: How can I make validation rules optional, so even if data for
update() would be just email field, it would ignore user and still
validate to true.
Is this even possible or am I missing something?
Sorry for my bad english.
Thanks
Let's say I have User model with two methods:
User.php
class User extends Eloquent
{
/* Validation rules */
private static $rules = array(
'user' => 'unique:users|required|alpha_num',
'email' => 'required|email'
);
/* Validate against registration form */
public static function register($data)
{
$validator = Validator::make($data, static::$rules);
if($validator->fails())
{
/*... do someting */
}
else
{
/* .. do something else */
}
}
/* Validate against update form */
public static function update($data)
{
$validator = Validator::make($data, static::$rules);
if($validator->fails())
{
/*... do someting */
}
else
{
/* .. do something else */
}
}
}
My question: How can I make validation rules optional, so even if data for
update() would be just email field, it would ignore user and still
validate to true.
Is this even possible or am I missing something?
Sorry for my bad english.
Thanks
How to ask questions on StackOverflow?
How to ask questions on StackOverflow?
I have some problem about programming, how can I ask question on
stackoverflow so others can answer? For instance of I have problem with
websockets in JavaScript how can I ask about it?
I have some problem about programming, how can I ask question on
stackoverflow so others can answer? For instance of I have problem with
websockets in JavaScript how can I ask about it?
How to find a string in a text file, Python
How to find a string in a text file, Python
How do I get the number of times a certain 2 characters are used in a text
files, (e.g. ('hi')) And how do I print the sum out as an int?
I tried doing this:
for line in open('test.txt'):
ly = line.split()
for i in ly:
a = i.count('ly')
print(sum(a))
But it failed, thanks in advance!
How do I get the number of times a certain 2 characters are used in a text
files, (e.g. ('hi')) And how do I print the sum out as an int?
I tried doing this:
for line in open('test.txt'):
ly = line.split()
for i in ly:
a = i.count('ly')
print(sum(a))
But it failed, thanks in advance!
Sunday, 25 August 2013
Ultrafilter on Stone-Èech compatification of natural number
Ultrafilter on Stone-Èech compatification of natural number
I have two questions about ultrafilter on Stone-Èech compatification of
natural number .
I would like to know:
(a) Why The set $ \omega$ corresponds to the set of principal
ultrafilters? And the set $\beta\omega - \omega$ to the set of free
ultrafilters?
(b) How are the elements $\beta\omega - \omega$ of ? Are they isolated
points? Why?
I have two questions about ultrafilter on Stone-Èech compatification of
natural number .
I would like to know:
(a) Why The set $ \omega$ corresponds to the set of principal
ultrafilters? And the set $\beta\omega - \omega$ to the set of free
ultrafilters?
(b) How are the elements $\beta\omega - \omega$ of ? Are they isolated
points? Why?
An issue running fmincon in matlab
An issue running fmincon in matlab
So I an optimizing a function of mine using the following code:
function [fval, z, Z, x] = fCarterFunction
%Searches parameter space for the best values given the model and LSE
A = [];
b = [];
Aeq = [];
beq =[];
options = optimset('Display','iter', 'Algorithm', 'interior-point');
options.MaxFunEvals = 100000;
options.MaxIter = 100000;
[pOPT, fval] = fmincon(@(p)fRSS(p),[.01 .01 .01],A, b, Aeq, beq, 0, 1, [],
options);
z = pOPT(1);
Z = pOPT(2);
x = pOPT(3);
end
This issue is that when I run this on my function it returns the following:
Warning: Length of lower bounds is < length(x); filling in missing lower
bounds with - Inf.
> In checkbounds at 34
In fmincon at 332
In fCarterFunction at 12
In RunRSSfunc at 1
In run at 64
Warning: Length of upper bounds is < length(x); filling in missing upper
bounds with +Inf.
> In checkbounds at 48
In fmincon at 332
In fCarterFunction at 12
In RunRSSfunc at 1
In run at 64
What I don't understand is that I ran this for a previous dataset and I
had no problems. Now, matlab is replacing my upper and lower bounds. Does
anyone know how to fix this? If you need to see the other function that
actually iterates through the data and then compares the simulation to the
actual via the least squares technique please let me know. Thanks!
So I an optimizing a function of mine using the following code:
function [fval, z, Z, x] = fCarterFunction
%Searches parameter space for the best values given the model and LSE
A = [];
b = [];
Aeq = [];
beq =[];
options = optimset('Display','iter', 'Algorithm', 'interior-point');
options.MaxFunEvals = 100000;
options.MaxIter = 100000;
[pOPT, fval] = fmincon(@(p)fRSS(p),[.01 .01 .01],A, b, Aeq, beq, 0, 1, [],
options);
z = pOPT(1);
Z = pOPT(2);
x = pOPT(3);
end
This issue is that when I run this on my function it returns the following:
Warning: Length of lower bounds is < length(x); filling in missing lower
bounds with - Inf.
> In checkbounds at 34
In fmincon at 332
In fCarterFunction at 12
In RunRSSfunc at 1
In run at 64
Warning: Length of upper bounds is < length(x); filling in missing upper
bounds with +Inf.
> In checkbounds at 48
In fmincon at 332
In fCarterFunction at 12
In RunRSSfunc at 1
In run at 64
What I don't understand is that I ran this for a previous dataset and I
had no problems. Now, matlab is replacing my upper and lower bounds. Does
anyone know how to fix this? If you need to see the other function that
actually iterates through the data and then compares the simulation to the
actual via the least squares technique please let me know. Thanks!
How to write a Google Content Experiment that disables a stylesheet?
How to write a Google Content Experiment that disables a stylesheet?
I am currently trying to setup a Client Side Experiment without Redirects
as opposed to the default Content Experiment A/B testing. All I want to do
is for half my visitors disable one of two existing stylesheets on a page.
To me it doesn't make sense to do this the the default A/B way because
then I would have to setup a second page with the stylesheet disabled for
every page on my site.
There is also Running a Server-side Experiment but to me that is too heavy
handed for something I think should be somewhat simple.
I have the js all setup, I just need to be able to tell the page that when
there is a given variation disable the stylesheet of don't render the
stylesheet before the DOM loads.
One thing I considered is, given a certain variation, redirect to the same
page but append a url query parameter like &stylesheet_disabled=true but
when I briefly looked at that I ran into a redirect loop but perhaps
someone has a better way to write the js.
Any help greatly appreciated.
I am currently trying to setup a Client Side Experiment without Redirects
as opposed to the default Content Experiment A/B testing. All I want to do
is for half my visitors disable one of two existing stylesheets on a page.
To me it doesn't make sense to do this the the default A/B way because
then I would have to setup a second page with the stylesheet disabled for
every page on my site.
There is also Running a Server-side Experiment but to me that is too heavy
handed for something I think should be somewhat simple.
I have the js all setup, I just need to be able to tell the page that when
there is a given variation disable the stylesheet of don't render the
stylesheet before the DOM loads.
One thing I considered is, given a certain variation, redirect to the same
page but append a url query parameter like &stylesheet_disabled=true but
when I briefly looked at that I ran into a redirect loop but perhaps
someone has a better way to write the js.
Any help greatly appreciated.
Couldn't resolve host 'www.youtube.com
Couldn't resolve host 'www.youtube.com
$curl =
curl_init("http://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=Bgn7n3OPAqE&format=json");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$ret = json_decode(curl_exec($curl),true);
print_r($ret);
$err = curl_errno( $curl );
$errmsg = curl_error( $curl);
echo $err; echo $errmsg;
curl_close($curl);
hey i am trying to get the content in youtube api,but i says could noty
resolve,but when i try via terminal it returns me the array
$curl =
curl_init("http://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=Bgn7n3OPAqE&format=json");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$ret = json_decode(curl_exec($curl),true);
print_r($ret);
$err = curl_errno( $curl );
$errmsg = curl_error( $curl);
echo $err; echo $errmsg;
curl_close($curl);
hey i am trying to get the content in youtube api,but i says could noty
resolve,but when i try via terminal it returns me the array
How to prove the inequality?
How to prove the inequality?
Given that a,b,c are the sides of a triangle, prove the inequality
$\sqrt{{a}^{2}-{(b-c)}^{2}}+\sqrt{{b}^{2}-{(c-a)}^{2}}+\sqrt{{c}^{2}-{(a-b)}^{2}}\leq
\sqrt{ab}+\sqrt{bc}+\sqrt{ca}\leq a+b+c$
I don't know where to start.
Given that a,b,c are the sides of a triangle, prove the inequality
$\sqrt{{a}^{2}-{(b-c)}^{2}}+\sqrt{{b}^{2}-{(c-a)}^{2}}+\sqrt{{c}^{2}-{(a-b)}^{2}}\leq
\sqrt{ab}+\sqrt{bc}+\sqrt{ca}\leq a+b+c$
I don't know where to start.
Saturday, 24 August 2013
How to link taxonomy terms to custom views
How to link taxonomy terms to custom views
I have a vocabulary "destination' with 4 terms (dest1, dest2, dest3,
dest4) Then I have another vocabulary "category" with tons of terms
(parents and childs)
I need to create a custom view (not from core) that will display the
"destination" and also the "category" my content types are associated with
(something like: /dest1/category/child/child, /dest3/category/child).
my setup in short: - I have a view of type "Term", displaying as a block
with one field set as Taxonomy: Term ID set to "Exclude from display" and
another one set as Taxonomy: Term name (linked to its taxonomy term page)
- I have a second view of type "Node" (this is the default drupal taxonomy
term view) with a page display and a Taxonomy: Term ID argument
The setup works (for "category" anyway) until I try adding a destination
to appear in front!! From what I understand I would need to create 3 other
pages with a modify the paths but as soon as I try to change the path
/taxonomy/term/% it defaults back to core display.
any help would be greatly appreciated (hope I gave enough information...
not easy to describe a problem when confused)
Thanks
I have a vocabulary "destination' with 4 terms (dest1, dest2, dest3,
dest4) Then I have another vocabulary "category" with tons of terms
(parents and childs)
I need to create a custom view (not from core) that will display the
"destination" and also the "category" my content types are associated with
(something like: /dest1/category/child/child, /dest3/category/child).
my setup in short: - I have a view of type "Term", displaying as a block
with one field set as Taxonomy: Term ID set to "Exclude from display" and
another one set as Taxonomy: Term name (linked to its taxonomy term page)
- I have a second view of type "Node" (this is the default drupal taxonomy
term view) with a page display and a Taxonomy: Term ID argument
The setup works (for "category" anyway) until I try adding a destination
to appear in front!! From what I understand I would need to create 3 other
pages with a modify the paths but as soon as I try to change the path
/taxonomy/term/% it defaults back to core display.
any help would be greatly appreciated (hope I gave enough information...
not easy to describe a problem when confused)
Thanks
java.lang.UnsatisfiedLinkError: com.sun.deploy.config.WinPlatform.getPlatformUserHome()Ljava/lang/String
java.lang.UnsatisfiedLinkError:
com.sun.deploy.config.WinPlatform.getPlatformUserHome()Ljava/lang/String
I developed a javafx(2.2) application that link to a certain site. The app
is running fine in netbeans 7.3 but when I deploy it the following error
will occur.
java.lang.UnsatisfiedLinkError:
com.sun.deploy.config.WinPlatform.getPlatformUserHome()Ljava/lang/String;
at com.sun.deploy.config.WinPlatform.getPlatformUserHome(Native Method) at
com.sun.deploy.config.WinPlatform.getUserHome(Unknown Source) at
com.sun.deploy.config.WinPlatform.getLocalStorageDir(Unknown Source) at
com.sun.deploy.config.Config.getLocalStorageDir(Unknown Source) at
com.sun.deploy.config.Config.getDefaultCacheDirectory(Unknown Source) at
com.sun.deploy.config.DefaultConfig.init(Unknown Source) at
com.sun.deploy.config.DefaultConfig.(Unknown Source) at
com.sun.deploy.config.DefaultConfig.getDefaultConfig(Unknown Source) at
com.sun.deploy.config.Config.get(Unknown Source) at
com.sun.deploy.net.proxy.UserDefinedProxyConfig.getBrowserProxyInfo(Unknown
Source) at com.sun.deploy.net.proxy.DynamicProxyManager.reset(Unknown
Source) at com.sun.deploy.net.proxy.DeployProxySelector.reset(Unknown
Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
com.javafx.main.Main.tryToSetProxy(Main.java:572) at
com.javafx.main.Main.launchApp(Main.java:640) at
com.javafx.main.Main.main(Main.java:805)
I really don't what is the cause of the problem. Is it my proxy or
platform I used. I am using java 1.7 32bit Hope someone will help me.
Thanks.
com.sun.deploy.config.WinPlatform.getPlatformUserHome()Ljava/lang/String
I developed a javafx(2.2) application that link to a certain site. The app
is running fine in netbeans 7.3 but when I deploy it the following error
will occur.
java.lang.UnsatisfiedLinkError:
com.sun.deploy.config.WinPlatform.getPlatformUserHome()Ljava/lang/String;
at com.sun.deploy.config.WinPlatform.getPlatformUserHome(Native Method) at
com.sun.deploy.config.WinPlatform.getUserHome(Unknown Source) at
com.sun.deploy.config.WinPlatform.getLocalStorageDir(Unknown Source) at
com.sun.deploy.config.Config.getLocalStorageDir(Unknown Source) at
com.sun.deploy.config.Config.getDefaultCacheDirectory(Unknown Source) at
com.sun.deploy.config.DefaultConfig.init(Unknown Source) at
com.sun.deploy.config.DefaultConfig.(Unknown Source) at
com.sun.deploy.config.DefaultConfig.getDefaultConfig(Unknown Source) at
com.sun.deploy.config.Config.get(Unknown Source) at
com.sun.deploy.net.proxy.UserDefinedProxyConfig.getBrowserProxyInfo(Unknown
Source) at com.sun.deploy.net.proxy.DynamicProxyManager.reset(Unknown
Source) at com.sun.deploy.net.proxy.DeployProxySelector.reset(Unknown
Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
com.javafx.main.Main.tryToSetProxy(Main.java:572) at
com.javafx.main.Main.launchApp(Main.java:640) at
com.javafx.main.Main.main(Main.java:805)
I really don't what is the cause of the problem. Is it my proxy or
platform I used. I am using java 1.7 32bit Hope someone will help me.
Thanks.
Running simple website through Jar file
Running simple website through Jar file
I am trying to run simple static website through Jar file but not having
too much luck. The reason I want to run the website through Jar because I
don't want end users to access my pages directly. Fox example, they should
not have access to index.html page directly without actually starting my
program which is built using java swing.
Things I tried: - Jar application works if I am running on the same
machine where I created Jar using Eclipse because index.html page is
fetching the page from local directory. which i know is wrong. - If I try
using different laptop or desktop then my swing application does not open
any kind of index.html through my browser.
So any suggestions....???
Also, I was using Desktop.open(), Desktop.browse,
getClass().getResources().getURL()..... stuff that I seen on other pages.
Thanks in advance....
I am trying to run simple static website through Jar file but not having
too much luck. The reason I want to run the website through Jar because I
don't want end users to access my pages directly. Fox example, they should
not have access to index.html page directly without actually starting my
program which is built using java swing.
Things I tried: - Jar application works if I am running on the same
machine where I created Jar using Eclipse because index.html page is
fetching the page from local directory. which i know is wrong. - If I try
using different laptop or desktop then my swing application does not open
any kind of index.html through my browser.
So any suggestions....???
Also, I was using Desktop.open(), Desktop.browse,
getClass().getResources().getURL()..... stuff that I seen on other pages.
Thanks in advance....
How to use the Significant-Change Location Service
How to use the Significant-Change Location Service
I was wondering if it was possible to make an app so when, using
CoreLocation, the user taps a button, the app starts monitoring for
location-based movement, and when the iPhone moves a certain distance, a
booleans value is changed. The service should also be able to be able to
be disabled by the press of a different button. It would be really helpful
if it was possible
I was wondering if it was possible to make an app so when, using
CoreLocation, the user taps a button, the app starts monitoring for
location-based movement, and when the iPhone moves a certain distance, a
booleans value is changed. The service should also be able to be able to
be disabled by the press of a different button. It would be really helpful
if it was possible
Draw.io diagram copy creates a blank diagram [on hold]
Draw.io diagram copy creates a blank diagram [on hold]
I have been using draw.io for several months without problems. Today I'm
starting to face a problem copying or Saving As diagrams. The new file
comes up empty. I've tried closing and opening Chrome again, but the
problem remains. Is anyone else facing the same problem? Is there a
workaround?
I have been using draw.io for several months without problems. Today I'm
starting to face a problem copying or Saving As diagrams. The new file
comes up empty. I've tried closing and opening Chrome again, but the
problem remains. Is anyone else facing the same problem? Is there a
workaround?
Imageloader not loading image on real device
Imageloader not loading image on real device
Hi
I am using ImageLoader class to load image from url and displaing in list
view. But This ImagLoader loading image on emulator but when i run my app
on real device its not loading any image..(Just showing the default
image).
Please help me to know what should i do with ImageLoader class to work on
real device.
ImageLoaader Class:-
public class ImageLoader {
MemoryCache memoryCache = new MemoryCache();
FileCache fileCache;
private Map<ImageView, String> imageViews = Collections
.synchronizedMap(new WeakHashMap<ImageView, String>());
ExecutorService executorService;
// Handler to display images in UI thread
Handler handler = new Handler();
public ImageLoader(Context context) {
fileCache = new FileCache(context);
executorService = Executors.newFixedThreadPool(5);
}
final int stub_id = R.drawable.products;
public void DisplayImage(String url, ImageView imageView) {
imageViews.put(imageView, url);
Bitmap bitmap = memoryCache.get(url);
if (bitmap != null)
imageView.setImageBitmap(bitmap);
else {
queuePhoto(url, imageView);
imageView.setImageResource(stub_id);
}
}
private void queuePhoto(String url, ImageView imageView) {
PhotoToLoad p = new PhotoToLoad(url, imageView);
executorService.submit(new PhotosLoader(p));
}
private Bitmap getBitmap(String url) {
File f = fileCache.getFile(url);
Bitmap b = decodeFile(f);
if (b != null)
return b;
// Download Images from the Internet
try {
Bitmap bitmap = null;
URL imageUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) imageUrl
.openConnection();
conn.setConnectTimeout(30000);
conn.setReadTimeout(30000);
conn.setInstanceFollowRedirects(true);
InputStream is = conn.getInputStream();
OutputStream os = new FileOutputStream(f);
Utils.CopyStream(is, os);
os.close();
conn.disconnect();
bitmap = decodeFile(f);
return bitmap;
} catch (Throwable ex) {
ex.printStackTrace();
if (ex instanceof OutOfMemoryError)
memoryCache.clear();
return null;
}
}
// Decodes image and scales it to reduce memory consumption
private Bitmap decodeFile(File f) {
try {
// Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
FileInputStream stream1 = new FileInputStream(f);
BitmapFactory.decodeStream(stream1, null, o);
stream1.close();
// Find the correct scale value. It should be the power of 2.
// Recommended Size 512
final int REQUIRED_SIZE = 70;
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp / 2 < REQUIRED_SIZE
|| height_tmp / 2 < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
FileInputStream stream2 = new FileInputStream(f);
Bitmap bitmap = BitmapFactory.decodeStream(stream2, null, o2);
stream2.close();
return bitmap;
} catch (FileNotFoundException e) {
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
// Task for the queue
private class PhotoToLoad {
public String url;
public ImageView imageView;
public PhotoToLoad(String u, ImageView i) {
url = u;
imageView = i;
}
}
class PhotosLoader implements Runnable {
PhotoToLoad photoToLoad;
PhotosLoader(PhotoToLoad photoToLoad) {
this.photoToLoad = photoToLoad;
}
@Override
public void run() {
try {
if (imageViewReused(photoToLoad))
return;
Bitmap bmp = getBitmap(photoToLoad.url);
memoryCache.put(photoToLoad.url, bmp);
if (imageViewReused(photoToLoad))
return;
BitmapDisplayer bd = new BitmapDisplayer(bmp, photoToLoad);
handler.post(bd);
} catch (Throwable th) {
th.printStackTrace();
}
}
}
boolean imageViewReused(PhotoToLoad photoToLoad) {
String tag = imageViews.get(photoToLoad.imageView);
if (tag == null || !tag.equals(photoToLoad.url))
return true;
return false;
}
// Used to display bitmap in the UI thread
class BitmapDisplayer implements Runnable {
Bitmap bitmap;
PhotoToLoad photoToLoad;
public BitmapDisplayer(Bitmap b, PhotoToLoad p) {
bitmap = b;
photoToLoad = p;
}
public void run() {
if (imageViewReused(photoToLoad))
return;
if (bitmap != null)
photoToLoad.imageView.setImageBitmap(bitmap);
else
photoToLoad.imageView.setImageResource(stub_id);
}
}
public void clearCache() {
memoryCache.clear();
fileCache.clear();
}
}
Hi
I am using ImageLoader class to load image from url and displaing in list
view. But This ImagLoader loading image on emulator but when i run my app
on real device its not loading any image..(Just showing the default
image).
Please help me to know what should i do with ImageLoader class to work on
real device.
ImageLoaader Class:-
public class ImageLoader {
MemoryCache memoryCache = new MemoryCache();
FileCache fileCache;
private Map<ImageView, String> imageViews = Collections
.synchronizedMap(new WeakHashMap<ImageView, String>());
ExecutorService executorService;
// Handler to display images in UI thread
Handler handler = new Handler();
public ImageLoader(Context context) {
fileCache = new FileCache(context);
executorService = Executors.newFixedThreadPool(5);
}
final int stub_id = R.drawable.products;
public void DisplayImage(String url, ImageView imageView) {
imageViews.put(imageView, url);
Bitmap bitmap = memoryCache.get(url);
if (bitmap != null)
imageView.setImageBitmap(bitmap);
else {
queuePhoto(url, imageView);
imageView.setImageResource(stub_id);
}
}
private void queuePhoto(String url, ImageView imageView) {
PhotoToLoad p = new PhotoToLoad(url, imageView);
executorService.submit(new PhotosLoader(p));
}
private Bitmap getBitmap(String url) {
File f = fileCache.getFile(url);
Bitmap b = decodeFile(f);
if (b != null)
return b;
// Download Images from the Internet
try {
Bitmap bitmap = null;
URL imageUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) imageUrl
.openConnection();
conn.setConnectTimeout(30000);
conn.setReadTimeout(30000);
conn.setInstanceFollowRedirects(true);
InputStream is = conn.getInputStream();
OutputStream os = new FileOutputStream(f);
Utils.CopyStream(is, os);
os.close();
conn.disconnect();
bitmap = decodeFile(f);
return bitmap;
} catch (Throwable ex) {
ex.printStackTrace();
if (ex instanceof OutOfMemoryError)
memoryCache.clear();
return null;
}
}
// Decodes image and scales it to reduce memory consumption
private Bitmap decodeFile(File f) {
try {
// Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
FileInputStream stream1 = new FileInputStream(f);
BitmapFactory.decodeStream(stream1, null, o);
stream1.close();
// Find the correct scale value. It should be the power of 2.
// Recommended Size 512
final int REQUIRED_SIZE = 70;
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp / 2 < REQUIRED_SIZE
|| height_tmp / 2 < REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
FileInputStream stream2 = new FileInputStream(f);
Bitmap bitmap = BitmapFactory.decodeStream(stream2, null, o2);
stream2.close();
return bitmap;
} catch (FileNotFoundException e) {
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
// Task for the queue
private class PhotoToLoad {
public String url;
public ImageView imageView;
public PhotoToLoad(String u, ImageView i) {
url = u;
imageView = i;
}
}
class PhotosLoader implements Runnable {
PhotoToLoad photoToLoad;
PhotosLoader(PhotoToLoad photoToLoad) {
this.photoToLoad = photoToLoad;
}
@Override
public void run() {
try {
if (imageViewReused(photoToLoad))
return;
Bitmap bmp = getBitmap(photoToLoad.url);
memoryCache.put(photoToLoad.url, bmp);
if (imageViewReused(photoToLoad))
return;
BitmapDisplayer bd = new BitmapDisplayer(bmp, photoToLoad);
handler.post(bd);
} catch (Throwable th) {
th.printStackTrace();
}
}
}
boolean imageViewReused(PhotoToLoad photoToLoad) {
String tag = imageViews.get(photoToLoad.imageView);
if (tag == null || !tag.equals(photoToLoad.url))
return true;
return false;
}
// Used to display bitmap in the UI thread
class BitmapDisplayer implements Runnable {
Bitmap bitmap;
PhotoToLoad photoToLoad;
public BitmapDisplayer(Bitmap b, PhotoToLoad p) {
bitmap = b;
photoToLoad = p;
}
public void run() {
if (imageViewReused(photoToLoad))
return;
if (bitmap != null)
photoToLoad.imageView.setImageBitmap(bitmap);
else
photoToLoad.imageView.setImageResource(stub_id);
}
}
public void clearCache() {
memoryCache.clear();
fileCache.clear();
}
}
Friday, 23 August 2013
XML request and response in java
XML request and response in java
I have to do Company Name Search, i have sample xml request and sample xml
response, can anybody tell me how to code this in java? i tried to parse
xml, that gives complete xml file, i want to enter user defined string as
a value of a tag in xml as a company name and want to display the response
from the server.
Here is namesearch_req.xml :
http://xmlgw.companieshouse.gov.uk/examples/namesearch_req.xml
namesearch_reply :
http://xmlgw.companieshouse.gov.uk/examples/namesearch_reply.xml
Thanks
I have to do Company Name Search, i have sample xml request and sample xml
response, can anybody tell me how to code this in java? i tried to parse
xml, that gives complete xml file, i want to enter user defined string as
a value of a tag in xml as a company name and want to display the response
from the server.
Here is namesearch_req.xml :
http://xmlgw.companieshouse.gov.uk/examples/namesearch_req.xml
namesearch_reply :
http://xmlgw.companieshouse.gov.uk/examples/namesearch_reply.xml
Thanks
In Fiddler, how can I edit the session context menu?
In Fiddler, how can I edit the session context menu?
What I am wondering is, how can I edit an already existent item in the
context menu that opens up when a session that has been selected is right
clicked? Specifically speaking, I am looking to change the text for the
item "Unlock For Editing" through the Fiddler2 Script Editor. This seems
quite simple, but I when looking through FiddlerApplication.UI, the only
thing I can find relating to a context menu strip is
FiddlerApplication.UI.ContextMenuStrip and I don't see any items within
the direct members. Maybe I am looking over something, but all I know is
that I can't find the item for which text should be "Unlock For Editing".
Also, if somebody does know what I am talking about, I have yet one more
question; how can I make something happen upon the event of the context
menu being opened, and without overriding the original code for the
opening event method? Thank you for any help!
What I am wondering is, how can I edit an already existent item in the
context menu that opens up when a session that has been selected is right
clicked? Specifically speaking, I am looking to change the text for the
item "Unlock For Editing" through the Fiddler2 Script Editor. This seems
quite simple, but I when looking through FiddlerApplication.UI, the only
thing I can find relating to a context menu strip is
FiddlerApplication.UI.ContextMenuStrip and I don't see any items within
the direct members. Maybe I am looking over something, but all I know is
that I can't find the item for which text should be "Unlock For Editing".
Also, if somebody does know what I am talking about, I have yet one more
question; how can I make something happen upon the event of the context
menu being opened, and without overriding the original code for the
opening event method? Thank you for any help!
Railo 4/ Tomcat / IIS7.5 / Coldfusion / cffile upload of docx not working
Railo 4/ Tomcat / IIS7.5 / Coldfusion / cffile upload of docx not working
I have a webapplication that i just moved from a Coldfusion server to a
Railo server. Quite some mainly smaller issues, but this one is puzzling
me for quite some time now:
I have a upload functionality for files. Everything works fine for almost
all files, just .docx files dont get uploaded. In Railo I see the error:
form field [form.docsbestand] is not a file field
I have registerd the docx mimetype in IIS and Tomcat as
application/vnd.openxmlformats-officedocument.wordprocessingml.document
I just did a small test and cfdumped the #form# twice...first time with
.doc file, second time with docx file
the result:
docsbestand string C:\inetpub\wwwroot\site\WEB-INF\railo\temp\tmp-321.upload
fieldnames string jsoninput,docsbestand
jsoninput string {"PRO":{"idaanvraag":"052300022920333
,"bron":"Spontaan"},"apiklant":"demo","apikey":KL541231231}
second one with .docx file
docsbestand string PK!0�(r�[Content_Types].xml
�(��T�n�0�W�?D�V������[��0��z��l�I�Q�B�
\"%���ك�ښl
�w%�=���^i7+���%�g&�0�A�6�l4��L60#��S
����X��&��V$z�3��3෽���%p)O5�����5}�:��e�ۅ�V�DFK��)_:�K%�)�l��\�!��U�'�v�7�&j�X��*,��+W^.,�����W����k��D�ܚ��X�ݷ��>��N!��FZ�&0m��ly��)�q�9��d}��@��?Ĥ�����R��/��s���*&:t��g������ˉ�8Y�O�[�&V0}�X�?Ȼ���>ʏ
33;#��;�F�io.����PK!���N_rels/.rels
�(����JA���a�}7�
"���H�w"����w̤ھ��
�P�^����O֛���;�<�aYՠ؛G�kxm��PY�[��g
Gΰino�/<���<�1��ⳆA$>"f3��\�ȾT��I
S����������W����Y
ig�@��X6_�]7~
f��ˉ�ao�.b*lI�r�j)�,l0�%��b�
6�i���D�_���,
�
���|u�Z^t٢yǯ;!Y,}{�C��/h>��PK!ʡ��9word/_rels/document.xml.rels
�(����N�@��&�ٻl�ZMS�5����la�.�dw���I(4�x�B2�}?fvX�������(&<�Ĥ%��o��Ha��AEN����;hE�+��y�.Q���%T���;���".m.k��Tr>�-�z����ۤ����VxqSs���&���M���B�t@���S�(��3����D
n
��m)�k0�0���Q�y�}�z,>�2��,ϡ'8Jc�)!2�����(�A�O
Q�ɶ��]߉J���2��ç�Я��z3)/�ˁ������MI�
ۏ���]���!���PK!q��
�word/document.xml�]Ks�H�o����c~B���s�;�nm�F�@��B0���B��
!�6�9�i
J��>+��巿&�6�o:�Y����4nôGg�LJ��iM�f�rl~V{�~�����e�1��t��@�!l�3���
p;��?�
����ps�x�?�Qc¼�[8�fߴ������Z4�sV�zv'�>1��;��q�Cs���/�s���H���48�?6]�6y�h��X2���lb�������i���ؙ0u|n�����n��O�֌Y�-ǵ��%�ֈ�n�@�B���c(��k�
fieldnames string jsoninput,docsbestand
jsoninput string {"PRO":{"idaanvraag":"052300022920333"
,"bron":"Spontaan"},"apiklant":"demo","apikey":KL541231231}
Somehow the file is not uploaded to the tmp-directory but
read/parsed/whatever. And ofcourse the cffile upload wont work in those
cases.
What could be causing this?
thanks! Bart
I have a webapplication that i just moved from a Coldfusion server to a
Railo server. Quite some mainly smaller issues, but this one is puzzling
me for quite some time now:
I have a upload functionality for files. Everything works fine for almost
all files, just .docx files dont get uploaded. In Railo I see the error:
form field [form.docsbestand] is not a file field
I have registerd the docx mimetype in IIS and Tomcat as
application/vnd.openxmlformats-officedocument.wordprocessingml.document
I just did a small test and cfdumped the #form# twice...first time with
.doc file, second time with docx file
the result:
docsbestand string C:\inetpub\wwwroot\site\WEB-INF\railo\temp\tmp-321.upload
fieldnames string jsoninput,docsbestand
jsoninput string {"PRO":{"idaanvraag":"052300022920333
,"bron":"Spontaan"},"apiklant":"demo","apikey":KL541231231}
second one with .docx file
docsbestand string PK!0�(r�[Content_Types].xml
�(��T�n�0�W�?D�V������[��0��z��l�I�Q�B�
\"%���ك�ښl
�w%�=���^i7+���%�g&�0�A�6�l4��L60#��S
����X��&��V$z�3��3෽���%p)O5�����5}�:��e�ۅ�V�DFK��)_:�K%�)�l��\�!��U�'�v�7�&j�X��*,��+W^.,�����W����k��D�ܚ��X�ݷ��>��N!��FZ�&0m��ly��)�q�9��d}��@��?Ĥ�����R��/��s���*&:t��g������ˉ�8Y�O�[�&V0}�X�?Ȼ���>ʏ
33;#��;�F�io.����PK!���N_rels/.rels
�(����JA���a�}7�
"���H�w"����w̤ھ��
�P�^����O֛���;�<�aYՠ؛G�kxm��PY�[��g
Gΰino�/<���<�1��ⳆA$>"f3��\�ȾT��I
S����������W����Y
ig�@��X6_�]7~
f��ˉ�ao�.b*lI�r�j)�,l0�%��b�
6�i���D�_���,
�
���|u�Z^t٢yǯ;!Y,}{�C��/h>��PK!ʡ��9word/_rels/document.xml.rels
�(����N�@��&�ٻl�ZMS�5����la�.�dw���I(4�x�B2�}?fvX�������(&<�Ĥ%��o��Ha��AEN����;hE�+��y�.Q���%T���;���".m.k��Tr>�-�z����ۤ����VxqSs���&���M���B�t@���S�(��3����D
n
��m)�k0�0���Q�y�}�z,>�2��,ϡ'8Jc�)!2�����(�A�O
Q�ɶ��]߉J���2��ç�Я��z3)/�ˁ������MI�
ۏ���]���!���PK!q��
�word/document.xml�]Ks�H�o����c~B���s�;�nm�F�@��B0���B��
!�6�9�i
J��>+��巿&�6�o:�Y����4nôGg�LJ��iM�f�rl~V{�~�����e�1��t��@�!l�3���
p;��?�
����ps�x�?�Qc¼�[8�fߴ������Z4�sV�zv'�>1��;��q�Cs���/�s���H���48�?6]�6y�h��X2���lb�������i���ؙ0u|n�����n��O�֌Y�-ǵ��%�ֈ�n�@�B���c(��k�
fieldnames string jsoninput,docsbestand
jsoninput string {"PRO":{"idaanvraag":"052300022920333"
,"bron":"Spontaan"},"apiklant":"demo","apikey":KL541231231}
Somehow the file is not uploaded to the tmp-directory but
read/parsed/whatever. And ofcourse the cffile upload wont work in those
cases.
What could be causing this?
thanks! Bart
Blender as an environment for testing CG algorithms
Blender as an environment for testing CG algorithms
I need to code up a computer graphics algorithm for Surface Registration.
Briefly surface registration is the process of finding "optimal" one-one
correspondence between surfaces, where the meaning of optimal depends on
the specific problem.
I do not have much experience with Computer Graphics software, and so I
was looking around the web for a good software environment to code my
algorithm up in.
One promising option I hit upon was [Blender][1], which to my delight also
has a Python interface to it.
My questions are
Is Blender + Python a good software environment for implementing and
testing computer graphics algorithms?
If not, are there better alternatives to it (hopefully using a Pythonic
interface)?
Are there any particular points from your experience which I should keep
in mind while using Blender (or whatever package you recommend) while
implementing/testing my algorithm?
I need to code up a computer graphics algorithm for Surface Registration.
Briefly surface registration is the process of finding "optimal" one-one
correspondence between surfaces, where the meaning of optimal depends on
the specific problem.
I do not have much experience with Computer Graphics software, and so I
was looking around the web for a good software environment to code my
algorithm up in.
One promising option I hit upon was [Blender][1], which to my delight also
has a Python interface to it.
My questions are
Is Blender + Python a good software environment for implementing and
testing computer graphics algorithms?
If not, are there better alternatives to it (hopefully using a Pythonic
interface)?
Are there any particular points from your experience which I should keep
in mind while using Blender (or whatever package you recommend) while
implementing/testing my algorithm?
How to get logged in user profile picture. Facebook SDK 3.5
How to get logged in user profile picture. Facebook SDK 3.5
Im trying to use facebook login to get user profile picture.
Im using this code to log in to facebook from the example facebook code:
package com.facebook.samples.sessionlogin;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import com.facebook.LoggingBehavior;
import com.facebook.Session;
import com.facebook.SessionState;
import com.facebook.Settings;
public class LoginUsingActivityActivity extends Activity {
private static final String URL_PREFIX_FRIENDS =
"https://graph.facebook.com/me/friends?access_token=";
private TextView textInstructionsOrLink;
private Button buttonLoginLogout;
private Session.StatusCallback statusCallback = new
SessionStatusCallback();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
buttonLoginLogout = (Button)findViewById(R.id.buttonLoginLogout);
textInstructionsOrLink =
(TextView)findViewById(R.id.instructionsOrLink);
Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
Session session = Session.getActiveSession();
if (session == null) {
if (savedInstanceState != null) {
session = Session.restoreSession(this, null,
statusCallback, savedInstanceState);
}
if (session == null) {
session = new Session(this);
}
Session.setActiveSession(session);
if
(session.getState().equals(SessionState.CREATED_TOKEN_LOADED))
{
session.openForRead(new
Session.OpenRequest(this).setCallback(statusCallback));
}
}
updateView();
}
@Override
public void onStart() {
super.onStart();
Session.getActiveSession().addCallback(statusCallback);
}
@Override
public void onStop() {
super.onStop();
Session.getActiveSession().removeCallback(statusCallback);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode,
resultCode, data);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Session session = Session.getActiveSession();
Session.saveSession(session, outState);
}
private void updateView() {
Session session = Session.getActiveSession();
if (session.isOpened()) {
textInstructionsOrLink.setText(URL_PREFIX_FRIENDS +
session.getAccessToken());
buttonLoginLogout.setText(R.string.logout);
buttonLoginLogout.setOnClickListener(new OnClickListener() {
public void onClick(View view) { onClickLogout(); }
});
} else {
textInstructionsOrLink.setText(R.string.instructions);
buttonLoginLogout.setText(R.string.login);
buttonLoginLogout.setOnClickListener(new OnClickListener() {
public void onClick(View view) { onClickLogin(); }
});
}
}
private void onClickLogin() {
Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
session.openForRead(new
Session.OpenRequest(this).setCallback(statusCallback));
} else {
Session.openActiveSession(this, true, statusCallback);
}
}
private void onClickLogout() {
Session session = Session.getActiveSession();
if (!session.isClosed()) {
session.closeAndClearTokenInformation();
}
}
private class SessionStatusCallback implements Session.StatusCallback {
@Override
public void call(Session session, SessionState state, Exception
exception) {
updateView();
}
}
}
In my code i try to get the user profile pictrue using the URL facebook
gave here:
https://developers.facebook.com/docs/reference/api/using-pictures/
On my activity result i have this code:
ImageView user_picture;
user_picture= (ImageView)findViewById(R.id.userpicture);
URL img_value = null;
try {
img_value = new
URL("https://graph.facebook.com/shaverm/picture?type=normal");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Bitmap mIcon1 = null;
try {
mIcon1 =
BitmapFactory.decodeStream(img_value.openConnection().getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
user_picture.setImageBitmap(mIcon1);
super.onActivityResult(requestCode, resultCode, data2);
But i get this errors:
08-23 15:08:59.705: E/AndroidRuntime(18684): FATAL EXCEPTION: main
08-23 15:08:59.705: E/AndroidRuntime(18684): java.lang.RuntimeException:
Failure delivering result ResultInfo{who=null, request=64206, result=-1,
data=Intent { (has extras) }} to activity
{com.tomer.workoutlog2/com.example.workoutlog.DatePage}:
android.os.NetworkOnMainThreadException
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.deliverResults(ActivityThread.java:3446)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.handleSendResult(ActivityThread.java:3489)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.access$1100(ActivityThread.java:153)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1295)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.os.Looper.loop(Looper.java:137)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.main(ActivityThread.java:5226)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
java.lang.reflect.Method.invokeNative(Native Method)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
java.lang.reflect.Method.invoke(Method.java:511)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
dalvik.system.NativeStart.main(Native Method)
08-23 15:08:59.705: E/AndroidRuntime(18684): Caused by:
android.os.NetworkOnMainThreadException
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:699)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
java.io.OutputStream.write(OutputStream.java:82)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpEngine.writeRequestHeaders(HttpEngine.java:659)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpEngine.readResponse(HttpEngine.java:808)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
com.example.workoutlog.DatePage.onActivityResult(DatePage.java:3153)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.Activity.dispatchActivityResult(Activity.java:5293)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.deliverResults(ActivityThread.java:3442)
08-23 15:08:59.705: E/AndroidRuntime(18684): ... 11 more
I also tried this issue:
Android and Facebook: How to get picture of logged in User
I get deprecated error for this code:
Facebook mFacebook = new Facebook(APP_ID);
// ... user logs in ...
//String jsonUser = mFacebook.request("me/picture"); // throws error
String jsonUser = mFacebook.request("me");
JSONObject obj = Util.parseJson(jsonUser);
String facebookId = obj.optString("id");
String name = obj.optString("name");
Im trying to use facebook login to get user profile picture.
Im using this code to log in to facebook from the example facebook code:
package com.facebook.samples.sessionlogin;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import com.facebook.LoggingBehavior;
import com.facebook.Session;
import com.facebook.SessionState;
import com.facebook.Settings;
public class LoginUsingActivityActivity extends Activity {
private static final String URL_PREFIX_FRIENDS =
"https://graph.facebook.com/me/friends?access_token=";
private TextView textInstructionsOrLink;
private Button buttonLoginLogout;
private Session.StatusCallback statusCallback = new
SessionStatusCallback();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
buttonLoginLogout = (Button)findViewById(R.id.buttonLoginLogout);
textInstructionsOrLink =
(TextView)findViewById(R.id.instructionsOrLink);
Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
Session session = Session.getActiveSession();
if (session == null) {
if (savedInstanceState != null) {
session = Session.restoreSession(this, null,
statusCallback, savedInstanceState);
}
if (session == null) {
session = new Session(this);
}
Session.setActiveSession(session);
if
(session.getState().equals(SessionState.CREATED_TOKEN_LOADED))
{
session.openForRead(new
Session.OpenRequest(this).setCallback(statusCallback));
}
}
updateView();
}
@Override
public void onStart() {
super.onStart();
Session.getActiveSession().addCallback(statusCallback);
}
@Override
public void onStop() {
super.onStop();
Session.getActiveSession().removeCallback(statusCallback);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode,
resultCode, data);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Session session = Session.getActiveSession();
Session.saveSession(session, outState);
}
private void updateView() {
Session session = Session.getActiveSession();
if (session.isOpened()) {
textInstructionsOrLink.setText(URL_PREFIX_FRIENDS +
session.getAccessToken());
buttonLoginLogout.setText(R.string.logout);
buttonLoginLogout.setOnClickListener(new OnClickListener() {
public void onClick(View view) { onClickLogout(); }
});
} else {
textInstructionsOrLink.setText(R.string.instructions);
buttonLoginLogout.setText(R.string.login);
buttonLoginLogout.setOnClickListener(new OnClickListener() {
public void onClick(View view) { onClickLogin(); }
});
}
}
private void onClickLogin() {
Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
session.openForRead(new
Session.OpenRequest(this).setCallback(statusCallback));
} else {
Session.openActiveSession(this, true, statusCallback);
}
}
private void onClickLogout() {
Session session = Session.getActiveSession();
if (!session.isClosed()) {
session.closeAndClearTokenInformation();
}
}
private class SessionStatusCallback implements Session.StatusCallback {
@Override
public void call(Session session, SessionState state, Exception
exception) {
updateView();
}
}
}
In my code i try to get the user profile pictrue using the URL facebook
gave here:
https://developers.facebook.com/docs/reference/api/using-pictures/
On my activity result i have this code:
ImageView user_picture;
user_picture= (ImageView)findViewById(R.id.userpicture);
URL img_value = null;
try {
img_value = new
URL("https://graph.facebook.com/shaverm/picture?type=normal");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Bitmap mIcon1 = null;
try {
mIcon1 =
BitmapFactory.decodeStream(img_value.openConnection().getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
user_picture.setImageBitmap(mIcon1);
super.onActivityResult(requestCode, resultCode, data2);
But i get this errors:
08-23 15:08:59.705: E/AndroidRuntime(18684): FATAL EXCEPTION: main
08-23 15:08:59.705: E/AndroidRuntime(18684): java.lang.RuntimeException:
Failure delivering result ResultInfo{who=null, request=64206, result=-1,
data=Intent { (has extras) }} to activity
{com.tomer.workoutlog2/com.example.workoutlog.DatePage}:
android.os.NetworkOnMainThreadException
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.deliverResults(ActivityThread.java:3446)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.handleSendResult(ActivityThread.java:3489)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.access$1100(ActivityThread.java:153)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1295)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.os.Looper.loop(Looper.java:137)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.main(ActivityThread.java:5226)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
java.lang.reflect.Method.invokeNative(Native Method)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
java.lang.reflect.Method.invoke(Method.java:511)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
dalvik.system.NativeStart.main(Native Method)
08-23 15:08:59.705: E/AndroidRuntime(18684): Caused by:
android.os.NetworkOnMainThreadException
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:699)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
java.io.OutputStream.write(OutputStream.java:82)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpEngine.writeRequestHeaders(HttpEngine.java:659)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpEngine.readResponse(HttpEngine.java:808)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
com.example.workoutlog.DatePage.onActivityResult(DatePage.java:3153)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.Activity.dispatchActivityResult(Activity.java:5293)
08-23 15:08:59.705: E/AndroidRuntime(18684): at
android.app.ActivityThread.deliverResults(ActivityThread.java:3442)
08-23 15:08:59.705: E/AndroidRuntime(18684): ... 11 more
I also tried this issue:
Android and Facebook: How to get picture of logged in User
I get deprecated error for this code:
Facebook mFacebook = new Facebook(APP_ID);
// ... user logs in ...
//String jsonUser = mFacebook.request("me/picture"); // throws error
String jsonUser = mFacebook.request("me");
JSONObject obj = Util.parseJson(jsonUser);
String facebookId = obj.optString("id");
String name = obj.optString("name");
What are the best plugin architectures?
What are the best plugin architectures?
I want to add plugin capability to a (big, complex) java server, because
some customer want to develop extra modules. It uses OSGi, but it's too
complex for customer's developers. What options do I have? What are the
best plugin architectures?
I want to add plugin capability to a (big, complex) java server, because
some customer want to develop extra modules. It uses OSGi, but it's too
complex for customer's developers. What options do I have? What are the
best plugin architectures?
Thursday, 22 August 2013
get http response code from a url
get http response code from a url
I want to write a Java program which will hit a URL and will print the
status code(i.e., 200, 404, etc.). I am doing this using the
HttpUrlConnection api, but it only shows the exception, and does not print
the status code.
URL url = new URL("https://abc.com/test.html");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
int code = connection.getResponseCode();
System.out.println("code: "+code);
I want to write a Java program which will hit a URL and will print the
status code(i.e., 200, 404, etc.). I am doing this using the
HttpUrlConnection api, but it only shows the exception, and does not print
the status code.
URL url = new URL("https://abc.com/test.html");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
int code = connection.getResponseCode();
System.out.println("code: "+code);
Scrolling Content With Fixed Navigation
Scrolling Content With Fixed Navigation
I'm stuck here. I can't quite figure out the correct syntax to get the
layout of my site exactly right.
I am attempting to have a side navigation of a fixed width that is 100%
height, then a top nav that is fixed height that is 100% width, finally I
want my content to take up the remaining space and have independent
scrolling.
I currently have my CSS set up as follows:
body
{
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
.sideNav
{
width: 100px;
height: 100%;
float: right;
position: absolute;
top: 0;
left: 0;
background-color: green;
z-index: 3;
}
.topNav
{
width: 100%;
height: 65px;
background-color: gold;
float: right;
position: relative;
z-index: 2;
text-align: right;
}
.content
{
width: 100%;
height: 100%;
z-index: 1;
background-color: blue;
overflow-y: scroll;
box-sizing: border-box;
-moz-box-sizing: border-box;
position: absolute;
bottom: 0;
right: 0;
padding-left: 100px;
border: 2px red inset;
margin-top: 65px;
}
Here is the Fiddle as I know this sounds confusing: jsFiddle
Let me know if there is anything else I can provide. I've exhausted all of
my ideas.
I'm stuck here. I can't quite figure out the correct syntax to get the
layout of my site exactly right.
I am attempting to have a side navigation of a fixed width that is 100%
height, then a top nav that is fixed height that is 100% width, finally I
want my content to take up the remaining space and have independent
scrolling.
I currently have my CSS set up as follows:
body
{
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
.sideNav
{
width: 100px;
height: 100%;
float: right;
position: absolute;
top: 0;
left: 0;
background-color: green;
z-index: 3;
}
.topNav
{
width: 100%;
height: 65px;
background-color: gold;
float: right;
position: relative;
z-index: 2;
text-align: right;
}
.content
{
width: 100%;
height: 100%;
z-index: 1;
background-color: blue;
overflow-y: scroll;
box-sizing: border-box;
-moz-box-sizing: border-box;
position: absolute;
bottom: 0;
right: 0;
padding-left: 100px;
border: 2px red inset;
margin-top: 65px;
}
Here is the Fiddle as I know this sounds confusing: jsFiddle
Let me know if there is anything else I can provide. I've exhausted all of
my ideas.
jQuery - Traversing the dom and selecting
jQuery - Traversing the dom and selecting
I'm having a hard time selecting all of the first div elements inside a
parent div which appears multiple times.
For Example I need to select the first div inside every parent div that
have a class of "nav". See below to understand:
<div class="container">
<div class="nav">
<div class="sub-item"></div> **SELECT THIS**
<div class="sub-item"></div>
</div>
</div>
<div class="container">
<div class="nav">
<div class="sub-item"></div> **SELECT THIS**
<div class="sub-item"></div>
</div>
</div>
I tried this code but it only selects the div in the first parent div.
$('.nav > div').eq(0);
Any help is appreciated!
I'm having a hard time selecting all of the first div elements inside a
parent div which appears multiple times.
For Example I need to select the first div inside every parent div that
have a class of "nav". See below to understand:
<div class="container">
<div class="nav">
<div class="sub-item"></div> **SELECT THIS**
<div class="sub-item"></div>
</div>
</div>
<div class="container">
<div class="nav">
<div class="sub-item"></div> **SELECT THIS**
<div class="sub-item"></div>
</div>
</div>
I tried this code but it only selects the div in the first parent div.
$('.nav > div').eq(0);
Any help is appreciated!
I want to initialize 1000 of strings for my project?is there any way to do programetically?
I want to initialize 1000 of strings for my project?is there any way to do
programetically?
I want to initialize 1000 of strings in ma app list wise
public static final String[] IMAGES = {"1","2","3","4","5","6",......"1000"};
programetically?
I want to initialize 1000 of strings in ma app list wise
public static final String[] IMAGES = {"1","2","3","4","5","6",......"1000"};
Problems with a MySQL server change
Problems with a MySQL server change
I have three tables in MySQL:
CREATE TABLE mlm.facturacion_2012_drm_base ( custid varchar(20) NOT NULL,
fecha date NOT NULL, docid varchar(20) NOT NULL, billid varchar(20) NOT
NULL, movimiento varchar(20) DEFAULT NULL, movid varchar(20) DEFAULT NULL,
medio_pago varchar(40) DEFAULT NULL, digitos varchar(20) DEFAULT NULL,
monto_facturado decimal(20,2) NOT NULL, monto_pagado decimal(20,2) NOT
NULL, monto_usado decimal(20,2) NOT NULL,
documento varchar(2) NOT NULL, codigo_pago varchar(5) DEFAULT NULL,
desc_pago varchar(100) DEFAULT NULL, sociedad varchar(45) DEFAULT NULL,
sociedad_bonif varchar(45) DEFAULT NULL, KEY billid (billid), KEY
motors_no_fact (custid,billid,fecha,documento) USING BTREE, KEY
facturacion (custid,fecha,documento) USING BTREE ) ENGINE=MyISAM DEFAULT
CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE mlm.facturacion_2012_drm_cortes ( id bigint(20) NOT NULL
AUTO_INCREMENT, fecha_inicial date NOT NULL,
fecha_final date NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM
AUTO_INCREMENT=433 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE mlm.facturacion_2012_drm_emitidas ( id bigint(20) NOT NULL
AUTO_INCREMENT, custid varchar(20) NOT NULL,
fecha_emision date NOT NULL, id_fechas bigint(20) NOT NULL,
monto decimal(20,2) NOT NULL, iva decimal(20,2) NOT NULL,
total decimal(20,2) NOT NULL, medio_pago varchar(2000) NOT NULL, digitos
varchar(100) NOT NULL, operaciones int(10) NOT NULL,
activa varchar(2) NOT NULL, movimiento varchar(45) NOT NULL,
parcialidades varchar(100) NOT NULL, monto_bruto decimal(20,2) NOT NULL,
billid varchar(45) NOT NULL, serie varchar(2) DEFAULT NULL, folio int(10)
DEFAULT NULL, uuid varchar(45) DEFAULT NULL, PRIMARY KEY (id), KEY motors
(billid,id_fechas,activa) ) ENGINE=MyISAM AUTO_INCREMENT=511483 DEFAULT
CHARSET=latin1;
I changed the MySQL server from 5.1 (32 Bits) to 5.6 (64 Bits) and
restored all my tables but I´m having problems with this query:
select a.custid, a.monto_facturado, a.billid, a.fecha, b.id, b.fecha_inicial
from facturacion_2012_drm_base a, facturacion_2012_drm_cortes b
where a.custid = any (select custid
from facturacion_motors_pendientes
where situacion = 'no facturado')
and a.billid <> all(select billid
from facturacion_2012_drm_emitidas
where activa = 'SI')
and a.fecha between b.fecha_inicial
and b.fecha_final
and a.documento = 'FA'
and year(a.fecha) = year(curdate())
group by a.billid
Since the server change, the query never finish, showing the message
"Query is being executed..."
Anybody knows why this is happening?
I have three tables in MySQL:
CREATE TABLE mlm.facturacion_2012_drm_base ( custid varchar(20) NOT NULL,
fecha date NOT NULL, docid varchar(20) NOT NULL, billid varchar(20) NOT
NULL, movimiento varchar(20) DEFAULT NULL, movid varchar(20) DEFAULT NULL,
medio_pago varchar(40) DEFAULT NULL, digitos varchar(20) DEFAULT NULL,
monto_facturado decimal(20,2) NOT NULL, monto_pagado decimal(20,2) NOT
NULL, monto_usado decimal(20,2) NOT NULL,
documento varchar(2) NOT NULL, codigo_pago varchar(5) DEFAULT NULL,
desc_pago varchar(100) DEFAULT NULL, sociedad varchar(45) DEFAULT NULL,
sociedad_bonif varchar(45) DEFAULT NULL, KEY billid (billid), KEY
motors_no_fact (custid,billid,fecha,documento) USING BTREE, KEY
facturacion (custid,fecha,documento) USING BTREE ) ENGINE=MyISAM DEFAULT
CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE mlm.facturacion_2012_drm_cortes ( id bigint(20) NOT NULL
AUTO_INCREMENT, fecha_inicial date NOT NULL,
fecha_final date NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM
AUTO_INCREMENT=433 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
CREATE TABLE mlm.facturacion_2012_drm_emitidas ( id bigint(20) NOT NULL
AUTO_INCREMENT, custid varchar(20) NOT NULL,
fecha_emision date NOT NULL, id_fechas bigint(20) NOT NULL,
monto decimal(20,2) NOT NULL, iva decimal(20,2) NOT NULL,
total decimal(20,2) NOT NULL, medio_pago varchar(2000) NOT NULL, digitos
varchar(100) NOT NULL, operaciones int(10) NOT NULL,
activa varchar(2) NOT NULL, movimiento varchar(45) NOT NULL,
parcialidades varchar(100) NOT NULL, monto_bruto decimal(20,2) NOT NULL,
billid varchar(45) NOT NULL, serie varchar(2) DEFAULT NULL, folio int(10)
DEFAULT NULL, uuid varchar(45) DEFAULT NULL, PRIMARY KEY (id), KEY motors
(billid,id_fechas,activa) ) ENGINE=MyISAM AUTO_INCREMENT=511483 DEFAULT
CHARSET=latin1;
I changed the MySQL server from 5.1 (32 Bits) to 5.6 (64 Bits) and
restored all my tables but I´m having problems with this query:
select a.custid, a.monto_facturado, a.billid, a.fecha, b.id, b.fecha_inicial
from facturacion_2012_drm_base a, facturacion_2012_drm_cortes b
where a.custid = any (select custid
from facturacion_motors_pendientes
where situacion = 'no facturado')
and a.billid <> all(select billid
from facturacion_2012_drm_emitidas
where activa = 'SI')
and a.fecha between b.fecha_inicial
and b.fecha_final
and a.documento = 'FA'
and year(a.fecha) = year(curdate())
group by a.billid
Since the server change, the query never finish, showing the message
"Query is being executed..."
Anybody knows why this is happening?
warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
When I porting source code from VC++6 to VC++9 with visual studio 2008, I
have this warning:
warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
I don't how to fix this warning. Please can somebody help me? Thanks so much!
When I porting source code from VC++6 to VC++9 with visual studio 2008, I
have this warning:
warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
I don't how to fix this warning. Please can somebody help me? Thanks so much!
Wednesday, 21 August 2013
mvc 3 razor view intellisense not working in VS2012
mvc 3 razor view intellisense not working in VS2012
I installed VS 2012 and MVC 3.0. Intellisense in MVC 3.0 is not working in
my machine. Also, I have VS 2005 and 2008 installed along with VS 2012.
Kindly help.
Thanks.
I installed VS 2012 and MVC 3.0. Intellisense in MVC 3.0 is not working in
my machine. Also, I have VS 2005 and 2008 installed along with VS 2012.
Kindly help.
Thanks.
How to add durability to an archive?
How to add durability to an archive?
I have a collection of home videos I want to archive on Amazon Glacier.
Since Glacier has a 4 Gb file limit, I need to split some of my 4Gb+ files
in to smaller chunks. I figured I should add some protective measures to
those file chunks (e.g. CRC).
Can anyone recommend a Windows 7 compatible tool that can chunk up and
restore a large file with the ability to add some durability to protect
against corruption?
I have a collection of home videos I want to archive on Amazon Glacier.
Since Glacier has a 4 Gb file limit, I need to split some of my 4Gb+ files
in to smaller chunks. I figured I should add some protective measures to
those file chunks (e.g. CRC).
Can anyone recommend a Windows 7 compatible tool that can chunk up and
restore a large file with the ability to add some durability to protect
against corruption?
C# Setting a STATIC object -- conceptual
C# Setting a STATIC object -- conceptual
I had a crazy idea but I don't know the broader implications of this
[negative]... OR if anyone has a suggestion for improving this concept,
that would be awesome. Thanks Community!!!
public static class myCon
{
static myCon()
{
if (_con == null)
_con = new SqlConnection()
{
ConnectionString = "..."
// etc...
};
}
public static SqlConnection _con { get; private set; }
}
Only using a connection string as an example. NO, I would not suggest this
for an actual connection, this is just CONCEPT... I'm not that close to
the dried paint :)
I had a crazy idea but I don't know the broader implications of this
[negative]... OR if anyone has a suggestion for improving this concept,
that would be awesome. Thanks Community!!!
public static class myCon
{
static myCon()
{
if (_con == null)
_con = new SqlConnection()
{
ConnectionString = "..."
// etc...
};
}
public static SqlConnection _con { get; private set; }
}
Only using a connection string as an example. NO, I would not suggest this
for an actual connection, this is just CONCEPT... I'm not that close to
the dried paint :)
not working with weblogic default authentication using j_security_check
not working with weblogic default authentication using j_security_check
Recently our JSF project is migrated from tomcat to weblogic server. In
tomcat version we were using Spring security for authentication. In
weblogic we are performing authentication using weblogic
defaultauthentication mechanism.
Everything is working fine except in the case when the j_security_check
authentication fails, the view is not directed to error page defined in
form-error-page element of web.xml, instead the loginPage.jspx page is
reloaded.
Below is the snipped from my web.xml
<login-config>
<auth-method>FORM</auth-method>
<realm-name>MySecurityRealm</realm-name>
<form-login-config>
<form-login-page>/faces/loginPage.jspx</form-login-page>
<form-error-page>/faces/errorPage.jspx</form-error-page>
</form-login-config>
</login-config>
and code snippet of the login method is as below -
public String login() throws IOException, ServletException {
ExternalContext context =
FacesContext.getCurrentInstance().getExternalContext();
HttpSession session = (HttpSession) context.getSession(false);
session.removeAttribute("oracle.adf.share.http.HttpSessionScopeAdapter");
RequestDispatcher dispatcher = ((ServletRequest)
context.getRequest()).getRequestDispatcher("/j_security_check");
dispatcher.forward(((ServletRequest) context.getRequest()),
(ServletResponse) context.getResponse());
FacesContext.getCurrentInstance().completeResponse();
}
Any suggestion will be helpful. Thanks.
Recently our JSF project is migrated from tomcat to weblogic server. In
tomcat version we were using Spring security for authentication. In
weblogic we are performing authentication using weblogic
defaultauthentication mechanism.
Everything is working fine except in the case when the j_security_check
authentication fails, the view is not directed to error page defined in
form-error-page element of web.xml, instead the loginPage.jspx page is
reloaded.
Below is the snipped from my web.xml
<login-config>
<auth-method>FORM</auth-method>
<realm-name>MySecurityRealm</realm-name>
<form-login-config>
<form-login-page>/faces/loginPage.jspx</form-login-page>
<form-error-page>/faces/errorPage.jspx</form-error-page>
</form-login-config>
</login-config>
and code snippet of the login method is as below -
public String login() throws IOException, ServletException {
ExternalContext context =
FacesContext.getCurrentInstance().getExternalContext();
HttpSession session = (HttpSession) context.getSession(false);
session.removeAttribute("oracle.adf.share.http.HttpSessionScopeAdapter");
RequestDispatcher dispatcher = ((ServletRequest)
context.getRequest()).getRequestDispatcher("/j_security_check");
dispatcher.forward(((ServletRequest) context.getRequest()),
(ServletResponse) context.getResponse());
FacesContext.getCurrentInstance().completeResponse();
}
Any suggestion will be helpful. Thanks.
How do you run an application in bash and select which monitor it runs on?
How do you run an application in bash and select which monitor it runs on?
I have a question that is hard to search for the answer (I always end up
with answers for monitor manipulation). I am writing a bash shell script
to help me with my code dev and I have two monitors.
When I run my executable that I have compiled I want to tell it to run on
a particular monitor (i.e. different to the monitor that I have my
terminal open on so I can view the debug on one screen and have the app on
another). How would I go about doing this? Somthing like:
./myProject > but run on monitor 2
Where myProject is my binary executable.
Thanks all.
I have a question that is hard to search for the answer (I always end up
with answers for monitor manipulation). I am writing a bash shell script
to help me with my code dev and I have two monitors.
When I run my executable that I have compiled I want to tell it to run on
a particular monitor (i.e. different to the monitor that I have my
terminal open on so I can view the debug on one screen and have the app on
another). How would I go about doing this? Somthing like:
./myProject > but run on monitor 2
Where myProject is my binary executable.
Thanks all.
Why is my subview is not scrolling?
Why is my subview is not scrolling?
I have a HeadView and after any actions I add a SubView to it:
SubView *sub=[SubView alloc]initWithFrame:CGRectMake(30,30,40,20)];
[self.view addSubview:SubView]; //self is HeadView
After, I add ScrollView to HeadView:
UIScrollView *scroll=[UIScrollView alloc]initWithFrame:self.view.frame];
[scroll setContentSize:CGSizeMake(1000,1000)];
[self.view addSubview:scroll];
and I need, that my subview scrolling. But it's not scrolling. Where is
mistake?
I have a HeadView and after any actions I add a SubView to it:
SubView *sub=[SubView alloc]initWithFrame:CGRectMake(30,30,40,20)];
[self.view addSubview:SubView]; //self is HeadView
After, I add ScrollView to HeadView:
UIScrollView *scroll=[UIScrollView alloc]initWithFrame:self.view.frame];
[scroll setContentSize:CGSizeMake(1000,1000)];
[self.view addSubview:scroll];
and I need, that my subview scrolling. But it's not scrolling. Where is
mistake?
need help in algorithm java
need help in algorithm java
i just started with algorithm with codes below
public class Dijkstra {
private static Heap h = new Heap();
private static int[][] g;
int n =6;
public Dijkstra() {
g = new int[10][10];
Scanner sc = new Scanner(System.in);
System.out.println("Enter the weight of each edges (for mobius use
9999)");
for(int a=1;a<=n;a++)
{
for(int b=1;b<=n;b++)
{
if((a!=b)&&(a<b))
{
System.out.print(a+" and "+b+": ");
g[b][a] = g[a][b] =sc.nextInt() ;
if(g[a][b] == 0 )
{
g[b][a] = g[a][b] = 9999;
}
}
if(a==b)
g[a][b]=9999;
}
}
}
public static void main(String[] args)
{
Dijkstra dij = new Dijkstra();
System.out.println(dij.solve(6, 6, 5));
}
public int solve(int numOfNodes, int source, int dest)
{
h.push(source, 0);
while (!h.isEmpty())
{
int c = h.pop();
if (c == dest)
return h.cost[dest];
for (int a = 0; a < numOfNodes; a++)
{
if (g[c][a] > 0)
h.push(a, h.cost[c] + g[c][a]);
}
}
return -1;
}
}
class Heap {
private int[] data;
private int[] index;
public int[] cost;
private int size;
Dijkstra ki = new Dijkstra();
public Heap()
{
data = new int[6];
index = new int[6];
cost = new int[6];
for (int a = 0; a < ki.n; a++)
{
index[a] = -1;
cost[a] = -1;
}
size = 0;
}
public boolean isEmpty()
{
return (size == 0);
}
private void Up(int a)
{
int b;
while (a > 0)
{
b = (a - 1) / 2;
if (cost[data[a]] < cost[data[b]])
{
// swap here
int temp = index[data[a]];
index[data[a]] = index[data[b]];
index[data[b]] = temp;
// swap here
temp = data[a];
data[a] = data[b];
data[b] = temp;
a = b;
}
else
break;
}
}
private void Down(int a)
{
int b, d;
while (2 * a + 1 < size)
{
b = 2 * a + 1;
d = b + 1;
if (d < size && cost[data[d]] < cost[data[b]]
&& cost[data[d]] < cost[data[a]])
{
int temp = index[data[d]];
index[data[d]] = index[data[a]];
index[data[a]] = temp;
temp = data[d];
data[d] = data[a];
data[a] = temp;
a = d;
}
else if (cost[data[b]] < cost[data[a]])
{
int temp = index[data[b]];
index[data[b]] = index[data[a]];
index[data[a]] = temp;
temp = data[b];
data[b] = data[a];
data[a] = temp;
a = b;
}
else
break;
}
}
public int pop()
{
int i = data[0];
data[0] = data[size - 1];
index[data[0]] = 0;
size--;
Down(0);
return i;
}
public void push(int e, int f)
{
if (index[e] == 0)
{
cost[e] = f;
data[size] = e;
index[e] = size;
size++;
Up(index[e]);
}
else
{
if (f < cost[e])
{
cost[e] = f;
Up(index[e]);
Down(index[e]);
}
}
}
}
i have this error but i dont know where i must fix it
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
at algo.Heap.push(Dijkstra.java:176)
at algo.Dijkstra.solve(Dijkstra.java:52)
at algo.Dijkstra.main(Dijkstra.java:47)
Java Result: 1
output will be the shortest total weight between the root and the target i
suppose to input the weight of its node use dijkstra algorithm can someone
help me please
i just started with algorithm with codes below
public class Dijkstra {
private static Heap h = new Heap();
private static int[][] g;
int n =6;
public Dijkstra() {
g = new int[10][10];
Scanner sc = new Scanner(System.in);
System.out.println("Enter the weight of each edges (for mobius use
9999)");
for(int a=1;a<=n;a++)
{
for(int b=1;b<=n;b++)
{
if((a!=b)&&(a<b))
{
System.out.print(a+" and "+b+": ");
g[b][a] = g[a][b] =sc.nextInt() ;
if(g[a][b] == 0 )
{
g[b][a] = g[a][b] = 9999;
}
}
if(a==b)
g[a][b]=9999;
}
}
}
public static void main(String[] args)
{
Dijkstra dij = new Dijkstra();
System.out.println(dij.solve(6, 6, 5));
}
public int solve(int numOfNodes, int source, int dest)
{
h.push(source, 0);
while (!h.isEmpty())
{
int c = h.pop();
if (c == dest)
return h.cost[dest];
for (int a = 0; a < numOfNodes; a++)
{
if (g[c][a] > 0)
h.push(a, h.cost[c] + g[c][a]);
}
}
return -1;
}
}
class Heap {
private int[] data;
private int[] index;
public int[] cost;
private int size;
Dijkstra ki = new Dijkstra();
public Heap()
{
data = new int[6];
index = new int[6];
cost = new int[6];
for (int a = 0; a < ki.n; a++)
{
index[a] = -1;
cost[a] = -1;
}
size = 0;
}
public boolean isEmpty()
{
return (size == 0);
}
private void Up(int a)
{
int b;
while (a > 0)
{
b = (a - 1) / 2;
if (cost[data[a]] < cost[data[b]])
{
// swap here
int temp = index[data[a]];
index[data[a]] = index[data[b]];
index[data[b]] = temp;
// swap here
temp = data[a];
data[a] = data[b];
data[b] = temp;
a = b;
}
else
break;
}
}
private void Down(int a)
{
int b, d;
while (2 * a + 1 < size)
{
b = 2 * a + 1;
d = b + 1;
if (d < size && cost[data[d]] < cost[data[b]]
&& cost[data[d]] < cost[data[a]])
{
int temp = index[data[d]];
index[data[d]] = index[data[a]];
index[data[a]] = temp;
temp = data[d];
data[d] = data[a];
data[a] = temp;
a = d;
}
else if (cost[data[b]] < cost[data[a]])
{
int temp = index[data[b]];
index[data[b]] = index[data[a]];
index[data[a]] = temp;
temp = data[b];
data[b] = data[a];
data[a] = temp;
a = b;
}
else
break;
}
}
public int pop()
{
int i = data[0];
data[0] = data[size - 1];
index[data[0]] = 0;
size--;
Down(0);
return i;
}
public void push(int e, int f)
{
if (index[e] == 0)
{
cost[e] = f;
data[size] = e;
index[e] = size;
size++;
Up(index[e]);
}
else
{
if (f < cost[e])
{
cost[e] = f;
Up(index[e]);
Down(index[e]);
}
}
}
}
i have this error but i dont know where i must fix it
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
at algo.Heap.push(Dijkstra.java:176)
at algo.Dijkstra.solve(Dijkstra.java:52)
at algo.Dijkstra.main(Dijkstra.java:47)
Java Result: 1
output will be the shortest total weight between the root and the target i
suppose to input the weight of its node use dijkstra algorithm can someone
help me please
Tuesday, 20 August 2013
MySQL Inserting Multiple Columns and Rows into a Temporary Table
MySQL Inserting Multiple Columns and Rows into a Temporary Table
I have a temporary table:
CREATE TEMPORARY TABLE IF NOT EXISTS `temp`
AS (
SELECT COUNT(*) as count, YEAR(end_date)
FROM a
WHERE column_1 = "some_condition"
GROUP BY YEAR(end_date)
);
I then try to add on new values into this table
INSERT INTO temp (count, year)
VALUES(
SELECT COUNT(*) as count, year(end_date)
FROM b
WHERE column_1 = "some_condition"
GROUP BY YEAR(end_date)
);
And this line throws error.
What I'm trying to achieve is for the new rows and columns which were
selected to be inserted into the temporary table. Any ideas?
After the first query, temp table should look like this:
count year
3 2012
20 2013
104 2011
And the selected results from the second query looks like this
count year
6 2013
The expected outcome:
count year
3 2012
20 2013
104 2011
6 2013
I have a temporary table:
CREATE TEMPORARY TABLE IF NOT EXISTS `temp`
AS (
SELECT COUNT(*) as count, YEAR(end_date)
FROM a
WHERE column_1 = "some_condition"
GROUP BY YEAR(end_date)
);
I then try to add on new values into this table
INSERT INTO temp (count, year)
VALUES(
SELECT COUNT(*) as count, year(end_date)
FROM b
WHERE column_1 = "some_condition"
GROUP BY YEAR(end_date)
);
And this line throws error.
What I'm trying to achieve is for the new rows and columns which were
selected to be inserted into the temporary table. Any ideas?
After the first query, temp table should look like this:
count year
3 2012
20 2013
104 2011
And the selected results from the second query looks like this
count year
6 2013
The expected outcome:
count year
3 2012
20 2013
104 2011
6 2013
JQuery UI Resizable + box-sizing: border-box = height bug? Help please
JQuery UI Resizable + box-sizing: border-box = height bug? Help please
I'm trying to resize a DIV with box-sizing: border-box; Even though I only
allow resizing the width, the DIV shrinks everytime the resize event stops
(height changes).
My CSS
.test{
width: 200px;
height: 100px;
border: 1px solid red;
box-sizing: border-box;
}
Javascript
$(document).ready(function() {
$('.test').resizable({handles: 'e', stop: function(event, ui){
$('.wdt').text(ui.size.height);
}});
});
HTML
<div class="test">
Test
</div>
<br/>
<br/>
<span>Height =</span>
<span class='wdt'></span>
Resize it and you will see.
Can anybody help me? JSFiddle: http://jsfiddle.net/WuQtw/4/
I tried jquery 1.8.x.. 1.9.x... nothing changes. I cant use box-sizing:
content-box.
I'm trying to resize a DIV with box-sizing: border-box; Even though I only
allow resizing the width, the DIV shrinks everytime the resize event stops
(height changes).
My CSS
.test{
width: 200px;
height: 100px;
border: 1px solid red;
box-sizing: border-box;
}
Javascript
$(document).ready(function() {
$('.test').resizable({handles: 'e', stop: function(event, ui){
$('.wdt').text(ui.size.height);
}});
});
HTML
<div class="test">
Test
</div>
<br/>
<br/>
<span>Height =</span>
<span class='wdt'></span>
Resize it and you will see.
Can anybody help me? JSFiddle: http://jsfiddle.net/WuQtw/4/
I tried jquery 1.8.x.. 1.9.x... nothing changes. I cant use box-sizing:
content-box.
vifm: how do I set the viewcolumn option in my vifmrc so that it applies to both panes?
vifm: how do I set the viewcolumn option in my vifmrc so that it applies
to both panes?
I set the viewcolumn option in my vifmrc file, but when I pull up vifm
only the left pane uses the option setting from my vifmrc file. I have not
been able to find out how to get it to apply to both (or all) window panes
from the vifmrc. I am trying to avoid setting it manually in the right
pane and then using the set vifminfo+=tui option (which I haven't tried so
I don't even know if that would work). How do I get the viewcolumn option
from my vifmrc file to automatically apply to both window panes? Thanks
to both panes?
I set the viewcolumn option in my vifmrc file, but when I pull up vifm
only the left pane uses the option setting from my vifmrc file. I have not
been able to find out how to get it to apply to both (or all) window panes
from the vifmrc. I am trying to avoid setting it manually in the right
pane and then using the set vifminfo+=tui option (which I haven't tried so
I don't even know if that would work). How do I get the viewcolumn option
from my vifmrc file to automatically apply to both window panes? Thanks
Setting the JOB_NAME column width for the LSF bjobs command
Setting the JOB_NAME column width for the LSF bjobs command
Is there a way to tell the bjobs LSF command to use a wider column for
JOB_NAME. For example, instead of
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME
SUBMIT_TIME
12345678 MrFooz RUN some_queue src_box exec_box1 *eat_job Aug
20 08:40
I'd like to be able to see this
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME
SUBMIT_TIME
12345678 MrFooz RUN some_queue src_box exec_box1 my_great_job
Aug 20 08:40
Is there a way to tell the bjobs LSF command to use a wider column for
JOB_NAME. For example, instead of
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME
SUBMIT_TIME
12345678 MrFooz RUN some_queue src_box exec_box1 *eat_job Aug
20 08:40
I'd like to be able to see this
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME
SUBMIT_TIME
12345678 MrFooz RUN some_queue src_box exec_box1 my_great_job
Aug 20 08:40
Best option for wordpress mobile theme with mobile url
Best option for wordpress mobile theme with mobile url
I want to build a mobile site on wordpress. What Im looking to do is
detect if its being loaded on a mobile device and then switch themes based
on this.
Usually I implement a redirect to a mobile m.mysite.com address when using
different platforms, but is there a more efficient way of doing this on
wordpress, where I can keep the address but have it load a different
theme?
Im not keen on doing a responsive site as I want to completely restructure
the layout.
Thank you
I want to build a mobile site on wordpress. What Im looking to do is
detect if its being loaded on a mobile device and then switch themes based
on this.
Usually I implement a redirect to a mobile m.mysite.com address when using
different platforms, but is there a more efficient way of doing this on
wordpress, where I can keep the address but have it load a different
theme?
Im not keen on doing a responsive site as I want to completely restructure
the layout.
Thank you
Monday, 19 August 2013
Liferay Portlet-Servlet communication
Liferay Portlet-Servlet communication
I have a Spring 3 MVC servlet webservice based application which I now
intend to integrate with my liferay based system. In liferay we use IPC
(Inter portlet communication) to communicate between portlets.
An event is broadcasted by a portlet which is then processed by other
portlets and corresponding actions are taken. This communication is
currently being carried out using IPC.
I have now deployed my servlet application in Liferay in an iframe. Will
it be possible for me to establish similar processing of the broadcasted
event? Any solutions for portlet-servlet communication?
Thank you.
I have a Spring 3 MVC servlet webservice based application which I now
intend to integrate with my liferay based system. In liferay we use IPC
(Inter portlet communication) to communicate between portlets.
An event is broadcasted by a portlet which is then processed by other
portlets and corresponding actions are taken. This communication is
currently being carried out using IPC.
I have now deployed my servlet application in Liferay in an iframe. Will
it be possible for me to establish similar processing of the broadcasted
event? Any solutions for portlet-servlet communication?
Thank you.
Is it possible to share a specific image or a certain content inside a box on a page? and how?
Is it possible to share a specific image or a certain content inside a box
on a page? and how?
Is it possible to share an image and/or a content inside a box in a page?
and how?
I am able to share an entire page but unable to with just an image or a
certain part of a page.
Help would be appreciated. Thanks so much!
on a page? and how?
Is it possible to share an image and/or a content inside a box in a page?
and how?
I am able to share an entire page but unable to with just an image or a
certain part of a page.
Help would be appreciated. Thanks so much!
xdotool : how to enforce lower case letters for : xdotool type 'aaaaa'
xdotool : how to enforce lower case letters for : xdotool type 'aaaaa'
Is it possible to enforce that text is be typed in
lower case letters
when executing
xdotool type 'aaaaa'
because i noticed it actually types in capital letters if i have CAPS lock
on, on my keyboard.
UPDATE
this is the only portion in xdotool manual that talks about caps lock but
does not provide an example.
*CLEARMODIFIERS Any command taking the --clearmodifiers flag will attempt
to clear any active input modifiers during the command and restore them
afterwards. For example, if you were to run this command: xdotool key a
The result would be 'a' or 'A' depending on whether or not you were
holding the shift key on your keyboard. Often it is undesirable to have
any modifiers active, so you can tell xdotool to clear any active
modifiers. The order of operations if you hold shift while running
'xdotool key --clearmodifiers a' is this:
Query for all active modifiers (finds shift, in this case)
Try to clear shift by sending 'key up' for the shift key
Runs normal 'xdotool key a'
Restore shift key by sending 'key down' for shift
The --clearmodifiers flag can currently clear of the following:
any key in your active keymap that has a modifier associated with it. (See
xmodmap(1)'s 'xmodmap -pm' output)
mouse buttons (1, 2, 3, 4, and 5)
caps lock*
Is it possible to enforce that text is be typed in
lower case letters
when executing
xdotool type 'aaaaa'
because i noticed it actually types in capital letters if i have CAPS lock
on, on my keyboard.
UPDATE
this is the only portion in xdotool manual that talks about caps lock but
does not provide an example.
*CLEARMODIFIERS Any command taking the --clearmodifiers flag will attempt
to clear any active input modifiers during the command and restore them
afterwards. For example, if you were to run this command: xdotool key a
The result would be 'a' or 'A' depending on whether or not you were
holding the shift key on your keyboard. Often it is undesirable to have
any modifiers active, so you can tell xdotool to clear any active
modifiers. The order of operations if you hold shift while running
'xdotool key --clearmodifiers a' is this:
Query for all active modifiers (finds shift, in this case)
Try to clear shift by sending 'key up' for the shift key
Runs normal 'xdotool key a'
Restore shift key by sending 'key down' for shift
The --clearmodifiers flag can currently clear of the following:
any key in your active keymap that has a modifier associated with it. (See
xmodmap(1)'s 'xmodmap -pm' output)
mouse buttons (1, 2, 3, 4, and 5)
caps lock*
12.04 -desktop-i386 *new to linux*
12.04 -desktop-i386 *new to linux*
Today I got a .iso file of ubuntu named : "ubuntu 12.04
-desktop-i386.iso". So have few queries about it as I am new to all this:
Question: Will I be able to dual boot it with windows 7 home premium ?
Question: i will make a bootable pen drive for this, so using a 1 GB pen
drive(completely formatted) will be enough ?
Today I got a .iso file of ubuntu named : "ubuntu 12.04
-desktop-i386.iso". So have few queries about it as I am new to all this:
Question: Will I be able to dual boot it with windows 7 home premium ?
Question: i will make a bootable pen drive for this, so using a 1 GB pen
drive(completely formatted) will be enough ?
How to succeed at
How to succeed at
I just watched a news story that used the phrase "How to succeed at
university".
I was under the impression that at in this specific phrase has to be
follow by either a verb.
Is "How to succeed at university" grammatically correct? If it is, then
what is the difference between at/*in* in this case? If there is none,
which one is more desirable?
I just watched a news story that used the phrase "How to succeed at
university".
I was under the impression that at in this specific phrase has to be
follow by either a verb.
Is "How to succeed at university" grammatically correct? If it is, then
what is the difference between at/*in* in this case? If there is none,
which one is more desirable?
Short way to create simple multiple rows in a tabular
Short way to create simple multiple rows in a tabular
Let me please emphasise first, that I do not need a sophisticated tabular
--- I'm looking for a clever way to create a simple, but long tabular.
I'd like to create an empty tabular which has e.g. 25 rows. MWE:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{tabular}{|*{4}{c|}}\hline
\textbf{Akten-Nr.} & \textbf{Angelegenheit} & \textbf{Frist} &
\textbf{SB} \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
\end{tabular}
\end{document}
What I'd like to write is something like:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{tabular}{|*{5}{c|}}\hline
\textbf{Akten-Nr.} & \textbf{Angelegenheit} & \textbf{Frist} &
\textbf{SB} \\\hline
\multiplerows{25}{& & & \\\hline}
\end{tabular}
\end{document}
You see, I'd like to save the effort to print 25 (or howmuch ever) times &
& & \\\hline and instead one line with a »multiplicator«.
Any ideas of a (simple?) package, which offers something like
»\multiplerows{}{}«? Or can someone with greater karma in tabulars spill
some lines of code?
Let me please emphasise first, that I do not need a sophisticated tabular
--- I'm looking for a clever way to create a simple, but long tabular.
I'd like to create an empty tabular which has e.g. 25 rows. MWE:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{tabular}{|*{4}{c|}}\hline
\textbf{Akten-Nr.} & \textbf{Angelegenheit} & \textbf{Frist} &
\textbf{SB} \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
& & & \\\hline
\end{tabular}
\end{document}
What I'd like to write is something like:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{tabular}{|*{5}{c|}}\hline
\textbf{Akten-Nr.} & \textbf{Angelegenheit} & \textbf{Frist} &
\textbf{SB} \\\hline
\multiplerows{25}{& & & \\\hline}
\end{tabular}
\end{document}
You see, I'd like to save the effort to print 25 (or howmuch ever) times &
& & \\\hline and instead one line with a »multiplicator«.
Any ideas of a (simple?) package, which offers something like
»\multiplerows{}{}«? Or can someone with greater karma in tabulars spill
some lines of code?
Sunday, 18 August 2013
How do I post data using $resource using angularjs
How do I post data using $resource using angularjs
I'm having a bit of a problem, I'm trying to do a http post request to my
backend php. I'm new to angular and wanted to try the different REST
method. I'm good with GET method. After this I will try UPDATE and DELETE
method but for now I'm stuck on this. T__T.
Here a bit of the code in php
$data = array(
"email" => $email,
"password" => $this->input->post("password")
);
$insert_data = $this->player_registration->insert($data);
And here my factory
var factory = {};
factory.registerPlayer = function() {
return $resource( apiUrl + ':type', {type:'player'}, {
post: {method:'POST', params: {}}
});
};
And my controller
$scope.inputs = {};
$scope.inputs.email = "testuser@domain.com";
$scope.inputs.password = "password";
var req = new webService.registerPlayer($scope.inputs);
req.save()
I'm having a bit of a problem, I'm trying to do a http post request to my
backend php. I'm new to angular and wanted to try the different REST
method. I'm good with GET method. After this I will try UPDATE and DELETE
method but for now I'm stuck on this. T__T.
Here a bit of the code in php
$data = array(
"email" => $email,
"password" => $this->input->post("password")
);
$insert_data = $this->player_registration->insert($data);
And here my factory
var factory = {};
factory.registerPlayer = function() {
return $resource( apiUrl + ':type', {type:'player'}, {
post: {method:'POST', params: {}}
});
};
And my controller
$scope.inputs = {};
$scope.inputs.email = "testuser@domain.com";
$scope.inputs.password = "password";
var req = new webService.registerPlayer($scope.inputs);
req.save()
Subscribe to:
Comments (Atom)