Saturday, 31 August 2013

Will changing an events Time-Zone affect other people on shared events?

Will changing an events Time-Zone affect other people on shared events?

If I were to normalize an EKEvent 's startDate property using a
NSFormatter or by setting the time zone with
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"hh:mm a"];
[formatter setTimeZone:[NSTimeZone systemTimeZone]];
event.startDate = [formatter dateFromString:[NSString
stringWithFormat:@"%@", [event.startDate]]];
and I later make a change to that event requiring me to call
[self.event.eventStore saveEvent:currentEvent span:EKSpanThisEvent
commit:YES error:nil];
Would it override the time-zone on the server, causing issues for the
person (whom uses GCal) in another state that originally created that
shared calendar event, or is it just a local change?

iOS how to use .p12 certification?

iOS how to use .p12 certification?

my teacher only gave me a .p12 certification but no developer account. How
can I use it to test my app on the real device? Even publish the app?
Thanks!

How input in a string a XML content:encode

How input in a string a XML content:encode

I have this XML
<rss>
<channel>
<item>
<title>
Title content
</title>
<link>
http://www2.XXXXXX
</link>
<dc:creator>YYYYY</dc:creator>
<category>FFFFF</category>
<description>
<![CDATA[<P>O XXXXX (...)]]>
</description>
<content:encoded>
<![CDATA[<P>O XXXXXXX XXXXXXXXXX XXXXX XXXXX XXXXX XXXXXXXXXX XXXXX
XXXXX</P>]]>
</content:encoded>
</item>
....
I use this code to read this XML, and I want get the content value from XML
$rawFeed = (file_get_contents($url_feed));
$xmldoc = new SimpleXmlElement($rawFeed);
foreach ($xmldoc->channel->item as $xmlinfo){
$title = $xmlinfo->title);
$content = $xmlinfo->content);
}
The problem is: I can recover the string $title = 'Title content', but I
cant return in a string $content
PS: I try use content:encoded, but doesn't work too
PS2. when I print_r($xmlinfo), I get
SimpleXMLElement Object ( [title] => TITLE XXXXXX [link] =>
http://www2.XXXXX.php? [category] => YYY [description] =>
SimpleXMLElement Object ( ) )

Android R file not building when declare-styleable of type enum is added

Android R file not building when declare-styleable of type enum is added

Recently my Android workspace isn't compiling correctly anymore (the R
file isn't created). After trying the usual like cleaning i started
searching deeper. I discovered that when i comment out the items int my
attrs.xml file of the type declare-styleable with the format="enum" the R
file is build but not when they are present (not commented out). Is there
a recent change or something with the way you have the declare enums or
something? Here a piece of the project
working
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SwipeListView">
<attr name="swipeOpenOnLongPress" format="boolean" />
<attr name="swipeAnimationTime" format="integer" />
<attr name="swipeOffsetLeft" format="dimension" />
<attr name="swipeOffsetRight" format="dimension" />
<attr name="swipeCloseAllItemsWhenMoveList" format="boolean" />
<attr name="swipeFrontView" format="reference" />
<attr name="swipeBackView" format="reference" />
<!-- <attr name="swipeMode" format="enum"> -->
<!-- <enum name="none" value="0" /> -->
<!-- <enum name="both" value="1" /> -->
<!-- <enum name="right" value="2" /> -->
<!-- <enum name="left" value="3" /> -->
<!-- </attr> -->
<!-- <attr name="swipeActionLeft" format="enum"> -->
<!-- <enum name="reveal" value="0" /> -->
<!-- <enum name="dismiss" value="1" /> -->
<!-- <enum name="choice" value="2" /> -->
<!-- </attr> -->
<!-- <attr name="swipeActionRight" format="enum"> -->
<!-- <enum name="reveal" value="0" /> -->
<!-- <enum name="dismiss" value="1" /> -->
<!-- <enum name="choice" value="2" /> -->
<!-- </attr> -->
<!-- <attr name="swipeDrawableChecked" format="reference" /> -->
<!-- <attr name="swipeDrawableUnchecked" format="reference" /> -->
</declare-styleable>
</resources>
not working
<?xml version="1.0" encoding="utf-8"?>
<declare-styleable name="SwipeListView">
<attr name="swipeOpenOnLongPress" format="boolean" />
<attr name="swipeAnimationTime" format="integer" />
<attr name="swipeOffsetLeft" format="dimension" />
<attr name="swipeOffsetRight" format="dimension" />
<attr name="swipeCloseAllItemsWhenMoveList" format="boolean" />
<attr name="swipeFrontView" format="reference" />
<attr name="swipeBackView" format="reference" />
<attr name="swipeMode" format="enum">
<enum name="none" value="0" />
<enum name="both" value="1" />
<enum name="right" value="2" />
<enum name="left" value="3" />
</attr>
<attr name="swipeActionLeft" format="enum">
<enum name="reveal" value="0" />
<enum name="dismiss" value="1" />
<enum name="choice" value="2" />
</attr>
<attr name="swipeActionRight" format="enum">
<enum name="reveal" value="0" />
<enum name="dismiss" value="1" />
<enum name="choice" value="2" />
</attr>
<attr name="swipeDrawableChecked" format="reference" />
<attr name="swipeDrawableUnchecked" format="reference" />
</declare-styleable>

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.

custom control to select coordinates on a picturebox or panel?

custom control to select coordinates on a picturebox or panel?

I'm working on an application to display DICOM Files and now I'm getting
into MPR. Is there a control that will allow you to have like a line in a
picturebox or panel like this:
http://www.vcreatelogic.com/docs/gcf-2.6.0/html/MPRView.jpg The intention
is to move that line and perform some stuff while is moving, so I
basically need some sort of control or custom control (or maybe a custom
icon) that will allow the user to see where he's moving in the picturebox
as he moves the mouse.
Thank you!

How insert a image in canvas and after insert text in these canvas

How insert a image in canvas and after insert text in these canvas

I'm trying to insert a image in a canvas and after I want to insert a
input text in the same canvas but I cant do it, Anybody can help me?
thanks.

How to delete item in php

How to delete item in php

I have a problem in delete item. My problem is when I click on delete the
button the item does not disappear but when I refresh it it does
disappear.
And this is my code :
index.php
<?php
$config = mysql_connect("localhost", "root", "") or die (mysql_error());
$db = mysql_select_db("darith_upload_img",$config) or die
(mysql_error());
?>
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<form action="upload_process.php" enctype="multipart/form-data"
method="POST">
<input type="file" name="img" /><br />
<input type="submit" value="upload Now" />
</form>
<?php
$result = mysql_query("SELECT * FROM table_img");
while($row = mysql_fetch_array($result))
{
$id = $row['id_img'];
?>
<table border="1">
<tr>
<td><?php echo $row['id_img']; ?></td>
<td width="200" ><?php echo $row['location_img'];
?></td>
<td><?php echo '<img src="' . $row['location_img']
. '" width="60"/>'; ?></td>
<td><a href="index.php?id=<?php echo $id;?> "
onClick="return confirm('Are you
sure?')">Delete</a></td>
</tr>
</table>
<?php
}
?>
<?php
if(isset($_GET['id'])){
$id_img=$_GET['id'];
$q_del=mysql_query("DELETE FROM table_img where id_img
='$id_img'");
header("location:index.php");
}
?>
</body>
</html>
upload_process.php
<?php
$config = mysql_connect("localhost", "root", "") or die (mysql_error());
$db = mysql_select_db("darith_upload_img", $config) or die
(mysql_error());
if(isset($_FILES["img"]["tmp_name"]))
{
move_uploaded_file($_FILES["img"]["tmp_name"], "picture/".
$_FILES["img"]["name"]);
$location = "picture/".$_FILES["img"]["name"];
$save = mysql_query("INSERT INTO table_img (location_img) VALUES
('$location')");
header("location:index.php");
}
exit();
?>

Friday, 30 August 2013

Loop, Read stops after one record with GUI (doesn't loop)

Loop, Read stops after one record with GUI (doesn't loop)

I have a script for entering records in our system that was originally
working fine with a MsgBox, but I added a GUI to show the record entry.
Now the script stops after the first record.
In the example below I've stripped out all of the actions and record lines
to help make this easier to parse, but I've kept in all the important
stuff and tested this version of the script.
Loop, read, C:\_AutoHotKey\AA_test.txt
{
StringSplit, LineArray, A_LoopReadLine, %A_Tab%
aaduedate := LineArray1
aauniqueid := LineArray2
aaprefix := LineArray3
aasequence := LineArray4
aadescript := LineArray5
aaelig := LineArray6
;-------------------------------------------------------------------------------------
;Use these to test the file match in the Input File.
;Remove surrounding comments and surround the rest of the script up to the
last brace.
SendInput, Prefix: %aaprefix% {enter}
SendInput, Sequence: %aasequence% {enter}
SendInput, Description: %aadescript% {enter}
SendInput, Eligibility: %aaelig% {enter}
SendInput, ID Card: %aaidcard% {enter}
;---------------------------------------------------------------------------------------
;Pop-up validation menu
Gui, Add, Button, x22 y380 w100 h30 , &Submit
Gui, Add, Button, x362 y380 w100 h30 , &Cancel
Gui, Font, S14 CDefault, Verdana
Gui, Add, Text, x152 y10 w210 h30 +Center, Is the entry correct?
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x102 y40 w90 h20 , %aaprefix%
Gui, Add, Text, x102 y70 w130 h20 , %aaelig%
Gui, Add, Text, x312 y70 w30 h20 , %aadescript%
Gui, Add, Text, x432 y70 w30 h20 , %aaidcard%
Gui, Font, S8 CDefault, Verdana
Gui, Add, Text, x132 y380 w230 h40 +Center, Click Submit/press S to
continue. Click cancel to stop script.
; Generated using SmartGUI Creator 4.0
Gui, Show, x9 y250 h428 w480, Auto Action Validation
Return
ButtonCancel:
ExitApp
ButtonSubmit:
Gui, Submit ;
MouseMove, 630,55
Sleep, 100
SendInput, {Click 630,55}
SendInput ^S
Return
}
The buttons do work and clicking Submit will send the MouseMove and
SendInput. But after that it just stops and doesn't load the next record
in the text file.
Thanks in advance!

Thursday, 29 August 2013

StackOverFlow WCF&JSON Example not working, no endpoint

StackOverFlow WCF&JSON Example not working, no endpoint

guys. My question arises from an older post: Send JSON to WCF 3.5 using Ajax
On that page, the second answer was accepted with some modifications. I
created a project using VS2012 under windows 7 PC, and basically did
copy-and-paste. However, I found it not working properly. As I opened it
in IE, it gave a message of "no endpoint found" I did some search and
didn't find where the problem could be.
Class name and file structure are same as the code posted on the page I
referred to. Could you guys give some hints of what it could be? Thanks in
advance.

How do I bulk insert two datatables that have an Identity relationship

How do I bulk insert two datatables that have an Identity relationship

I'm using SQLBulkCopy, in pseudocode I do this:
make new Employee datatable make new EmployeeAddress datatable populate
employee table but don't specificy employeeId as it's identity
populate EmployeeAddress datatable, but it contains an employeeId field
write both datatables to the database by doing this twice and changing the
table name:
using (var bulk = new SqlBulkCopy(connectionString,
SqlBulkCopyOptions.KeepIdentity & SqlBulkCopyOptions.KeepNulls))
{
bulk.BatchSize = 25;
bulk.DestinationTableName = "Employee";
bulk.WriteToServer(employeeDataTable);
}
How can I specify the employeeId in the 2nd datable so that it aligns
correctly to the employee that was inserted the first time? The way I read
the data is that I read the employee and the address together, so
inserting all of the employees then going back and inserting all of the
addresses is a bit of a pain.
I was wondering if there was an elegant solution?

When iam trying to run spring example i am facing the following exception

When iam trying to run spring example i am facing the following exception

SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [spring.test.StockValueFetcher] for bean with name 'stockBean'
defined in ServletContext resource [/WEB-INF/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
spring.test.StockValueFetcher
and my applicationContext.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="stockBean" class="spring.test.StockValueFetcher">
</bean>
</beans>
i have searched for the same in stackoverflow and other sites but i
couldnot find any helpful solution

Wednesday, 28 August 2013

Build errors in eclipse

Build errors in eclipse

i have a big problem, i can't compile my eclipse projects.
Idon't understand whta is the problem. I have already searched for answer
but i stay helpless!
Hier the build error in eclipse:

Thank you!

how to update an event in fullCalendar?

how to update an event in fullCalendar?

I want to update my json in fullcalendar, Here is what I am exactly trying
to do. I have a JSON string which I am directly trying to feed in to the
event objects in the full calendar.
-->
var JSON[
{
"id": "1", // Optional
"title": "Demo event", // Required
"start": "2013-08-28 10:20:00", // Required
"end": "2013-08-28 11:00:00", // Optional
"allDay": false, // Optional
"url": "http://google.com", // Optional, will not open because of
browser-iframe security issues
"className": "test-class", // Optional
"editable": true, // Optional
"color": "yellow", // Optional
"borderColor": "red", // Optional
"backgroundColor": "yellow", // Optional
"textColor": "green" // Optional
},
{
"id": "2", // Optional
"title": "Demo event 2", // Required
"start": "2013-08-27 10:20:00", // Required
"end": "2013-08-27 11:00:00", // Optional
"allDay": false, // Optional
"url": "http://google.com", // Optional, will not open because of
browser-iframe security issues
"className": "test-class", // Optional
"editable": true, // Optional
"color": "yellow", // Optional
"borderColor": "red", // Optional
"backgroundColor": "yellow", // Optional
"textColor": "green" // Optional
}
];
,
Then I want to modify the JSON on some drop down event (not shown in the
fiddle) to a new string and try to get the new event on the calendar.
The fullCalendar does not take effect.
http://jsfiddle.net/pratik24/u8Ksw/28/
Thanks for the help. appreciate it.

Finding currently open browser (firefox) windows with Watir

Finding currently open browser (firefox) windows with Watir

I'm trying to write a script that will look for and use a browser window
(it can be either IE or Firefox) that is already opened before the script
is executed. The attach method works for IE, but it can't with Firefox.
browser = Watir::Browser.attach(:url, /url.com/)
Using Watir-Webdriver I tried the window switching trick posted elsewhere,
but that only seems to work when you clicked a link from the original
browser window. It can't seem to find a window that was already opened
before the script is run.
The user community on blogs elsewhere tell me this is only possible with
IE and using watir and not watir-webdriver. There's an issue opened at the
selenium issue tracker for webdriver, but it's been open for quite a
while. https://code.google.com/p/selenium/issues/detail?id=18
I'm hoping there's a workaround out there. Any ideas? Thanks in advance.
(PS - If this was solved in a prior post, I must have missed it. Apologies
for the repetition and please just point me to where. Thanks.)
-Mark

How can I look up by index within an ng-repeat?

How can I look up by index within an ng-repeat?

In my view, I have:
<div class="grid-wrapper grid-view type-A has-thumbnail" ng-repeat="artist
in artists">
So artist.id has an id for that artist.
I have another object called album_artists that looks like:
album_artists = {
'1231': {
...
},
'1232': {
...
}
}
So within my div, I want to get thealbum_artiststhat corresponds to a
particularartist.id`. How can I do this?

Activity indicator not hiding when webpage is loaded.

Activity indicator not hiding when webpage is loaded.

The activity indicator isn't hiding when the web page has finished
loading. Here is my
.h file
@interface PropertyViewController : UIViewController{
IBOutlet UIWebView *propertyNexusHome;
IBOutlet UIActivityIndicatorView *wheel;
NSTimer *timer;
}
.m file
- (void)viewDidLoad
{
[super viewDidLoad];
[property loadRequest:[NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.google.com"]]];
[property addSubview:wheel];
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0)
target:self
selector:@selector(loading)
userInfo:nil
repeats:YES];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)loading {
if (!property.loading)
[wheel stopAnimating];
else
[wheel startAnimating];
}
@end
Im not sure why its not disappearing, how ever it does stop spinning when
the page has loaded.
Thanks in advance.

Is it possible to execute a method before and after all tests in the assembly?

Is it possible to execute a method before and after all tests in the
assembly?

I would like to built an nunit project for selenium ui automation. I would
like to sign in to the site before running all tests (all of them) and to
close the browser after running all tests (all of them).
I can't use the SetUp since it related to fixtures and I want to do it
before and after everything.
Do you know who to execute it?

Asterisk cron page/intercom script

Asterisk cron page/intercom script

Wanting to send a page/intercom message to a group of VoIP phones as
specified intervals.
Is it possible to schedule asterisk to send a page/intercom via cron or
some other method? What would be the best way to do it?

Tuesday, 27 August 2013

Using ffmpeg, can I burn in subtitles directly from an mkv subtitle track instead of a subtitle file?

Using ffmpeg, can I burn in subtitles directly from an mkv subtitle track
instead of a subtitle file?

I have an mkv with multiple subtitle streams. I know I can use mkvextract
to extract one of those subtitle streams to a file, for example, sub.srt.
I can then burn those subtitles into the new video with ffmpeg like so:
ffmpeg -i video.mkv -vf subtitles=sub.srt out.mp4
I also know I can use -map to select video, audio, and subtitle tracks and
encode those into the new video, again something like so:
ffmpeg -i video.mkv -map 0:0 -map 0:1 -map 0:4 -c:v copy -c:a copy -c:s
copy out.mp4
However, what I can't figure out is how to transcode a video and burn in
the subtitles into the new file (not just adding a subtitle track, but
burning them into the video) not by reading it from a subtitle file but
directly from the old video stream itself.
Any ideas?

Ms access SQL grrrrrr

Ms access SQL grrrrrr

I'm trying to use access to run a query. My problem is that I have 2
tables and both tables don't contain the same information. Table1 contain
userid and email address for one database and Table 2 contains login Id
and smtp address for another database. Exp... User id is billybob and
email is billybob@gmail.com. Table 2 login is billy.bob and smtp address
billy.bob@yahoo.com. Now I have a list of over 1k users but not everyone
has 2 email address. I want the list of only users who have more then 1
email address. What do I need to do.

Executing s4 methods for all classes of an object?

Executing s4 methods for all classes of an object?

I have an object C which inherits class B which inherits class A, along
with a method for each class, e.g.,
setClass("A", representation(a = 'numeric'))
setClass("B", representation(b = 'numeric'), contains="A")
setClass("C", representation(c = 'numeric'), contains="B")
and methods
setGeneric("toXML", function(obj, node) standardGeneric("toXML"))
setMethod("toXML",
signature("A", "XMLInternalElementNode"),
function(obj, node) addAttributes(node, a = obj@a))
setMethod("toXML",
signature("B", "XMLInternalElementNode"),
function(obj, node) addAttributes(node, b = obj@b))
setMethod("toXML",
signature("C", "XMLInternalElementNode"),
function(obj, node) addAttributes(node, c = obj@c))
That is, each class represents a possible attribute an XML node can have.
I want to write a method (or coercion) that would perform these functions
for all matching classes.
Of course the way I've written it, doing
library(XML)
obj <- new("C", a = 1, b = 2, c = 3)
toXML(obj, newXMLNode("node"))
Just returns:
<node c="3"/>
Instead of
<node a="1" b="2" c="3"/>
What would be a good way to go about this?

Resr Webservice : java.lang.AbstractMethodError

Resr Webservice : java.lang.AbstractMethodError

I am new in web service. I try to using jax.ws.. web service with jersey
and spring. When i try to send the request using Chrome Post Client or
CURL in windows, following stack trace occur.
SEVERE: Servlet.service() for servlet [jersey-serlvet] in context with
path [/rest] threw exception [Servlet execution threw an exception] with
root cause
java.lang.AbstractMethodError
at
org.codehaus.jackson.map.AnnotationIntrospector$Pair.findDeserializer(AnnotationIntrospector.java:1335)
at
org.codehaus.jackson.map.deser.BasicDeserializerFactory.findDeserializerFromAnnotation(BasicDeserializerFactory.java:675)
at
org.codehaus.jackson.map.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:535)
at
org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:432)
at
org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:341)
at
org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:321)
at
org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:167)
at
org.codehaus.jackson.map.deser.StdDeserializerProvider.findTypedValueDeserializer(StdDeserializerProvider.java:188)
at
org.codehaus.jackson.map.ObjectMapper._findRootDeserializer(ObjectMapper.java:2820)
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2690)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1308)
at
org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
..............................
Following is the code of my example :
@Path("/loginPoint")
@Service
public class UserService {
@Resource(name= "commanUserService")
private CommanUserService commanUserService;
@POST
@Path("/login")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response login(LoginRequest request){
System.out.println("Hello In web Services >>>>>>>>>>>>>>>>>>>>>>>>> ");
LoginResponse response =
commanUserService.getUserloginInformation(request);
return Response.status(Status.OK).entity(response).build();
}
}
LoginRequest.java file code :
@XmlRootElement(name="loginRequest")
public class LoginRequest {
private String userName;
private String password;
@XmlElement("userName")
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@XmlElement("password")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
I suppose that problem is in mapping JSON request parameters with
LoginRequest entity, but i am not sure.

Python - remove known character

Python - remove known character

new to python so was hoping for some help. Trying to build a function (so
far sadly failing), it's purpose is to remove a specified letter from the
word and then return the result.
Example:
word_func('bird', 'b')
the returned result would then give 'ird' with the b dropped.
The function I'm starting again with is:
def word_func('word', 'letter'):
Any help would be appreciated. I think I'm overcomplicating this in my head.

RAXO All-mode PRO instead simple article on home page JOOMLA

RAXO All-mode PRO instead simple article on home page JOOMLA

HI I have problem to change content display into my hompage. I need change
simple atricles categories display to something like RAXO All-mode PRO.
But I don't know how to insert this modul into content on home page. I
using Joomla 3.x
If it's impossible, maybe somebody know about component which show
articles categories better than conventional.

Monday, 26 August 2013

using JQuery to change a second drop down selection box from mysql DB

using JQuery to change a second drop down selection box from mysql DB

I am trying to get the second dropdown box to change and populate when the
first box has a car Make chosen. It connects to the database just fine,
and if I type 'Honda' instead of 'carmake3' in the second dropdown, then
it gives me a list of all the honda cars. I just need to work based on
what the user selects. Any help would be extremely appreciated!
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<form action="step-3" method="post">
Car 3
</div>
<?php
mysql_connect('localhost', '**********', '**********');
mysql_select_db('**********');
$sql = "SELECT Make FROM CarMakes";
$result = mysql_query($sql);
echo "<select name='carmake3'>";
echo "<option value='Make'>Make</option>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['Make'] . "'>" . $row['Make'] .
"</option>";}
echo "</select>";
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('carmodel3').change(function() {
jQuery('carmake3').change();
});
});
</script>
<?php
mysql_connect('localhost', '**********', '**********');
mysql_select_db('**********');
$sql1 = "SELECT * FROM myTable WHERE Make='carmake3'";
$result1 = mysql_query($sql1);
echo "<select name='carmodel3'>";
echo "<option value='Model'>Model</option>";
while ($row = mysql_fetch_array($result1)) {
echo "<option value='" . $row['Model'] . "'>" . $row['Model'] .
"</option>";}
echo "</select>";
?>
<input type="text" maxlength="4" name="car3year" placeholder="year"
class="WriteInBox"/>
<input type="text" maxlength="6" name="car3miles" placeholder="miles"
class="WriteInBox"/>
</div>
</form>

VBA Compile Error: Procedure too long

VBA Compile Error: Procedure too long

How could I shorten this code? Forgive me for bad coding practices I'm
self taught and pretty much a noob.
The code is comprised of 199 "Elseif" statements, I don't know any other
way to write what i'm trying to do.
Sub CopytoRoutine()
If Sheets("iPhone view").Range("A2") = Sheets("Routine").Range("B9") And
Sheets("iPhone view").Range("A3") = Sheets("Routine").Range("C7") Then
Range("A5:B5").Select
Selection.Copy
Sheets("Routine").Select
Range("C9:D9").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=FalseL
ElseIf Sheets(iPhone view).Range(A2) = Sheets(Routine).Range(B10) And
Sheets(iPhone view).Range(A3) = Sheets(Routine).Range(C7) Then
Range(A5:B5).Select
Selection.Copy
Sheets(Routine).Select
Range(C10:D10).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False
ElseIf Sheets(iPhone view).Range(A2) = Sheets(Routine).Range(B11) And
Sheets(iPhone view).Range(A3) = Sheets(Routine).Range(C7) Then
Range(A5:B5).Select
Selection.Copy
Sheets(Routine).Select
Range(C11:D11).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False
ElseIf Sheets(iPhone view).Range(A2) = Sheets(Routine).Range(B12) And
Sheets(iPhone view).Range(A3) = Sheets(Routine).Range(C7) Then
Range(A5:B5).Select
Selection.Copy
Sheets(Routine).Select
Range(C12:D12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False
ElseIf Sheets(iPhone view).Range(A2) = Sheets(Routine).Range(B13) And
Sheets(iPhone view).Range(A3) = Sheets(Routine).Range(C7) Then
Range(A5:B5).Select
Selection.Copy
Sheets(Routine).Select
Range(C13:D13).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False
ElseIf Sheets(iPhone view).Range(A2) = Sheets(Routine).Range(B14) And
Sheets(iPhone view).Range(A3) = Sheets(Routine).Range(C7) Then
Range(A5:B5).Select
Selection.Copy
Sheets(Routine).Select
Range(C14:D14).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False
ElseIf Sheets(iPhone view).Range(A2) = Sheets(Routine).Range(B15) And
Sheets(iPhone view).Range(A3) = Sheets(Routine).Range(C7) Then
Range(A5:B5).Select
Selection.Copy
Sheets(Routine).Select
Range(C15:D15).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
True, Transpose:=False
/code/pre
pSheets(Routine).Range(Bx) Where x= 9-29/p
pSheets(Routine).Range(C7), this range changes to G7,K7,O7,S7,...AM7. when
the above gets to B29/p
pThe column letter for Range(C9:D9).Select changes respectively with the
above, so do the row numbers/p

Autocomplete suggests text multiple times

Autocomplete suggests text multiple times

I'm novice programmer and I have problem with autocomplete. At this moment
it suggest text when it's in database, but when I add multiple records
with same text it suggest same text multiple times. Any idea what should I
do?
Here's fragment of code:
adapter.setCursorToStringConverter(new CursorToStringConverter() {
public String convertToString(android.database.Cursor cursor) {
final int columnIndex =
cursor.getColumnIndexOrThrow(DatabaseHelper.LESSONS_SUBJECT);
final String str = cursor.getString(columnIndex);
return str;
}
});
adapter.setFilterQueryProvider(new FilterQueryProvider() {
public Cursor runQuery(CharSequence constraint) {
String[] projection = new String[] {
DatabaseHelper.LESSONS_ID, DatabaseHelper.LESSONS_SUBJECT };
String selection = DatabaseHelper.LESSONS_SUBJECT + " LIKE '"
+ constraint + "%'";
Cursor cursor =
getActivity().getContentResolver().query(DatabaseManager.CONTENT_URI_LESSONS,
projection,
selection, null, null);
return cursor;
}
});
Feel free to ask for more code if you need it to solve this problem.
Screenshot:

How to set up CSS/JS cache busting using PHP and Git on high traffic site?

How to set up CSS/JS cache busting using PHP and Git on high traffic site?

I need to set up cache busting for CSS/JS on a high traffic site that uses
PHP and Git.
I know how to get the current Git version using "git describe --tags
--always". I need to do this so PHP will cache this value and only run
every 5 minutes or so. How can this be done?

Set Eclipse in my computer

Set Eclipse in my computer

when i setup eclipse it need to download sdk tools and sdk platform and
Google APIs in Android SDK Manager and the there is no Internet in this
computer How can i take this tools from another computer ?

How to improve performance of UICollectionView with custom cell sizes?

How to improve performance of UICollectionView with custom cell sizes?

As the user types, I am retrieving results (text) by traversing a local
word graph in a background thread. Each keystroke cancels the previous
operation. If the operation completes, the data source is updated and
reloadData is called on the main thread. This works great and is very fast
(as fast as the user can type), even when tens of thousands of results are
returned.
To customize the size of each collection view cell, I implemented
sizeForItemAtIndexPath for the UICollectionViewDelegateFlowLayout
delegate. Unfortunately, this results in a small, but noticeable lag when
the user types. To be sure the time was not lost in my size calculation
logic, I tried just returning a fixed size, but it still killed
performance. I am surprised at this because there are only ~120 cells or
so on the screen at any given time. When commenting out this method, the
response time is again immediate, even for very large data sets.
Any ideas for improving the performance of UICollectionView with custom
cell sizes?
Thanks

Ajax request extremely slow

Ajax request extremely slow

I don't know why, but my Javascript is extremely slow and takes like five
minutes to finish properly, you sometimes refresh the pages and some
requests haven't been processed.
I already used async:true hoping that it will process a little bit faster
but it doesn't. Here's the code I am using to save each element on inside
#myspace.
cn = document.getElementById("myspace").childNodes;
for (var t = 0; t < cn.length; t++) {
if (cn[t].nodeType == 1) {
var n = {
id: cn[t].id,
left: cn[t].style.left,
top: cn[t].style.top
};
$.ajax({
data: n,
url:
"/Application/Ajax/__ajaxProfile.php?a=SavePosition",
type: "post",
cache: true,
async: true,
success: function (e) {}
})
}
}
e("Please wait for everything to save, it might take more than a
minute.");
setInterval(function () {
if ($.active == 0) {
$('#close-modal').show();
}
}, 10);
Anyone knows why it's been processed so slowly and a decent solution for
this?

Looking for a free DNN community edition website Backup and restore procedure working with DNN 7 and SQL server express 2008 r2

Looking for a free DNN community edition website Backup and restore
procedure working with DNN 7 and SQL server express 2008 r2

I am looking for a free DNN community edition website Backup and restore
procedure working with DNN 7 and SQL server express 2008 r2.
I usually design and develop website in local PC as my connection speed to
the actual server is low. And then I want to publish (deploy) the result
in the server. I may need to repeat this procedure a few times as our
website is always under development and I need to add new pages or update
the existing ones.
I use DNN 7 community edition. I have already googled and have found
plenty of commercial tools for this backup and restore. But the free
methods seems to be 1. old or 2. not working properly or 3. not a straight
forward procedure or 4. very buggy.
I have gone e.g. through the 4 links given in
http://www.dnnsoftware.com/community-blog/cid/134680/HOW-TO-Move-a-DotNetNuke-installation
without any success.
Could you please help me 1. how I could develop my website in local PC and
then upload the result in the server? 2. And later after adding a few new
pages in the local PC how I could sync the result with the server?
Thank you very much in advance for your help and consideration.

Sunday, 25 August 2013

Zend PDF Via Zend Form Button

Zend PDF Via Zend Form Button

I have been trying to get a button in a Zend form to trigger a custom
Library class that builds a PDF (extending Zend_pdf) when a user clicks on
a specific button in a form.
For some reason when it adds a new PdfBuilder(); it does not fail, nor
does it trigger any error_logging despite asking it.
I believe I may have missed a link somewhere in this process and any help
would be greatly appreciated.
I am trying to get it to view in a new window instead of saving it as it
is up to the user if they want it.

[ Video & Online Games ] Open Question : Dragonvale experts, What is the easiest way to breed a Moon dragon?

[ Video & Online Games ] Open Question : Dragonvale experts, What is the
easiest way to breed a Moon dragon?

These are the dragons I have: Willow, Cactus,Poison,
Plant,Earth,Water,Fire,Lava,Blazing,Ash,Lightning,Air,Storm,Cold,and
Evergreen.

Differences between optimize table and copy to the new table

Differences between optimize table and copy to the new table

I have an INNODB table which is quite big because of frequent updates. Now
i want to run the optimize table for this table to get back the disk
space. However, i can also create a new table and copy the entire old
table to the new one.
So, is there any difference in term of performance between the 2 methods?
If i copy the old table to the old one, will the entire old table be
locked during this operation?
Thank you very much.

Saturday, 24 August 2013

hostname + path based proxy routing using nodejitsu/node-http-proxy ( nodejs )

hostname + path based proxy routing using nodejitsu/node-http-proxy (
nodejs )

I am in the process of setting up a blog ( foo.com/blog ) ,as well as a
homepage ( foo.com ) for my domain foo.com , I am using
nodejitsu/node-http-proxy for this and nodejs on a windows 2003 server.
I plan to run 3 individual nodejs processes for this. The first one being
the proxy which will route the request to local nodes on 83 and 82.
However with the below options routing table , even if I goto foo.com/blog
or foo.com , it always directs to foo.com on 82. Why is this happening ,
or does this particular nodejitsu/node-http-proxy consider only the
hostname ?
var http = require('http'),
httpProxy = require('http-proxy');
var options = {
router: {
'foo.com/blog': '127.0.0.1:83',
'foo.com': '127.0.0.1:82'
}
};
var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);

Galaxy s4 mtp on 13.04

Galaxy s4 mtp on 13.04

OK, so when I plug my phone via usb, it pops up and displays
SAMSUNG_Android on the sidebar, but when I click on it, it only says
unable to mount MTP device [usb:002/004]
I've searched and found fixes for 12.10 but none have worked on 13.04 for me.
Any suggestions?
Thanks everyone!

C# Double buffering causes lag on paint

C# Double buffering causes lag on paint

I've been making an application in C# which is designed to mimic the
appearance and behavior of Windows' Snipping Tool application. Everything
is fine, except the fact that double buffering (to stop the screen
flickering) appears slow and laggy. It's not much lag, but it's enough to
be noticeable especially when comparing the performance between my program
and Snipping Tool. What else can I do to improve the performance and make
it seem like there's no lag, like in Snipping Tool?
public Image Image { get; set; }
private Rectangle selection;
private Point startPoint;
public static Image Snip()
{
using (var bmp = new Bitmap(SystemInformation.VirtualScreen.Width,
SystemInformation.VirtualScreen.Height,
System.Drawing.Imaging.PixelFormat.Format32bppPArgb))
{
using (var graphics = Graphics.FromImage(bmp))
graphics.CopyFromScreen(SystemInformation.VirtualScreen.Left,
SystemInformation.VirtualScreen.Top, 0, 0, bmp.Size);
using (var snipper = new CaptureScreen(bmp, new
Point(SystemInformation.VirtualScreen.Left,
SystemInformation.VirtualScreen.Top)))
{
if (snipper.ShowDialog() == DialogResult.OK) return
snipper.Image;
}
return null;
}
}
public CaptureScreen(Image screenShot, Point startPos)
{
InitializeComponent();
Cursor = Cursors.Cross;
BackgroundImage = screenShot;
ShowInTaskbar = false;
FormBorderStyle = FormBorderStyle.None;
StartPosition = FormStartPosition.Manual;
Size = screenShot.Size;
Location = startPos;
SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
}
protected override void OnMouseDown(MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
startPoint = e.Location;
selection = new Rectangle(e.Location, new Size(0, 0));
Invalidate();
}
protected override void OnMouseMove(MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
var x1 = Math.Min(e.X, startPoint.X);
var y1 = Math.Min(e.Y, startPoint.Y);
var x2 = Math.Max(e.X, startPoint.X);
var y2 = Math.Max(e.Y, startPoint.Y);
selection = new Rectangle(x1, y1, x2 - x1, y2 - y1);
Invalidate();
}
protected override void OnMouseUp(MouseEventArgs e)
{
if (selection.Width <= 0 || selection.Height <= 0) return;
Image = new Bitmap(selection.Width, selection.Height);
using (var gr = Graphics.FromImage(Image))
{
gr.DrawImage(BackgroundImage, new Rectangle(0, 0, Image.Width,
Image.Height),
selection, GraphicsUnit.Pixel);
}
DialogResult = DialogResult.OK;
}
protected override void OnPaint(PaintEventArgs e)
{
using (var br = new SolidBrush(Color.FromArgb(127, Color.White)))
{
var x1 = selection.X;
var x2 = selection.X + selection.Width;
var y1 = selection.Y;
var y2 = selection.Y + selection.Height;
e.Graphics.FillRectangle(br, new Rectangle(0, 0, x1, Height));
e.Graphics.FillRectangle(br, new Rectangle(x2, 0, Width - x2,
Height));
e.Graphics.FillRectangle(br, new Rectangle(x1, 0, x2 - x1, y1));
e.Graphics.FillRectangle(br, new Rectangle(x1, y2, x2 - x1,
Height - y2));
}
using (var pen = new Pen(Color.Red, 1))
{
e.Graphics.DrawRectangle(pen, selection);
}
}

Rails 4 logs query parameters in development.log

Rails 4 logs query parameters in development.log

I noticed that after upgrade to Rails 4, some SQL statements have an array
of parameters after them in the log file, and some don't.
Example:
SELECT assets.* ... LIMIT 10 [["resource_id", 5551], ["resource_type",
"Event"]]
What is this information for and why a lot of other statements are listed
without such information, but just a raw query?

How to begin SVM

How to begin SVM

I know that SVM uses is for classification where the number of class is
only 2( {0, 1} or {yes, no} and so on). But i want to learn its basic from
scratch. I saw some papers like A User's Guide to Support Vector Machines,
But it need some basic information in mathematics fields Like Kernel
Method. My question is how I should start learn SVM. Which Basic knowledge
I need to learn before beginning SVM.

Using a variable outside foreach with if statement?

Using a variable outside foreach with if statement?

This code should explain it all..
foreach($this->sections as $k => $section){
$preview = array();
foreach ($section['fields'] as $k => $type) {
$preview[] = $type['type'];
}
if ($preview == 'header_preview'){
echo $preview;
// I will loop content here based on the $section loop NOT the
$type loop
}
}
I just need to get each $section['fields'] then outside that loop, which
again gets a list of all the $section['fields'] then use one of those
field types to create an if statement. The above is non working, I will
show you working code here.
foreach($this->sections as $k => $section){
foreach ($section['fields'] as $k => $type) {
if ($type['type'] == 'header_preview'){
//I work but im in a nested loop I need out
}
}
}
I hope this makes sense...

Clarification about the toString method within an ADT class

Clarification about the toString method within an ADT class

This is the modified toString function within the Complex ADT class that
i'm trying to implement (My doubt is only regarding this function so I
havent included the private variables declared before and the other
functions) :
class ComplexCart implements Complex{
public String toString(){
if(image == 0) return (real + "");
}
}
Why can't we write the following?
if(imag == 0) return(real);
Why do we need to add the additional "" ?

WPMU schedule doesn't execute actions

WPMU schedule doesn't execute actions

Here's a simple event that is correctly scheduled to be executed daily.
Unfortuantely, it doesn't execute delete_old_users() function daily. It is
supposed to delete users older than a certain date.
function delete_old_users() {
$old_users = get_site_option( 'old_users' );
foreach ( $old_users as $user_id => $expiration_time ) {
if ( $expiration_time <= gmmktime() ) {
wpmu_delete_user( $user_id );
}
}
return;
}
add_action( 'delete_old_users_daily', 'delete_old_users' );
function setup_schedule() {
if ( ! wp_next_scheduled( 'delete_old_users_daily' ) ) {
wp_schedule_event( time(), 'daily', 'delete_old_users_daily');
}
}
add_action( 'wp', 'setup_schedule' );
Is there anything I'm missing here? When I manually do do_action(
'delete_old_users_daily' ) it works. I'm out of ideas. It just doesn't
execute my action and I have no idea how to debug that.

Python class instance starts method in new thread

Python class instance starts method in new thread

I spent the last hour(s???) looking/googling for a way to have a class
start one of its methods in a new thread as soon as it is instanciated.
I could run something like this:
x = myClass()
def updater():
while True:
x.update()
sleep(0.01)
update_thread = Thread(target=updater)
update_thread.daemon = True
update_thread.start()
A more elegant way would be to have the class doing it in init when it is
instanciated. Imagine having 10 instances of that class... Until now I
couldn't find a (working) solution for this problem... The actual class is
a timer and the method is an update method that updates all the counter's
variables. As this class also has to run functions at a given time it is
important that the time updates won't be blocked by the main thread.
Any help is much appreciated. Thx in advance...

Friday, 23 August 2013

Highstock navigator padding issue

Highstock navigator padding issue

I am using Highstock charts with single series having flags on it where
x-axis is 'datetime' type and y-axis is any numerical value. Now initially
when chart loads I provide bit of padding on x-axis using attribute "max"
so that end point doesn't touch the edge (which is working fine) but as I
drag the navigator, the padding gets lost and the point touches the edge.
Is there any way of maintaining that padding on graph line even after I
drag the navigator?
Any help would be greatly appreciated...

NFL live free Watch Seattle Seahawks vs Green Bay Packers live streaming NFL Preseason NFL Football now online free TV

NFL live free Watch Seattle Seahawks vs Green Bay Packers live streaming
NFL Preseason NFL Football now online free TV

Welcome to Watch and enjoy the live telecast NFL Football Preseason match
between Seattle Seahawks vs Green Bay Packers Live Streaming NFL Football
HD Satellite TV Coverage. Now watch and enjoy Seattle Seahawks vs Green
Bay Packers Live Stream NFL Football to your PC Seattle Seahawks vs Green
Bay Packers Live online. Seattle Seahawks vs Green Bay Packers Live Online
Broadcast. Any where you can watch this exclusive match between Seattle
Seahawks vs Green Bay Packers Live without any additional software. JUST
FOLLOW OUR TV LINK PC, laptop, notebook, i phone, i pad, Android,
PlayStation, Safari, smartphone Linux, Apple, ios, Tablet etc, from this
site With HD quality.3500 satellite TV- TV on PC & MAC(OSX)!bundle the
ultimate TV experience with internet on all device 78 SPORTS + 3500
CHANNELS AVAILABLE, ANYWHERE, ANYTIME, 24 X 7. Watch NFL live Match Click
Here To: Watch Seattle Seahawks vs Green Bay Packers
http://watch-nfl-live-tv-link.blogspot.com/
http://watch-nfl-live-tv-link.blogspot.com/
Seattle Seahawks vs Green Bay Packers MATCH DETAILS Date : Friday, August
23, 2013 Competition: NFL live Live / Repeat:Live 8:00 pm EDT
How to Free watch Seattle Seahawks vs Green Bay Packers live NFL
Preseason, 2013 match online? If you can not follow the Seattle Seahawks
vs Green Bay Packers live game on your TV. NFL Live Stream Seattle
Seahawks vs Green Bay Packers. Live Streaming NFL Seattle Seahawks vs
Green Bay Packers. NFL Live Streaming Seattle Seahawks vs Green Bay
Packers. Don't worry you can still watch NFL Football games online from
your PC TV. You don't have to look else anywhere. JUST FOLLOW OUR LIVE TV
LINK on this page and enjoy watch your favorite TV channels. We offer you
to watch live internet broadcasting Sports TV Software from across the
world.
!HD! watch-live-tv-link HD
If you do not to miss the Great moment of National Football League Just
click Live stream link. It provides HDQ video and clear sound and Ensure
that you must be 100% satisfied in our services. So Watch Seattle Seahawks
vs Green Bay Packers live NFL Football. Seattle Seahawks vs Green Bay
Packers live. Seattle Seahawks vs Green Bay Packers live stream. Seattle
Seahawks vs Green Bay Packers live online. Seattle Seahawks vs Green Bay
Packers live online free broadcast. Seattle Seahawks vs Green Bay Packers
live online TV sop cast. Seattle Seahawks vs Green Bay Packers live online
TV telecast. Seattle Seahawks vs Green Bay Packers live MAC. Seattle
Seahawks vs Green Bay Packers live online podcast. Seattle Seahawks vs
Green Bay Packers live streaming National Football League. Seattle
Seahawks vs Green Bay Packers live HDQ online TV stream. Watch Live NFL
score Live. Watch Live NFL Game. Watch Live NFL Fantasy. Watch highlights
NFL-National Football League TV Stream. Live NFL Football Seattle Seahawks
vs Green Bay Packers live stream internet TV. Seattle Seahawks vs Green
Bay Packers live National Football League. Seattle Seahawks vs Green Bay
Packers live stream. Seattle Seahawks vs Green Bay Packers live stream
online. Exclusive NFL-National Football League Preseason Live Stream TV
Channel Seattle Seahawks vs Green Bay Packers. Seattle Seahawks vs Green
Bay Packers live. Seattle Seahawks vs Green Bay Packers live stream.
Seattle Seahawks vs Green Bay Packers live online. Seattle Seahawks vs
Green Bay Packers live streaming online NFL Football HD Satellite TV
Coverage. Seattle Seahawks vs Green Bay Packers live streaming online NFL
Football HD Satellite TV Broadcast. Live NFL-National Football League
internet TV Broadcast. Seattle Seahawks vs Green Bay Packers Live NFL
Soapcast Most Welcome To The Live NFL-National Football League World.
Enjoy full Season of NFL Football 2013 Live Streaming Matches Seattle
Seahawks vs Green Bay Packers Live streaming on-line television station on
computer. This is often most significant match for this season Seattle
Seahawks vs Green Bay Packers live streaming USA football. You'll Watch
Football live streaming Seattle Seahawks vs Green Bay Packers live TV
sports NFL Football match. Watch Live NFL Full Season On Your computer.

Laravel 4 pretty ulrs not working

Laravel 4 pretty ulrs not working

I'm using xampp 1.8.3.
My .htacces (in public folder)
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
All the "AllowOverride" of the httpd.conf are set to "All".
Uncommented:
LoadModule rewrite_module modules/mod_rewrite.so
I don't use virtualhosts (should I?).
/public/index.php/something works but /public/something don't.
What am I missing?

Import a data set from a website using read.table.

Import a data set from a website using read.table.

The data set is a rectangular dataset with the left column being number of
beers and the right column being bac.
And my code looks like this:
mydata =
read.table("http://courses.ncsu.edu/st512/lec/001/data/beer.txt",header=T)
And I get this error:
Error in read.table("http://courses.ncsu.edu/st512/lec/001/data/beer.txt", :
more columns than column names
I have no idea where this is getting tripped up. Please help?

Twitter bootstrap 3 - create a custom glyphicon and add to glyphicon "font"

Twitter bootstrap 3 - create a custom glyphicon and add to glyphicon "font"

Good people. I am running twitter bootstrap3, and I am extremely happy
with the new way it handles the icon as fonts. However: I need some custom
icons; I need to make them myself, and ideally integrate it into the
existing font. I have searched with no luck. I am well familiar with
illustrator, vector graphics etc, but how to integrate?
Worst case scenario, I will make images the traditional way, but hope
there is a better solution.
Any ideas?

make JDialog disappear after a few seconds

make JDialog disappear after a few seconds

I have a JDialog class:
public class Test extends JDialog {
private JPanel panel = new JPanel ( new BorderLayout() );
public Test () {
super(frame,"Evidenziatore");
setDefaultCloseOperation(HIDE_ON_CLOSE);
setVisible(true);
add( panel, BorderLayout.CENTER );
}
}
What I'd like to do is to make JDIalog disappear after user has exited
from that JDialog or from the JPanel for a few seconds, e.g. using
mouseEntered or mouseExited events or after user has clicked somewhere
else. I mean something like chrome or firefox search window, avaible using
ctrl-f.
How can I do that?
Thanks

Thursday, 22 August 2013

Pinterest could not fetch the image

Pinterest could not fetch the image

Trying to implement the "pin it" button but it returns the following
problem for every single image. We use SSL across the whole site and I'm
wondering if this is related.
Any idea?
{"route_pattern": "^/resource/:name/:method/$", "error":
{"api_error_code": 1, "message": "Sorry we could not fetch the image.",
"code": "API_ERROR", "target": "<webapp.resources.pin_resource.PinResource
object at 0xb851c50>", "http_status": 400}, "resource": {"name":
"PinResource", "options": {"board_id": "393150311159619967",
"description": "Kokeshi - Samoura\u00ef Bento", "link":
"https://bentooo.com/products/kokeshi-samourai-bento", "image_url":
"https://bentooo.com/upload/pictures/884/thumb/IMG_0704.jpg", "bookmarks":
["-end-"], "is_video": null, "method": "button"}}, "client_context":
{"app_version": "5bdef68"}, "resource_response": {"data": null, "error":
{"api_error_code": 1, "message": "Sorry we could not fetch the image.",
"code": "API_ERROR", "target": "<webapp.resources.pin_resource.PinResource
object at 0xb851c50>", "http_status": 400}}}

Autotrace in Ubuntu 12.04

Autotrace in Ubuntu 12.04

I am trying to trivially run Autotrace after installing it through "sudo
apt-get install autotrace". When I run it with a generic .bmp (>autotrace
test.bmp) I get the following error:
symbol lookup error: /usr/local/lib/libautotrace.so.3: undefined symbol:
acosf
Specifying input/output filetypes, output filename, and more detailed info
causes same error. I'm guessing that a math library isn't properly linked
and I'm missing something, but I really don't know where to begin (google
has returned anything I recognize as helpful). I was hoping aptitude would
have handled all of this for me.
My OS: 3.5.0-39-generic, Ubuntu 12.04.3 LTS.
Has anybody experienced this issue or have any advice using Autotrace in
Ubuntu?

ActionController::RoutingError: uninitialized constant MicropostsController

ActionController::RoutingError: uninitialized constant MicropostsController

This is my first contribution here, feedback on improving this or future
postings is appreciated :)
Ruby on Rails Tutorial: Learn Web Development with Rails (4)
http://ruby.railstutorial.org/book/ruby-on-rails-tutorial?version=4.0
While working through chapter 10.3, I got stuck. In the end, a misspelled
file name had me chasing ghosts for a few days.
$ rspec spec/requests/authentication_pages_spec.rb No DRb server is
running. Running in local process instead ... ...FF................
Failures:
1) Authentication authorization for non-signed-in users in the Microposts
controller submitting to the create action Failure/Error: before { post
microposts_path } ActionController::RoutingError: uninitialized constant
MicropostsController
./spec/requests/authentication_pages_spec.rb:93:in `block (6 levels) in '
2) Authentication authorization for non-signed-in users in the Microposts
controller submitting to the destroy action Failure/Error: before { delete
micropost_path(FactoryGirl.create(:micropost)) }
ActionController::RoutingError: uninitialized constant
MicropostsController
./spec/requests/authentication_pages_spec.rb:98:in `block (6 levels) in '
Finished in 0.92253 seconds 21 examples, 2 failures
Failed examples:
rspec ./spec/requests/authentication_pages_spec.rb:94 # Authentication
authorization for non-signed-in users in the Microposts controller
submitting to the create action rspec
./spec/requests/authentication_pages_spec.rb:99 # Authentication
authorization for non-signed-in users in the Microposts controller
submitting to the destroy action

Look forward to meeting you both vs. Look forward to meeting you

Look forward to meeting you both vs. Look forward to meeting you

I'm confused about the need to add the word "both", when you're using
"you" as a plural that refers to more than one individual.
The below sentence refers to two people (the "you") is as follows:
We look forward to meeting you this evening as well as getting to know you
both over the coming year.
Any comments / edits would be greatly appreciated!

Simplest way to determinize a C program

Simplest way to determinize a C program

Consider the C program below:
#include <stdio.h>
int f() {
printf("f");
return 1;
}
int g() {
printf("g");
return 2;
}
int main() {
return f() + g();
}
According to the C standard, this program does not have a single
deterministic behavior, due to the sum in the main function, which
consists in two subexpressions, and the following excerpt from the C99
standard:
§6.5 (...) the order of evaluation of subexpressions and the order in
which side effects take place are both unspecified.
Therefore, printing fg and gf are both valid outputs for this program. In
practice, a given compiler will choose a single fixed evaluation order
(e.g., left-to-right for gcc in this case), but if I want to reliably
compare the output among different compilers, I need to ensure my program
has a single defined behavior.
My question is: what is the simplest way to do it? Is there a way to avoid
including temporary variables (e.g., int tmp = f(); return tmp + g();)?

JQuery .ajax dont call function

JQuery .ajax dont call function

I have object "game" and when i call create game, its use jquery ajax...
everything works ok, but when i want to call from ajax success function
addLoadEvent it doesnt call it, when i try call this function from
createGame (commented part of code here) its works... do you know why i
cant call it from ajax success? i try console log from success and it was
print in console so ajax works well. Thank everybody for help
var game=new ttt_game();
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
function ttt_game () {
this.createGame = createGame;
function createGame(){
/*addLoadEvent(function(){
document.getElementById('player1_n').textContent=player1+':';
document.getElementById('player2_n').textContent=player2+':';
document.getElementById('turn').textContent='Èaká
sa na príchod súpera.';
});*/
$.ajax({
type: "POST",
url: "process.php",
data: {'function': 'create','game_id':
game_id,'player1': player1},
dataType: "json",
success: function(data){
addLoadEvent(function(){
document.getElementById('player1_n').textContent=player1+':';
document.getElementById('player2_n').textContent=player2+':';
document.getElementById('turn').textContent='Èaká
sa na príchod súpera.';
});
},
error: function(jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
}
game.createGame();

Can HTMLAgilityPack or something similar help me obtain data from these tables?

Can HTMLAgilityPack or something similar help me obtain data from these
tables?

We are facing an issue where we download thousands of XML files, and
embedded in those XML files are HTML(ish) tables that contain information
we need to extract and put into a database.
We made a first pass with LINQ to XML and while it worked for a large
portion of the tables, it became apparent that there is some variety in
how the tables are structured. The thing is, they are largely the same in
that they end up rendering as two columns, with the left side defining
criteria, and the right side defining sub criteria.
They differ in how they split up the sub criteria and how these relate too
the criteria. For the most part they follow the example of the second
table below, so that's relatively straight forward (each <p> in the second
column is a sub criteria), but some, such as the example table 1, use
rowspan/colspan and individual rows in the second column to define
individual sub criteria and this is much harder to parse using something
like LINQ to XML.
I've not used HTMLAgilityPack before, but is it possible to do something
like pass it the HTML of the table, and then extract rows of the first
column, then rows of the second column ? I'd then have to work out a way
of matching sub criteria to criteria. Alternatively, is there some other
tool other than HTMLAgilityPack that could be good for such a scenario?
<!-- Example table 1 -->
<html>
<table border="1">
<tr header="true" rowheight="0">
<td colspan="2"><p><cs id="24">CRITERIA</cs></p></td>
<td colspan="2"><p>SUB CRITERIA</p></td>
</tr>
<tr>
<td rowspan="2"><p>1</p></td>
<td rowspan="2"><p>CRITERIA 1.</p></td>
<td><p>1.1</p></td>
<td><p>SUB CRITERIA 1.1</p></td>
</tr>
<tr>
<td><p>1.2</p></td>
<td><p>SUB CRITERIA 1.2</p></td>
</tr>
</table>
<br /><br />
<!-- Example table 2 -->
<table border="1">
<tr>
<td><p>CRITERIA</p></td>
<td><p>SUB CRITERIA</p></td>
</tr>
<tr>
<td><p>1 CRITERIA 1</p></td>
<td>
<p>1.1 SUB CRITERIA 1.1</p>
<p>1.2 SUB CRITERIA 1.2</p>
</td>
</tr>
</table>
</html>

Wednesday, 21 August 2013

Companies that host Minecraft Servers -- Is 256M even realistic?

Companies that host Minecraft Servers -- Is 256M even realistic?

My kids wanted their server to be public. And rather than having to
forward ports through two routers and worry about keeping their computers
on 24/7, I decided to buy hosting through a company.
There are a LOT of companies offering cheap MC hosting, virtually all
offering a 256MB low-end option for "up to 4 players." However, within an
hour, the server was crashing due to being out of memory.
Is it realistic to run MC Server 1.6.2 with 256MB? And if not, what is a
reasonable amount of RAM? (I see Notch hasn't published any data here, but
I figured there are some experienced MC server admins on this forum who
could lend their insight.)

Content should easily fit in div (sticky footer), but is displayed with huge amounts of space in height

Content should easily fit in div (sticky footer), but is displayed with
huge amounts of space in height

I am making a sticky footer. The content should fit easily the height of
the div, but it doesn't. Huge spaces are displayed between lines, and rows
are also stretched (without me asking them to be) in height. Part of the
problem arises when I put at the start of the 'parenting' php file. When I
remove this declaration things are turning more as expected (yet not
completely). Does anyone know which fault I made in the CSS or HTML? Your
help is much appreciated!
This is the URL http://www.vergunningenboer.nl/1-ontwerp/01.php
This is the Sticky footer CSS:
#footer_container { bottom:0; height:260px; overflow:auto; left:0;
position:fixed; width:100%; }
#footer { line-height:260px; margin:0 auto; width:100%; opacity:1.0;
filter:alpha(opacity=100); }
This is the CSS for the table, the content for the footer:
table.icons { height:30px; cellpadding:2px; margin:0px 0px;
background-color:#000000; border:0px solid black; opacity:1.0;
filter:alpha(opacity=100); /* For IE8 and earlier */ }
And this is the HTML of the table, the content of the footer:
<!-- BEGIN: Sticky Footer -->
<div id="footer_container">
<div id="footer">
<h2>ontwerp</h2>
<table cellpadding="0" class="icons">
<tr height="30px">
<td><a href="01.php" class="icons">
<img src="01.jpg" class="icons" width="70"></a></td>
<td>
etc.
<img src="17.jpg" class="icons" width="70"></a></td>
<td><a href="18.php" class="icons">
<img src="18.jpg" class="icons" width="70"></a></td>
<td></td>
<td></td>
</tr>
<tr colspan="20"><td><a
href="http://www.vergunningenboer.nl/2-vergunningstekeningen/01.php">Vergunningstekeningen</a></td></tr>
<tr colspan="20"><td><a
href="http://www.vergunningenboer.nl/3-bestektekeningen/01.php">Bestektekeningen</a></td></tr>
<tr colspan="20"><td><a
href="http://www.vergunningenboer.nl/4-uitvoering/01.php">Uitvoering</a></td></tr>
<tr colspan="20"><td><a
href="http://www.vergunningenboer.nl/5-opgeleverd/01.php">Opgeleverd</a></td></tr>
</table>
</div>
</div>
<!-- END: Sticky Footer -->

Artificially Generate CPU Steal

Artificially Generate CPU Steal

Anyone know of a good way to artificially generate CPU steal? I have some
automation I want to test which is triggered by CPU Steal, but for the
life of me I can't figure out how to force CPU Steal to occur. I've got
the virtual machine pegged at 100% CPU utilization, with no stealing going
on. I don't have control over the host machine, so I can't just load a
bunch of VM's and get CPU Steal that way.
Anyone have any ideas? Would be greatly appreciated.

SSMS 2008 is stuck because Connect to Server window is hiding

SSMS 2008 is stuck because Connect to Server window is hiding

And i r 2 lazy 2 find window (sorry i lost it) or force it closed or mess
with monitors or display config. click makes ding, argh.
This question does not meet your quality standards. It's true. But maybe
better to make it public now vs save it for later?

Twitter bootstrap carousel does not auto start

Twitter bootstrap carousel does not auto start

I know that this question has been asked earlier, however the solution
there did not work for me.
My code:
<div id="gallerycontainer">
<div class="carousel-inner" align="center" style="margin-top:10px;">
<div class="item active" style="border:5px solid black;"><!-- class of
active since it's the first item -->
<img src="bootstrap/img/slider5.jpg" height="400px" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item" style="border:5px solid black;">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item" style="border:5px solid black;">
<img src="bootstrap/img/slider3.jpg" height="400px" width="960px" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item" style="border:5px solid black;">
<img src="bootstrap/img/slider4.jpg" height="400px" width="960px" alt="" />
<div class="carousel-caption">
<p>Our bedrooms are spacious and extremely luxurious.</p>
</div>
</div>
`
gallerycontainer is a self created div within which my carousel is placed.
I've called the function in the head by using this:
<script type="text/javascript">
$(document).ready(function(){
$('.carousel').carousel({interval: 2000});
});
</script>
My problem is, the auto slide starts only after I click the next button at
least once. What am I doing wrong?

Shinyprofiler for JNI part in Android application tutorial

Shinyprofiler for JNI part in Android application tutorial

Generate the Shinyprofiler native Android ARM binaries in a static library
on Ubuntu Linux, which can be used in Android application through Java
Native Interface (JNI) calls. To make it work, you would typically have to
compile your source code on your host computer for the target
architecture, which would require you to have the entire tool chain on
your development machine. Android NDK provides the complete set of tools
to build native C/C++ source files.
Step 1. Extract the standalone cross-compiler toolchain. Get and install
Android NDK properly from developer.android.com. Use "customized"
toolchain installation to create standalone compiler defined your Android
platform and device architecture (more information in
<NDK_PATH>/docs/STANDALONE-TOOLCHAIN.html)
Step 2. Create Makefile for building the source code and create a static
library.
ANDROID_NDK_BIN:=/home//<USER>/android/standalone-8/bin
CC := $(ANDROID_NDK_BIN)/arm-linux-androideabi-gcc
CPP := $(ANDROID_NDK_BIN)/arm-linux-androideabi-g++
AR := $(ANDROID_NDK_BIN)/arm-linux-androideabi-ar
CFLAGS := -I../include
.cpp.o:
$(CPP) $(CFLAGS) -c $<
.c.o:
$(CC) $(CFLAGS) -c $<
STATIC_LIB_SRC = ShinyManager.c ShinyNode.c ShinyNodePool.c
ShinyNodeState.c ShinyOutput.c ShinyTools.c ShinyZone.c \
STATIC_LIB_OBJ = ShinyManager.o ShinyNode.o ShinyNodePool.o
ShinyNodeState.o ShinyOutput.o ShinyTools.o ShinyZone.o \
OUT = libShiny.a
$(OUT): $(STATIC_LIB_OBJ)
$(AR) -crs $(OUT) $(STATIC_LIB_OBJ)
clean:
rm -f *.o libShiny.a
Step 3. Put libShiny.a file to /thirdparty/shinyprofiler/lib and header
files to /thirdparty/shinyprofiler/include.
Step 4. Make changes to your JNI part Android.mk makefile, which has to
describe Shinyprofiler static library. Define the path along with other
libraries.
SHINY_PATH := ${THIRDPARTY}/shinyprofiler
Import Shinyprofiler library.
include $(CLEAR_VARS)
LOCAL_MODULE := Shiny
LOCAL_SRC_FILES := $(SHINY_PATH)/lib/libShiny.a
LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SHINY_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
Add Shiny library name and an include path to your build module part:
LOCAL_STATIC_LIBRARIES := [other libraries] Shiny
LOCAL_C_INCLUDES := [other include path] $(LOCAL_PATH)/$(SHINY_PATH)/include
Step 5. Insert #include <Shiny.h> to your project source file, which is to
be profiled.
Step 6. Use PROFILE_BEGIN(<block_name>); and PROFILE_END(); macros to
profile needed block of a C source file (e. g. function) or only
PROFILE_FUNC(); at the beginning of a function in a C++ source file.
Step 7. Use PROFILE_UPADATE(); macro to prepare all profiled data for
output and PROFILE_OUTPUT(<path>/<output_file_name>); to write the data.
To deactivate profiling just put #define SHINY_IS_COMPILED FALSE before
#include <Shiny.h>.
Step 8. Use adb pull <remote> [<local>] to get the profiler output file,
having set needed permissions.
Problem set: If you get 'multiply definition of function', while project
building. Transfer noted function definition from header file to source,
having left function prototypes. Cut SHINY_INLINE macro definition for
these functions. We use gcc compiler, which always emits standalone object
code for functions defined with inline, despite it substitutes function
calls with code or not, so we may encounter multiply definition of
function problem, having oblique header file inclusion in Shinyprofiler
source files. Guards can't help us avoid the problem, for they work within
one translation unit only.
Reference:
Shinyprofiler page
Compile C/C++ ARM binary (Static Library) for Android using Standalone
toolchain
Have anybody got any experience with this profiler or can advise any other
for implementation?

Tuesday, 20 August 2013

javax.crypto.IllegalBlockSizeException: last block incomplete in decryption exception in android

javax.crypto.IllegalBlockSizeException: last block incomplete in
decryption exception in android

I am trying to decrypt a string in android. I keep getting the following
exception:
08-21 03:56:56.700: W/System.err(4208):
javax.crypto.IllegalBlockSizeException: last block incomplete in
decryption
08-21 03:56:56.700: W/System.err(4208): at
com.android.org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(JCEBlockCipher.java:697)
08-21 03:56:56.700: W/System.err(4208): at
javax.crypto.Cipher.doFinal(Cipher.java:1106)
08-21 03:56:56.700: W/System.err(4208): at
com.dharani.android.legalplex.BusinessLayer.BLCommonOperations.decrypt(BLCommonOperations.java:284)
08-21 03:56:56.700: W/System.err(4208): at
com.dharani.android.legalplex.BusinessLayer.BLCommonOperations.decryptAndgetFailCountFromPreferences(BLCommonOperations.java:144)
08-21 03:56:56.700: W/System.err(4208): at
com.dharani.android.legalplex.PresentationLayer.TransparentActivity.onCreate(TransparentActivity.java:112)
08-21 03:56:56.700: W/System.err(4208): at
android.app.Activity.performCreate(Activity.java:4465)
08-21 03:56:56.700: W/System.err(4208): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
08-21 03:56:56.700: W/System.err(4208): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
08-21 03:56:56.700: W/System.err(4208): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
08-21 03:56:56.700: W/System.err(4208): at
android.app.ActivityThread.access$600(ActivityThread.java:127)
08-21 03:56:56.700: W/System.err(4208): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
08-21 03:56:56.700: W/System.err(4208): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-21 03:56:56.700: W/System.err(4208): at
android.os.Looper.loop(Looper.java:137)
08-21 03:56:56.700: W/System.err(4208): at
android.app.ActivityThread.main(ActivityThread.java:4507)
08-21 03:56:56.700: W/System.err(4208): at
java.lang.reflect.Method.invokeNative(Native Method)
08-21 03:56:56.700: W/System.err(4208): at
java.lang.reflect.Method.invoke(Method.java:511)
08-21 03:56:56.700: W/System.err(4208): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
08-21 03:56:56.700: W/System.err(4208): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
08-21 03:56:56.700: W/System.err(4208): at
dalvik.system.NativeStart.main(Native Method)
the encrypt and decrypt methods are
public String encrypt(String message) throws Exception
{
String salt =
SharedVariables.globalContext.getString(R.string.EncryptionKey);
SecretKeySpec key = new SecretKeySpec(salt.getBytes(), "AES");
Cipher c = Cipher.getInstance("AES");
c.init(Cipher.ENCRYPT_MODE, key);
byte[] encVal = c.doFinal(message.getBytes());
String encrypted=Base64.encodeToString(encVal, Base64.DEFAULT);
return encrypted;
}
public String decrypt(String message) throws Exception
{
String salt =
SharedVariables.globalContext.getString(R.string.EncryptionKey);
Cipher c = Cipher.getInstance("AES");
SecretKeySpec key = new SecretKeySpec(salt.getBytes(), "AES");
c.init(Cipher.DECRYPT_MODE, key);
byte[] decordedValue = Base64.decode(message.getBytes(),
Base64.DEFAULT);
byte[] decValue = c.doFinal(decordedValue);
String decryptedValue = new String(decValue);
return decryptedValue;
}
Please help me to find the solution. Many Thanks in advance.

why widget doesn't work if not in use for long time

why widget doesn't work if not in use for long time

My app is having widget .It works all fine but if it is not in use for
long time then it doesn't work. After deleting and adding again it starts
working. What could be possible reason and solution?

Django manage.py runserver throws ImportError: AdminMediaHandler

Django manage.py runserver throws ImportError: AdminMediaHandler

The Problem
When I run python manage.py runserver I get the error ImportError: cannot
import name AdminMediaHandler.
ex.
(venv)agconti@agconti-Inspiron-5520:~/my_dev/github/stamped/stamped_project$
python manage.py runserver
ImportError: cannot import name AdminMediaHandler
This just started to happen after I installed the
django-werkzeug-debugger-runserver.
Im using virtualenv. Here is what I have installed:
Django==1.5.2
Werkzeug==0.9.3
argparse==1.2.1
django-extensions==1.1.1
django-werkzeug-debugger-runserver==0.1.2
six==1.3.0
wsgiref==0.1.2
I'm not sure what could be causing the conflict. Any ideas?