Saturday, 31 August 2013

Parse web page without save local?

Parse web page without save local?

Sorry my English a little. I am using CURL because web page is required
this function. I don't get file_get_contents of page. How to parse page
without page save? (fopen,fwrite)
<?PHP
function fileGet($url, $timeout = 55, $ref=true){
$useri = $_SERVER['HTTP_USER_AGENT'];
@set_time_limit($timeout);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION,true);
curl_setopt($curl, CURLOPT_COOKIE,
'PHPSESSID=fztitsfgsafafaq25llwafd0; path:/' );
curl_setopt($curl, CURLOPT_USERAGENT, $useri);
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_REFERER,$url);
$data = curl_exec($curl);
curl_close($curl);
// Save Page Start
$fp = fopen('data.html', 'w');
fwrite($fp, $data);
fclose($fp);
// Save Page End
return $data;
}
// Start Code
fileGet("http://www.example.com",10); // Start Function
$html = file_get_html('data.html'); // Open Saved Page In Local
foreach($html->find('div.columns') as $article) {
// Events.....
mysql_query("Insert Query");
}
// End Code
?>

trend line using Dots chart in Raphael.js

trend line using Dots chart in Raphael.js

I have to use g.raphaeljs library to create a scatterplot graph. Not only
that but i am trying to get a trend line as well, and am wondering how I
should go about this.
I was thinking of calculating the mean of the x axis and the y axis and
drawing a straight line based on slope.... but am still stuck.
Any help is appreciated.
Also the data used to plot the points on the dot chart is provided by a user.

Dynamic Buttons Collection View

Dynamic Buttons Collection View

I am trying to implement a collection view that contains a series of
buttons for each cell.
I have been able to dynamically add the buttons to each collection view,
depending on necessary number of buttons required. Anywhere from 1 to 7
small buttons per cell.
I am unable to determine the best way to link the value of the button
state to the model of my app.
Each button can cycled through 4 states, each has a different image for
the state.
I am able to determine what cell / object in the data model is selected
but cannot figure out how to link the button to the data model.
I have tried adding a category to the UIButton class and have properties
that store the reference to the model - but cannot get it to work.
I am assuming I will need to sub class UIButton instead ?
Any ideas are welcome.

how to remove(not delete) dynamically generated table elements?

how to remove(not delete) dynamically generated table elements?

Hi I have looped and echoed out this result
echo '<tr><td id="'.$row['productID'].'"><img height="150px" width="130px"
src="products/'.$row['image_url'].'"></td><td>'.$row['name'].'</td>
<td>'.$row['price'].'</td></tr>';
The above resulted in a table full of data, now How do i remove a specific
row, I want to remove it not delete from the table, as in a shopping cart
where you remove the item but not delete it from the table. How would you
use javascript or any other in this case?
Thank you very much.

Null Pointer Exception when method is invoked too many times

Null Pointer Exception when method is invoked too many times

I have a page where I set date and specialization:
<form>
<p:panel header="Szukaj wizyty">
<p:panelGrid columns="2">
<p:outputLabel for="Od"
value="Od"></p:outputLabel>
<p:calendar id="Od" label="Od"
value="#{visitPatientMB2.start}" effect="fold"
locale="pl" pattern="dd/MM/yyyy"
mindate="#{visitPatientMB2.actualDate}"
required="true">
<p:ajax event="dateSelect"
listener="#{visitMB.enableCalendar()}"
update="cal" />
</p:calendar>
<p:outputLabel for="Do"
value="Do"></p:outputLabel>
<p:calendar id="Do" label="Do"
value="#{visitPatientMB2.end}" effect="fold"
locale="pl" pattern="dd/MM/yyyy"
disabled="#{visitMB.flag}"
mindate="#{visitPatientMB2.actualDate}"
required="true"/>
<p:outputLabel
value="Specjalizacja"></p:outputLabel>
<p:selectOneMenu id="specialization"
value="#{visitPatientMB2.user.specializationId}"
effect="fade" style="width:200px"
converter="#{specializationConverter}">
<f:selectItems
value="#{visitPatientMB2.allSpecialization}"
var="specialization"
itemValue="#{specialization}"
itemLabel="#{specialization.name}"/>
</p:selectOneMenu>
<center><p:commandButton
action="#{visitPatientMB2.searchStart()}"
value="Szukaj" /></center>
</p:panelGrid>
</p:panel>
</form>
this page causes method: visitPatientMB2.searchStart()
VisitPatientMB2 RequestBean:
@ManagedBean
@RequestScoped
public class VisitPatientMB2 {
@EJB
private VisitDaoLocal visitDao;
@EJB
private SpecializationDaoLocal specializationDao;
@EJB
private UserDaoLocal userDao;
private Specialization specialization;
private Visit visit;
private User user;
private Date actualDate = new Date();
private Date start;
private Date end;
private boolean flag = true;
private Integer myId;
public VisitPatientMB2() {
}
public void enableCalendar() {
if (start != null) {
flag = false;
}
}
public String searchStart() {
System.out.println("SEARCH START");
if (start.after(end)) {
sendErrorMessageToUser("Data zakoñczenie nie mo¿e byæ
wczeœniejsza ni¿ rozpoczêcia");
return null;
}
if (start.before(actualDate)) {
sendErrorMessageToUser("Data wizyty nie mo¿e byæ wczeœniejsza
ni¿ aktualna data");
return null;
}
return "searchStart";
}
public String visitRegister() {
System.out.println("visitRegister");
myId = (Integer) session.getAttribute("myId");
visit.setPatientId(userDao.find(myId));
try {
visitDao.update(visit);
sendInfoMessageToUser("Wizyta zosta³a dodana");
return "addVisit";
} catch (EJBException e) {
sendErrorMessageToUser("B³¹d zapisu na wizyte do bazy");
return null;
}
}
public List<Visit> getVisitFound() {
System.out.println("start" + start);
System.out.println("end" + end);
System.out.println("name" + user.getSpecializationId().getName());
myId = (Integer) session.getAttribute("myId");
return visitDao.visitSearch(start, end,
user.getSpecializationId().getName(), myId);
}
public List<Specialization> getAllSpecialization() {
return specializationDao.findAllSpecialization();
}
Method return searchStart and go to page searchResult, no redirect
<navigation-rule>
<from-view-id>/protected/patient/visitSearch.xhtml</from-view-id>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/protected/patient/home.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>about</from-outcome>
<to-view-id>/protected/patient/about.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>gallery</from-outcome>
<to-view-id>/protected/patient/gallery.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>contact</from-outcome>
<to-view-id>/protected/patient/contact.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>myAccount</from-outcome>
<to-view-id>/protected/patient/patientPanel.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>visitList</from-outcome>
<to-view-id>/protected/patient/myVisits.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>visitRegister</from-outcome>
<to-view-id>/protected/patient/visitRegister.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>visitSearch</from-outcome>
<to-view-id>/protected/patient/visitSearch.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>history</from-outcome>
<to-view-id>/protected/patient/myHistory.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>logout</from-outcome>
<to-view-id>/home.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>editMyAccount</from-outcome>
<to-view-id>/protected/patient/myAccount.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>searchStart</from-outcome>
<to-view-id>/protected/patient/searchResult.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>addVisit</from-outcome>
<to-view-id>/protected/patient/home.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
and when I in the page searchResult i click save to visit and run the
method visitPatientMB2.visitRegister() but I have a error...
WARNING: /protected/patient/searchResult.xhtml @55,227
value="#{visitPatientMB2.visitFound}": java.lang.NullPointerException
javax.el.ELException: /protected/patient/searchResult.xhtml @55,227
value="#{visitPatientMB2.visitFound}": java.lang.NullPointerException
at
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIData.getValue(UIData.java:731)
at
org.primefaces.component.datatable.DataTable.getValue(DataTable.java:867)
at org.primefaces.component.api.UIData.getDataModel(UIData.java:579)
at org.primefaces.component.api.UIData.setRowModel(UIData.java:409)
at org.primefaces.component.api.UIData.setRowIndex(UIData.java:401)
at org.primefaces.component.api.UIData.processPhase(UIData.java:258)
at org.primefaces.component.api.UIData.processDecodes(UIData.java:227)
at javax.faces.component.UIForm.processDecodes(UIForm.java:225)
at
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
at
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:933)
at
com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at pl.ePrzychodnia.filter.FilterLogin.doFilter(FilterLogin.java:49)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at
com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at
pl.ePrzychodnia.mb.VisitPatientMB2.getVisitFound(VisitPatientMB2.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
at
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at
com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
at
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
... 46 more
Why i have null? I not redirect page, my bean is a request, why filed is
null?
I set in the method:
public List<Visit> getVisitFound() {
System.out.println("start" + start);
System.out.println("end" + end);
System.out.println("name" + user.getSpecializationId().getName());
myId = (Integer) session.getAttribute("myId");
return visitDao.visitSearch(start, end,
user.getSpecializationId().getName(), myId);
}
and I see, when i go the page search result. This method is invoked twice.
Why?
And when I run visitPatientMB2.visitRegister() in page searchResult method
starts the third time... This time fields have null. Example:
INFO: startSun Sep 01 00:00:00 CEST 2013
INFO: endSun Sep 29 00:00:00 CEST 2013
INFO: nameKardiolog
INFO: startSun Sep 01 00:00:00 CEST 2013
INFO: endSun Sep 29 00:00:00 CEST 2013
INFO: nameKardiolog
INFO: startnull
INFO: endnull
WARNING: /protected/patient/searchResult.xhtml @55,227
value="#{visitPatientMB2.visitFound}": java.lang.NullPointerException

RecusriveDirectoryIterator - Getting files within folder with specific params

RecusriveDirectoryIterator - Getting files within folder with specific params

My end-goal is to grab only jpg|png files from within a directory (that
has directories in it). I first started with this article and settled on
the OOP approach (since this seems to be the best way forward). Of course,
with this comes some complexities that I haven't found a good example for
thusfar. The following example (taken from the PHP docs page) seems to get
me part of the way there, but I haven't found a good way to match all of
the requirements (below the example):
$ritit = new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST );
$r = array();
foreach ($ritit as $splFileInfo) {
$path = $splFileInfo->isDir()
? array($splFileInfo->getFilename() => array())
: array($splFileInfo->getFilename());
for ($depth = $ritit->getDepth() - 1; $depth >= 0; $depth--) {
$path =
array($ritit->getSubIterator($depth)->current()->getFilename() =>
$path);
}
$r = array_merge_recursive($r, $path);
}
print_r($r);
What I'd like to do is:
Specify a $directory (let's say /media/galleries)
Have it only look at directories first (so if any files are in that
top-level directory it ignores them)
Check if each directory is readable (it may do this by default already)
List out each jpg|png file within these files (again, making sure each is
readable which I believe it may do by default)
Ignore any/all dot files in the FilesystemIterator seems to do, but I'm
still getting the dreaded .DS_Store files in the top-level)
Store these as a multi-dimensional array
The aforementioned example seems to be almost there, but any help to steer
me in the right direction would be greatly appreciated. Thanks!

FQL getting a list of non-friend from my current location

FQL getting a list of non-friend from my current location

I would like to know how to get a list of id facebook's user from my
current location,
I just did that "SELECT uid , current_location FROM user WHERE
current_location = '115175415163151'"
but I get the next error
"{ "error": { "message": "Your statement is not indexable. The WHERE
clause must contain an indexable column. Such columns are marked with * in
the tables linked from http://developers.facebook.com/docs/reference/fql
", "type": "NoIndexFunctionException", "code": 604 } }"

Div Items Move Up on toggle

Div Items Move Up on toggle

I have four divs . One of them is hidden (display:none) and is only
displayed once you click an icon. When the item is clicked jquery toggle
function is called . One div is set to display:none and the one which was
previously hidden is displayed. This is working perfectly but for some odd
reason the page content moves 10 pixels or so up on toggle. I don't know
what's causing it as all the divs have same css and classes. Here is the
css:
element.style {
margin-right: 5px;
margin-left: 10px;
left: 0px;
display: block;
}
#contactus {
background-color: #DDD;
position: relative;
position: relative;
left: 0;
}
@media (min-width: 1200px)
.span4 {
margin-left: 5px;
width: 320px;
}
span4 is the class for the toggled divs. Element styling is also the same.
Can any one give me a hint what is causing this behavior. Here is the url:
http://contestlancer.com/davidicus/ You can see it the problem if you
click on message icon besides the logo heading.
Ahmar.

Friday, 30 August 2013

Java Program Design for class project

Java Program Design for class project

I am working on a class project in java and have the following design
specification.
I have a Scientist class and an ABCFundingApplication class (ABC being a
body that grants scientists funding for their research). The scientist has
certain attributes like his username,password,number of papers published,
funding procured in the past etc etc..
The ABCFundingApplication class holds an array of type scientist which
holds scientist objects. The ABCFundingApplication allows for the
'creation' of scientist objects and also to update profiles of existing
scientist objects.
Now it says that the department ABC calculates whether a scientist
receives funding or not by using some internal process in their firm,
(insert funding algorithm here).
The spec sheet says for us to include this funding_decision algorithm in a
method in the scientist class, my question is why can we not include it as
part of the ABCFundingApplication class and just check whether for a
particular scientist object in the scientist array, whether he/she will be
granted funding? In my opinion this would be a cleaner implementation
would it not?

Thursday, 29 August 2013

CSS/Jquery dropdown z-index issue in IE - content being pushed rather than overlayed?

CSS/Jquery dropdown z-index issue in IE - content being pushed rather than
overlayed?

I'm trying to create a simple dropdown menu which, using z-index, should
overlay the content below it. The code below works fine in other browsers
but in IE8 (which is my corporate browser) it 'pushes' the content below
it. Based on this code can anyone see why it's doing this?
Thanks in advance!
<SCRIPT type=text/javascript>
$(document).ready(function() {
//toggle equipment menu
$('img#PrimarySelectButtonImg').click(function () {
$('ul#PrimarySelectMenu').slideToggle('fast');
});
});
</SCRIPT>
<STYLE>
<!--
a:active, a:focus {
outline: none;
text-decoration: none;
border-bottom: 0px;
ie-dummy: expression(this.hideFocus=true);
}
a:hover {
text-decoration: none;
border-bottom: 0px;
}
#PrimarySelectArea {
height: 46px;
width: 272px;
cursor: pointer;
position: relative;
z-index: 100;
}
#PrimarySelectMenu {
display: none;
width: 268px;
border: 1px solid #ccc;
background-color: #fff;
}
.the_menu li {
padding: 15px 5px;
display: block;
}
.the_menu li:hover {
background-color: #f1f0ce;
}
.the_menu li a {
color: #666;
text-decoration: none;
}
.the_menu li a:hover {
color: #666;
background-color: #f1f0ce;
}
#MainTableHolder {
position: relative;
z-index: -1;
}
-->
</STYLE>
<div id="kbankContainer">
<div id="PrimarySelectArea"> <img src="images/PrimarySelectButton.png"
width="272" height="38" id="PrimarySelectButtonImg" />
<ul id="PrimarySelectMenu" class="the_menu">
<li><a href="#">PRODUCT INFORMATION</a></li>
<li><a href="#">PROTOCOLS</a></li>
<li><a href="#">FORMS</a></li>
<li><a href="#">INFORMATION</a></li>
</ul>
</div>
<!-- begin tools table -->
<div id="MainTableHolder">
<table border=0 cellspacing=0 cellpadding=4 width="100%">
<thead>
<tr>
<th width="36%" align=left>&nbsp;</th>
<th width="32%" align=left>&nbsp;</th>
<th width="32%" align=left>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td>first row of table</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</div>
Again, thanks for any help!

How to capture the Parameters being sent to the particular Stored Procedure in sql server 2008?

How to capture the Parameters being sent to the particular Stored
Procedure in sql server 2008?

In SQL Server 2008, do we have a query which can find the parameters being
passed to a particular stored procedure?

Wednesday, 28 August 2013

How do I get started with Adobe CQ?

How do I get started with Adobe CQ?

I searched google but counld not find any thing except the Adobes
documentation which is very poor

Make vectors of unequal length equal in length by reducing the size of the largest ones

Make vectors of unequal length equal in length by reducing the size of the
largest ones

I am reading 6 columns from a .txt file to 6 vectors.
Sometimes some vectors are one element larger than others, so I need to
check if they are all of equal length, and if not, I have to find which
ones are the largest and delete their last element. I think I should be
able to do this without loops. I was originally thinking of using find in
combination with isequal but isequal only returns a logical, and does not
provide any information on which vectors are the largest.

Listview in scrollable layout

Listview in scrollable layout

Don't use listviews in scrollviews they say, well, okay, but how do you
fix this?
I have a viewpager with some lists in it (mockup) above that, I have a
tabindicator and some other information that doesn't change when you go to
another tab.
My problem is that I always want to scroll the complete view (so content,
tabindicator and viewpager). If you scroll down, only the fragment with
the listview (=tab content) should be visible and scrollable.
I don't want to put the content view and tab headers in a listview header
because I don't want them to change every time I go to another tab (swipey
tabs, so the user will see it)
What's the best way to do this?

Android and UNIX similarity

Android and UNIX similarity

How similar is Android to the traditional UNIX and UNIX like systems such
as GNU/Linux from an architectural standpoint?
Is Android as much UNIX as GNU/Linux? Is it possible to install an X
Window manager on Android?
In other words; how much can I reuse my Linux knowledge as a developer on
Android? I've only ventured into the "Java side" of Android development.

Algorithms for Threaded Binary Search Tree

Algorithms for Threaded Binary Search Tree

I am going to implement Threaded Binary Search Tree please check the
insertion algorithm is correct. Algorithm is:
Algorithm Insert_TBST(LCHILD(HEADER),info)
begin
PTR:=ALLOCATE(SIZE);
INFO(PTR):=info;
if LCHILD(HEADER)=NULL, then
begin
LCHILD(HEADER):=PTR;
PARENT(HEADER):=NULL;
RCHILD(HEADER):=HEADER;
LTHREAD(HEADER):=FALSE;
RTHREAD(HEADER):=TRUE;
PARENT(PTR):=HEADER;
LCHILD(PTR):=HEADER;
RCHILD(PTR):=HEADER;
LTHREAD(PTR):=TRUE;
RTHREAD(PTR):=TRUE;
end
else
begin
XPTR:=LCHILD(HEADER);
if INFO(XPTR) = info, then
begin
if LTHREAD(XPTR)=FALSE, then
Insert_TBST(LCHILD(XPTR),info);
else
begin
LCHILD(PTR):=LCHILD(XPTR);
LTHREAD(PTR):=TRUE;
RCHILD(PTR):=XPTR;
RTHREAD(PTR):=TRUE;
PARENT(PTR):=XPTR;
LCHILD(XPTR):=PTR;
LTHREAD(XPTR):=FALSE;
end
end
else
begin
if RTHREAD(XPTR)=FALSE, then
Insert_TBST(RCHILD(XPTR),info);
else
begin
LCHILD(PTR):=XPTR;
LTHREAD(PTR):=TRUE;
RCHILD(PTR):=RCHILD(XPTR);
RTHREAD(PTR):=TRUE;
PARENT(PTR):=XPTR;
RCHILD(XPTR):=PTR;
RTHREAD(XPTR):=FALSE;
end
end
end
end

Spring mvc interceptor exception

Spring mvc interceptor exception

My project is baded on spring mvc, and I wrote a interceptor to intercept
request, I want to get parametrts from request, the follows is my code:
public boolean preHandle(HttpServletRequest request, HttpServletResponse
response, Object handler) throws Exception {
HandlerMethod maControl = (HandlerMethod) handler;
Method pmrResolver = (Method) maControl.getMethod();
String methodName = pmrResolver.getName();
....
}
but now it throws a exception:
java.lang.ClassCastException:
org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler
cannot be cast to org.springframework.web.method.HandlerMethod
I don't know why, I have configured in web.xml to avoid intercept static
source.

Tuesday, 27 August 2013

How to change the RichTextBox input current font?

How to change the RichTextBox input current font?

input something and change combox value to change
FontFamily/FontSize/FontColor that I have selected.
Now change ComBox value without selection . and then I input something I
hope new iput effect
how to do? i have use this.richTextBox.FontSize =
Convert.ToDouble(this.sizeComboBox.SelectedItem);
this.richTextBox.Document.FontFamily = new
FontFamily(e.AddedItems[0].ToString()); the tow method have change all
document enter //X‰üŽš'Ì'召 private void
sizeComBox_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (!richTextBox.Selection.IsEmpty) {
richTextBox.Selection.ApplyPropertyValue(RichTextBox.FontSizeProperty,
sizeComboBox.SelectedValue.ToString()); } else { this.richTextBox.FontSize
= Convert.ToDouble(this.sizeComboBox.SelectedItem);
//this.richTextBox.SetValue(TextElement.FontSizeProperty,
Convert.ToDouble(this.sizeComboBox.SelectedItem)); } }here

Python Traits equivalent of MATLAB ButtonDownFcn

Python Traits equivalent of MATLAB ButtonDownFcn

Is there some sort of equivalent callback or Handler function in Python to
MATLAB uicontrol's "ButtonDownFcn"? From Matlab's documentation.
"A callback routine that can execute when you press a mouse button while
the pointer is on or near a uicontrol."
Specifically, this would be used for calling up a touchscreen keypad to
enter values into QLineEdit fields. Short of writing a separate function
that returns the location of a mouse click and compares to the locations
of existing buttons (and that likely wouldn't be cross-platform
compatible), nothing came to my mind. Thoughts?

why the list behaves differently in python and Java?

why the list behaves differently in python and Java?

I am learning the scripting language, python. I know Java quite a bit. I
am trying to translate one bit of code from Java to python. but they
behave erratically (or my understanding could be totally wrong) I have the
following code in Java, where I am adding elements to a ArrayList
indefinitely. so this causes outofmemory error, which I expect:
import java.util.*;
public class Testing{
public static void main(String[] args){
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(5);
list.add(4);
for (int i=0;i<list.size();i++){
list.add(5);
}
}
}
now the same code translated in python:
lst = []
lst.append(5)
lst.append(4)
for i in range(len(lst)):
lst.append(5)
print lst
here I get the output: [5, 4, 5, 5]
from what I see, is the list not passed as reference to the for-loop in
python?
similarly here,
>>> l=[1,2,3]
>>> for i in l[:]:
... l.append(4)
... print l
...
[1, 2, 3, 4]
[1, 2, 3, 4, 4]
[1, 2, 3, 4, 4, 4]
in each iteration inside for-loop, I am increasing the list size, so the
iteration should go forever correct?

How to run eclipse with different java version?

How to run eclipse with different java version?

I am using eclipse for developing BlackBerry Applications. I have JDK/JRE
7 currently on my computer , but that makes the BlackBerry plugins crash.
Actually is a known issue and the only thing need to be done is run
eclipse with JDK/JRE 6 instead of 7.
I downloaded and installed version 6. However i am pretty sure eclipse
still uses 7. I had the same problem a year ago and i remembered i had to
configure some System Variables and it worked , but i cant really find the
solution now.
Any idea on this one? Important! I dont want to compile in version 6 ,
which means i just have to choose the java version through eclipse. What i
need is eclipse to start with version 6.

How to set up and push to a second repo on Github

How to set up and push to a second repo on Github

I am a complete newbie in coding. I already have a repo on Github, for my
project. Now I want to create a second project, and would like to commit
it to github as well. I have researched a while and tried a number of
ways, however, I can't seem to get it to work. Also, in the future, if I
do create a second repo on Github, how do I push to the responding heroku
app?
Can someone help, much appreciated.

Git: check whether file exists in some version

Git: check whether file exists in some version

In my application, I'm using git for version management of some external
files
I'm using commands like git show HEAD~1:some_file to get a certain version
of a file. When the file does not exist, a 'fatal' message is outputted (I
think to the stderr pipe). e.g.
fatal: Path 'some_file' does not exist in 'HEAD~1'
Is there a clean command to check whether a file exists in a certain version?

Button style on chrome differs from the rest

Button style on chrome differs from the rest

I want to style a "sign in with facebook" button using the facebook icon
in font-awesome and bootstrap
for this I have the following html
<a href="#" class="btn btn-large login_facebook">
<i class="icon-facebook"> </i> | Sign in with Facebook</a>
and adding to this the proper css
.login_facebook {
background: #6e86bd;
background: -moz-linear-gradient(top, #6e86bd 0%, #6680b9 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#6e86bd),
to(#6680b9));
border-top: 1px solid #3f5b98;
border-left: 1px solid #3f5b98;
border-bottom: 1px solid #3f5b98;
border-right: 1px solid #3f5b98;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: inset 0 1px 0 0 #abbbdf;
-webkit-box-shadow: inset 0 1px 0 0 #abbbdf;
box-shadow: inset 0 1px 0 0 #abbbdf;
color: #fff;
font-weight: bold;
text-align: center;
text-shadow: 0 -1px 1px #344d80;
margin: 0 0 10px 0;
vertical-align: top;
position: relative;
}
.login_facebook .icon-facebook {
font-size: 37px;
vertical-align: bottom;
position: relative;
bottom: 0;
line-height: 0px;
}
on chrome the f icon is aligned with the bottom of the button but on
firefox, ie it doesn't
best seen on jsfiddle http://jsfiddle.net/KM2tS/1/
I am guessing I need to add browser specific styles here, but which
styles? and is there a way to make all browsers behave the same in this
specfic case?

Monday, 26 August 2013

Linux command input done in Java

Linux command input done in Java

Many commands in Linux take input one of two ways, stdin, or as an
argument to a file. Examples
echo "text from stdin" | lpr
lpr filename.txt
echo "text from stdin" | nl
nl filename.txt
The same is true with awk, sed, grep, and many others. How can the same
behavior happen from a command line app written in Java? I believe
System.in represents stdin. Reading stdin is not difficult. Reading from a
file is not difficult, but how can the app act accordingly to how it was
called on the command line?

Using routes to link to home/subpage/THIS instead of home/THIS

Using routes to link to home/subpage/THIS instead of home/THIS

I just want to link to "/resources/entrepreneurship" instead of
"/entrepreneurship". The code below doesn't seem to work because I don't
know how to link to it properly.
routes.rb
Project::Application.routes.draw do
root to: 'static_pages#home'
get '/about', to: 'static_pages#about'
get '/resources/entrepreneurship', to: 'static_pages#entrepreneurship'
end
Header
<li><%= link_to "Entrepreneurship", resources/entrepreneurship_path %></li>
The error is this when I try to open the page. "undefined local variable
or method `resources' for #<#:0x007fd46571a160>"

Windows Store App--What is SegoeUI Stylistic Set 20?

Windows Store App--What is SegoeUI Stylistic Set 20?

Microsoft Documentation says this about the basics of a Windows Store
Application:
"The baseline of the page header should be 5 units, or 100 pixels from the
top. The left margin for the page header is 6 units, or 120 pixels. The
Windows 8 page header is SegoeUI Stylistic Set 20, light weight. For more
information about Stylistic Sets, see Guidelines and checklist for text
and typography."
I certainly know how to set a font, font size, even a font style, but I
can't find anything in Visual Studio or on Microsoft webpages which
defines, illustrates, or gives an example of "SegoeUI Stylistic Set 20."

Akka Actor Priorities

Akka Actor Priorities

I have an actor-based system that performs periodic, cpu-intensive data
ingests as well as serves RESTful endpoints. I'm using Akka actors to
signal/control the various stages of the ingest process, and Spray (which
is of course built on Akka) to serve my restful endpoints.
My problem is this: When the ingest kicks off it consumes most of the CPU,
starving the RESTful endpoints until its done.
What's the best way to lower the priority of the ingest? Right now the
ingest and the Spray module share the same ActorSystem, but they could be
separated if that helps the solution.
Thanks for any ideas... Greg

Finding a mistake in a published paper – academia.stackexchange.com

Finding a mistake in a published paper – academia.stackexchange.com

I've found a mistake in a published paper, and am unsure what to do now. I
was looking at all cited articles from a paper over 10 years old, and
found one that is citing the paper in error. A ...

Helpers, utilities, thumbs, variable classes in c#

Helpers, utilities, thumbs, variable classes in c#

I need to learn these classes in a c# project so could you just offer me a
website or a book for this purpose? Why people need to use them?

is there any plug in to change taxonomies meta box design?

is there any plug in to change taxonomies meta box design?

I wanna to change the design of taxonomies meta box when I use that
taxonomy in my custom post type. How can I do it?

User.Identity.Name works in IE but it does not work in Chrome or firefox

User.Identity.Name works in IE but it does not work in Chrome or firefox

I have a website with windows authentication. In web.config, I have
written code as below:
<authentication mode="Windows">
</authentication>
<authorization>
<deny users="?" />
<allow users="*"/>
</authorization>
In IIS 7.5, I have enabled anonymous authentication and windows
authentication but when I load the page in IE I am getting value in
User.Identity.Name and Request.IsAuthenticated is true, but if same page
is run from firefox or chrome, Request.IsAuthenticated is false and
User.Identity.Name is empty string.
Is there any setting missing?

Why are Images repeating in Classic ASP

Why are Images repeating in Classic ASP

I am currently having a problem with some thumbnail images in a classic
ASP website. Essentially, I have a database in Microsoft Access that
contains three tables: One with the pictures and their info, another that
is linked to the pictures table and contains location information and a
third table which just has some text for the website.
On the page which is coded below, each image in the database has its
corresponding thumbnail printed onto the page. The user can then click on
the thumbnail and be taken to the larger image with some associated
information.
My problem is that the thumbnails are repeating themselves, up to 11 times.
<% option explicit %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Places</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- #include file="conn.asp" -->
<div id="container">
<!-- #include file="nav.asp" -->
<% dim SQL, info
' 0 1 2 3 4
SQL = "select PicturesTable.id, filename, location, title, description"&_
" from PicturesTable, locationsTable"&_
" where PicturesTable.locationNum = locationsTable.id"&_
" order by locationsTable.id"
set info=conn.execute(SQL)
This is my loop where I think the problem is.
if info.eof then
response.write "No data found."
end if
do until info.eof
response.write "<a href=""images.asp?i=" & info(1) & """>" &_
"<img src=""thumbs/" & info(1) & """></a>"
info.movenext
loop
%>
</div>
<%
conn.close
%>
</body>
</html>

Sunday, 25 August 2013

How to use YAML front and back matter in Ruby?

How to use YAML front and back matter in Ruby?

I have heard of the term "front matter" and "back matter" to refer to some
YAML parsing at the beginning or end of a non-YAML file. However, I can't
seem to find any examples/documentation of how to implement this. Maybe
this isn't a standard YAML feature. How can I make use of this feature in
my Ruby project?
FYI: The reason I want to do this is to be able to require some ruby files
at the top, and assume the rest is YAML. I don't think this is normally
allowed in a YAML file.

Don't understand this $L^p$ space inequality (Bochner spaces, etc)

Don't understand this $L^p$ space inequality (Bochner spaces, etc)

For $p \geq 1,$ define $f \in L^p(0,T;X)$ by $$f = \sum_{i=1}^\infty x_i h
\chi_{E_i}$$ where $E_i$ are measurable disjoint partition of $[0,T]$. The
$x_i \in X$ with $|x_i|_X = 1$, and $h \geq 0$ is in $L^p(0,T)$ and is
such that $0 < |h|_{L^p(0,T)} \leq 1$.
Why is it true that: $$|f|_{L^p(0,T;X)} = |h|_{L^p(0,T)} \leq 1.$$
This is from page 98 of Diestel, Uhl: Vector measures.
Where to go from here: $$|f|_{L^p(0,T;X)}^p = \int_0^T |f(t)|_{X}^p =
\int_0^T |\sum_{i=1}^\infty x_i h \chi_{E_i}|_X^p$$ How to expand the
integrand??

jQuery File Upload 'undefined' image url

jQuery File Upload 'undefined' image url

I'm using a plugin called jQuery file upload to upload images to a page.
Currently it uploads with the original image name as the file name
(IMG_1234). I need a specific format for the image name on the server (eg
1.123456.jpg)
I found this code that works for changing the image name:
class CustomUploadHandler extends UploadHandler
{
protected function trim_file_name($name, $type) {
$name = time()."_1";
$name = parent::trim_file_name($name, $type);
return $name;
}
}
When I upload an image, it is named correctly, but the link for the image
preview is undefined. This prevents me from deleting the image via the
plugin.
The variable data.url is undefined... If I go back to the original code
that doesn't rename the image, everything works fine.
Has anyone had any experience with this plugin that could help? Thanks!

How does simple copy paste works in unix?

How does simple copy paste works in unix?

I wanted to know what happens when i right click on a file and copy it and
paste it in unix.whats the theoretical concept behind it ?? when we say
copy where the path of the file is stored ?? does it use buffers for that
purpose? Please provide me the basic concept of copy paste in unix.
Thanks.

Saturday, 24 August 2013

lost contacts in Live Mail

lost contacts in Live Mail

One day, out of the blue, I started having trouble with Live Mail, would
not work online. I couldn't figure out how to fix it, so I thought I would
delete my email account, then re-add it. I got the message to backup my
emails before deleting, which I successfully did. However, I never thought
to backup my contacts, and now after deleting my account, I cannot find my
contacts. Any help would be greatly appreciated.

html link not clickbale

html link not clickbale

I've been doing basic html coding for awhile, but I am coming across
something here that has me stumped. Look at the page at on
http://www.uwfantasyfootballleague.com/teams/2013_Atlanta.html and the
page source code. On the resulting page, on the two rows of links at the
top, the links on the right half of the page, the CL & PCC, and from SD to
the right on the second row, are unclickable.
Here's a segment of the code:
Edit: well it won't let me post that section of the code because it says I
need 10 reputation to most more than two links -- but the code is there on
the page
There is nothing different about the code for the ones that aren't
clickable, and here's no reason this should be the case, at least that I
can see, or there is something obvious that I am overlooking. I can't
figure it out. I've looked on different computers, on PCs and a Mac, and
from different locations, it's nothing on the browsers end, it's something
in the code, or at least how the code is being displayed.
I searched for an existing answer, only one I found...
Links not displaying links
...it referred to and
tags, which I haven't used in my code.
Thanks in advance.

what is performance rate on int data type vs uniqueidentifier on sql select?

what is performance rate on int data type vs uniqueidentifier on sql select?

i read some useful information about uniqueidentifier data type
Primary Key versus Unique Constraint?
PRIMARY KEYs vs. UNIQUE Constraints
http://sqlfool.com/2009/06/primary-key-vs-unique-constraint/
EF 4.0 Guid or Int as A primary Key
GUID Performance
i use two data types "int" and "uniqueidentifier" on my table's columns .
these columns are not identity. i use
select * from mytable where column1=1
select * from mytable where column2=//my GUID
these are two data type and i want to know: using "where" on unique
identifier data type has more deference performance versus use "where" on
int data type or not?

Peaceful doesn't work anymore?

Peaceful doesn't work anymore?

I activated the nether reactor core on minecraft PE version 5 (and some 0s
after he five and a decimal of course) and it summoned zombie pigs still
on peaceful mode...it sent me to the nether world o.o then some mob shot
fire balls at me and i don't know how to stop them:-[
Now i am getting attacked by this thing that can teleport! Also i see so
much nether brick...and all this time i have had it on peaceful :'( does
peaceful work? How to leave this evil area?!

Re-write arguments between $(-\pi,\pi]$ - why

Re-write arguments between $(-\pi,\pi]$ - why

I have a complex number answer with an argument of $4\pi/3$ and the
example said to make the argument a number between $(-\pi,\pi]$ however I
don't understand what that means or why we do it (the answer is
$-2\pi/3$).
On my unit circle graph there is no $-\pi$, so I can't find a number
between it and $\pi$. Furthermore I don't understand why we do that step.

2nd Curl Request talking 30 seconds

2nd Curl Request talking 30 seconds

I am trying to make to curl requests to a website's API. It works fine but
the second request takes 30 seconds to complete, but it does not do this
when I try it on the postman chrome extension? So the problem must be with
the curl script.
Heres the code:
<?php
function getfeed($url){
$ip = $_SERVER['REMOTE_ADDR'];
$ch = curl_init();
curl_setopt($ch,CURLOPT_USERAGENT,'Opera/9.80 (Macintosh; Intel Mac OS
X; U; en) Presto/2.2.15 Version/10.00');
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"client_ip=$ip&type=1&app_id=foo&app_secret=bar");
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_AUTOREFERER,1);
curl_setopt($ch,CURLOPT_FRESH_CONNECT,1);
$response = curl_exec ($ch);
curl_close ($ch);
return $response;
}
echo $filmon_session =
json_decode(getfeed("http://www.filmon.com/api/init"))->session_key;
$channels =
json_decode(getfeed("http://www.filmon.com/api/channels?session_key=$filmon_session"));
print_r($channels);
?>

How can I do a greedy regex query in notepad++?

How can I do a greedy regex query in notepad++?

I am writing a paper with latex and accidentally wrote \cite[] instead of
\cite{}. I could just go over the whole document by hand but I want to
know how to do this in notepad++ using regexes.
I initially tried \\cite\[(.*)\] and replace with \cite{\1} which works
for simple cases such as
\cite[hello world] blah blah
However if there are two or more citations in a paragraph it matches all
of them. So for example
\cite[aaa]\cite[bbb] something here \cite[ccc]
matches the whole line
How can I get a non greedy match so that the above line would be matched
as 3 separate matches and the result of a replace command should give me
\cite{aaa}\cite{bbb} something here \cite{ccc}

Friday, 23 August 2013

error ocuring while connecting to android and php with mysql

error ocuring while connecting to android and php with mysql

I have the following code in my post_item.java file
package com.iwantnew.www;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class post_item extends Activity {
private ProgressDialog pDialog;
JSONParser jsonParser = new JSONParser();
Button add_room;
EditText contact_no;
EditText no_of_room;
EditText price_per_room;
EditText description;
private static String url_create_product =
"http://10.0.2.2/android_iwant/android_add_room.php";
private static final String TAG_SUCCESS = "success";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.post_form);
//contact_no = (EditText) findViewById(R.id.contact_no);
no_of_room = (EditText) findViewById(R.id.no_of_room);
price_per_room = (EditText) findViewById(R.id.price_per_room);
//description = (EditText) findViewById(R.id.description);
contact_no = (EditText) findViewById(R.id.contact_no);
add_room = (Button) findViewById(R.id.add_room);
add_room.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// creating new product in background thread
new add_new_room().execute();
}
});
}
// suru...
class add_new_room extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(post_item.this);
pDialog.setMessage("Saving details..");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
/**
* Creating product
* */
protected String doInBackground(String... args) {
//String contact = contact_no.getText().toString();
String quantity = no_of_room.getText().toString();
String price = price_per_room.getText().toString();
//String contact = contact_no.getText().toString();
String descriptions = description.getText().toString();
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
//params.add(new BasicNameValuePair("contact", contact));
params.add(new BasicNameValuePair("quantity", quantity));
params.add(new BasicNameValuePair("price", price));
params.add(new BasicNameValuePair("descriptions", descriptions));
// getting JSON Object
// Note that create product url accepts POST method
JSONObject json = jsonParser.makeHttpRequest(url_create_product,
"POST", params);
// check log cat fro response
Log.d("Create Response", json.toString());
// check for success tag
try {
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
// successfully created product
Intent i = new Intent(getApplicationContext(),
MainActivity.class);
startActivity(i);
// closing this screen
finish();
} else {
// failed to create product
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
// dismiss the dialog once done
pDialog.dismiss();
}
}
}
i have the following in my php file.
/* * Following code will create a new product row * All product details
are read from HTTP Post Request */
// array for JSON response $response = array();
// check for required fields
if (isset($_POST['quantity']) && isset($_POST['price'])) {
//$location = $_POST['location'];
$quantity = $_POST['quantity'];
$price = $_POST['price'];
//$productID = $_POST['area'];
//$contact = $_POST['contact'];
$descriptions = $_POST['descriptions'];
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// mysql inserting a new row
$result = mysql_query("INSERT INTO
room_tb(uid,categoryID,quantity,price,description)
VALUES(5,1,'$quantity','$price','$descriptions')");
//$result1 = mysql_query("INSERT INTO users(userContactNumber)
VALUES('$contact')");
// check if row inserted or not
if($result)/*&& ($result1)*/ {
// successfully inserted into database
$response["success"] = 1;
$response["message"] = "Room added successfully.";
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// echoing JSON response
echo json_encode($response);
}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";
// echoing JSON response
echo json_encode($response);
}
?>
whenever i send description or contact number to the database...the
android emulator says unexpectedly stopped working and no records enters
the database..but if i only pass the quantity,price,categoryID and uid
then no error occurs and record goes to the database. what have i done
wrong?

selecting rows that have the same value

selecting rows that have the same value

I have a problem in selecting rows that have the same value. My data is
too huge to go row by row to do that. I want you guys to let me know
scripts that can perform this.
My data looks like as below:
file name: temp
Start day hour end day hour Value
01/04/2000 22:00 01/05/2000 09:00 -9
01/05/2000 09:00 01/06/2000 09:00 -9
01/06/2000 09:00 01/07/2000 09:00 -9
01/07/2000 09:00 01/08/2000 09:00 -9
01/08/2000 09:00 01/09/2000 09:00 -9
01/09/2000 09:00 01/10/2000 09:00 -9
01/10/2000 09:00 01/11/2000 09:00 -9
01/11/2000 09:00 01/11/2000 21:30 -9
01/11/2000 22:30 01/12/2000 09:00 -9
01/12/2000 09:00 01/13/2000 09:00 -9
01/13/2000 09:00 01/14/2000 09:00 -9
01/14/2000 09:00 01/15/2000 09:00 -9
01/15/2000 09:00 01/16/2000 09:00 -9
01/16/2000 09:00 01/17/2000 09:00 -9
01/17/2000 09:00 01/18/2000 09:00 -9
01/18/2000 09:00 01/18/2000 22:45 -9
01/18/2000 22:50 01/19/2000 09:00 0.15
01/19/2000 09:00 01/20/2000 09:00 -9
01/20/2000 09:00 01/21/2000 09:00 -9
01/21/2000 09:00 01/22/2000 09:00 -9
01/22/2000 09:00 01/23/2000 09:00 -9
01/23/2000 09:00 01/24/2000 09:00 -9
01/24/2000 09:00 01/25/2000 09:00 -9
01/25/2000 09:00 01/26/2000 00:35 -9
01/26/2000 00:35 01/26/2000 09:00 -9
01/26/2000 09:00 01/27/2000 09:00 -9
01/27/2000 09:00 01/28/2000 09:00 -9
01/28/2000 09:00 01/29/2000 09:00 -9
01/29/2000 09:00 01/30/2000 09:00 -9
01/30/2000 09:00 01/31/2000 09:00 -9
01/31/2000 09:00 02/01/2000 09:00 -9
I want to select those rows that have the same start day, and the same end
day. I want my output from the above data be:
Start day hour end day hour Value
01/10/2000 09:00 01/11/2000 09:00 -9
01/11/2000 09:00 01/11/2000 21:30 -9
01/11/2000 22:30 01/12/2000 09:00 -9
01/17/2000 09:00 01/18/2000 09:00 -9
01/18/2000 09:00 01/18/2000 22:45 -9
01/18/2000 22:50 01/19/2000 09:00 0.15

Core Principles of C# in Databases?

Core Principles of C# in Databases?

You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1 : you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..

will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.

always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.

google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool key ctrl+v
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest.
===========================================================================================================
====================================================

Data Consumption on Static IP

Data Consumption on Static IP

I don't have much idea whether it is the right forum for these sort of
questions but i need some help, would be thankful if someone give me the
idea for this.
We've a wireless internet connection in our office and the day since then
our office has switched from a dynamic IP to a static IP, the data
consumption has increased more than doubled.
We have a 20 GB monthly limit but do not have any internet consumption at
our office except the emails we receive and the anti-virus or software
updates. The only thing we do is to connect the software on the machine
via remote desktop (as we have 2 office locations), which i don't think,
could be a cause of excessive usage.
We have even put a restriction recently so that only the IPs (which we
have added in our modem firmware) could connect to the internet, but
within a week we have got a notice from the provider that we have exceeded
our 50% data consumption limit.
Any ideas?

BitTorrent Sync open source alternnative

BitTorrent Sync open source alternnative

BitTorrent Sync is great. But I wish to use it for my docs and passwords.
BitTorrent was hacked recently
http://forum.ragezone.com/f10/bittorrent-source-dns-reward-948810/
So it is possible that key from my folder leaked.
I wish to have open source alternative. I wish to understand risks and
control all keys myself.

Add values to dropdownlist thats not represented in the db and still get selected value asp.net

Add values to dropdownlist thats not represented in the db and still get
selected value asp.net

I have a couple of dropdownlists in my gridview from customer table that
binds the selected value from my db.
I noticed that if i only have one customer and would like to edit that
customers gender it's not possible because i populate the dropdownlist
with the SELECT DISTINCT Gender FROM Customer and my first customer is
either Herr or Frau and i can only choose from that value.
I was thinking i could solve this Problem using a Union select select
Gender from ( select Gender = 'Herr' union select Gender = 'Frau' )as
Gender to bring both alternatives but then i get this error message
'DropDownList1' has a SelectedValue which is invalid because it does not
exist in the list of items
So my question is how can i add some alternatives to dropdownlist that's
not already presented in DB and still bind the selectedvalue?
<EditItemTemplate>
<asp:DropDownList ID="DropDownList3" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Gender"
DataValueField="Gender" SelectedValue='<%# Bind("Gender")
%>'>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:EventConnectionString %>"
SelectCommand="SELECT DISTINCT [Gender] FROM
[Customer]"></asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("Gender") %>'></asp:Label>
</ItemTemplate>

Thursday, 22 August 2013

STL vector of vector scope and lifetime

STL vector of vector scope and lifetime

I have a vector < vector < int > > myVec as a private member of a class.
This is allocated by a method setMyVec of a friend class. The problem I am
facing is that the inner vector int values are invalid when accessed from
any other method. I believe it is because the inner vectors are allocated
by setMyVec and deallocated when the method returns. Is that correct? If
so, how do I get around this problem? Here's some minimal example code.
class A {
vector< vector<int> > myVec;
public:
printMyVec();
friend class B;
};
class B {
public:
setMyVec();
};
B::setMyVec() {
int n = 100;
int m = 100;
int someNumber = 1000;
myVec.resize( n );
for(int i = 0; i < n; i++) {
myVec[i].resize( m );
for(int j = 0; j < m; j++) {
myVec[i][j] = someNumber;
}
}
}

Rails: Can't access a module in my lib directory

Rails: Can't access a module in my lib directory

I'd like to create a general purpose string manipulation class that can be
used across Models, Views, and Controllers in my Rails application.
Right now, I'm attempting to put a Module in my lib directory and I'm just
trying to access the function in rails console to test it. I've tried a
lot of the techniques from similar questions, but I can't get it to work.
In my lib/filenames.rb file:
module Filenames
def sanitize_filename(filename)
# Replace any non-letter or non-number character with a space
filename.gsub!(/[^A-Za-z0-9]+/, ' ')
#remove spaces from beginning and end
filename.strip!
#replaces spaces with hyphens
filename.gsub!(/\ +/, '-')
end
module_function :sanitize_filename
end
When I try to call sanitize_filename("some string"), I get a no method
error. When I try to call Filenames.sanitize_filename("some string"), I
get an uninitilized constant error. And when I try to include
'/lib/filenames' I get a load error.
Is this the most conventional way to create a method that I can access
anywhere? Should I create a class instead?
How can I get it working? :)
Thanks!

Prevent class from being allocated in iOS

Prevent class from being allocated in iOS

I'm wondering how it is possible to create a class in Objective-C that
cannot be allocated (or init)?
I'm trying to replicate the SKDownload Apple class (StoreKit framework)
and I noticed that the documentation doesn't mention any alloc or init
methods. This may be missing in the documentation but present in the code
? (some .h declaration missing to prevent us from using this method?).
I've tried to +alloc-init this class and either alloc and init return
null.
What I'm trying to achieve is a class B that possesses only getters, that
can only be created by a class A (just like factory methods would do -
only A can create and return B instances, but the user cannot create B
directly).
Example:
@interface A : NSObject
// Only A "+createB" class method can create B instances
+ (Second *)createBWithValue:(int)value;
@end
@interface B : NSObject
- (id)init; // return nil
+ (id)alloc; // return nil
- (int)value; // this returns the value passed from A
@end
Question 1: How would you proceed to create such classes? Is is possible ?
Question 2: How can - (int)value on B return the value passed in the class
method in A? (knowing that +alloc, -init and/or other memory allocation
methods may be nullified since users cannot create B classes directly -
also custom initWithValue methods in B may be unavailable too)
I'm a little confused on how the Apple engineers do that..are there hidden
methods that Apple doesn't want me to use?
Thanks you.

Hadoop streaming fail in R

Hadoop streaming fail in R

I am running the sample script of RHadoop to test out the system and using
the following commands.
library(rmr2)
library(rhdfs)
Sys.setenv(HADOOP_HOME="/usr/bin/hadoop")
Sys.setenv(HADOOP_CMD="/usr/bin/hadoop")
Sys.setenv(HADOOP_STREAMING="/opt/cloudera/parcels/CDH-4.3.0-1.cdh4.3.0.p0.22/lib/hadoop-mapreduce/hadoop-streaming.jar")
hdfs.init()
ints = to.dfs(1:100)
calc = mapreduce(input = ints, map = function(k, v) cbind(v, 2*v))
But it's giving me an error like below.
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException:
Class org.apache.hadoop.streaming.AutoInputFormat not found at
org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1587) at
org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1611)
13/08/21 18:30:25 INFO mapred.JobClient: Job complete:
job_201308191923_0307 13/08/21 18:30:25 INFO mapred.JobClient: Counters: 7
13/08/21 18:30:25 INFO mapred.JobClient: Job Counters 13/08/21 18:30:25
INFO mapred.JobClient: Failed map tasks=1 13/08/21 18:30:25 INFO
mapred.JobClient: Launched map tasks=8 13/08/21 18:30:25 INFO
mapred.JobClient: Data-local map tasks=8 13/08/21 18:30:25 INFO
mapred.JobClient: Total time spent by all maps in occupied slots
(ms)=46647 13/08/21 18:30:25 INFO mapred.JobClient: Total time spent by
all reduces in occupied slots (ms)=0 13/08/21 18:30:25 INFO
mapred.JobClient: Total time spent by all maps waiting after reserving
slots (ms)=0 13/08/21 18:30:25 INFO mapred.JobClient: Total time spent by
all reduces waiting after reserving slots (ms)=0 13/08/21 18:30:25 ERROR
streaming.StreamJob: Job not Successful! Streaming Command Failed! Error
in mr(map = map, reduce = reduce, combine = combine, in.folder = if
(is.list(input)) { : hadoop streaming failed with error code 1
Any lead about what may be wrong here

Displaying backbone template in a new window

Displaying backbone template in a new window

I need to open a backbone template in a new window. Is this possible?
Currently I've got a template that is being displayed within a div but I
need this content to display in a new window? I thought using a route
might be the way to go but I'm not sure.
I'm a noob to backbone so there's probably a better way to do this.
In my view I've got:
events:
{
'click #active-bets' : 'loadActiveBetsPage',
}
loadActiveBetsPage: function(e)
{
var MyApp = new Backbone.Router();
MyApp.navigate('activebets', {trigger: true});
// , {trigger: true, target: "_blank"}
},
I thought I might get lucky and be able to pass a target: "_blank"
parameter here.
in my routes sections:
var AppRouter = Backbone.Router.extend({
routes: {
":activebets" : "renderActiveBets",
"*actions" : "defaultRoute"
} });
app_router.on('route:renderActiveBets', function () {
$this.activeBetsView = new ActiveBetsView( { el:
$this.elAccountInfo });
$this.activeBetsView.render();
/* thought something like this might help possibly
if ($(event.currentTarget).prop('target') === '_blank') {
return true;
}
*/
});`
Thank you in advance for any help on this one.

Wednesday, 21 August 2013

check ethernet connection periodically android

check ethernet connection periodically android

I'm trying to periodically check the network connection. However, this is
for a Chinese Android Mini PC, not a tablet or smartphone. I'm using an
ethernet to usb adapter instead of Wi-Fi. First I used a broadcastreceiver
class:
public class NetworkStateReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getExtras() != null) {
@SuppressWarnings("deprecation")
NetworkInfo eni = (NetworkInfo) intent.getExtras().get(
ConnectivityManager.EXTRA_NETWORK_INFO);
if (eni != null && eni.getState() ==
NetworkInfo.State.CONNECTED) {
Log.d(TAG, "Network " + eni.getTypeName() + " connected.");
}
}
if (intent.getExtras().getBoolean(
ConnectivityManager.EXTRA_NO_CONNECTIVITY, Boolean.FALSE)) {
Log.d(TAG, "There's no network connectivity.");
}
}
}
This works perfectly for Wi-Fi and mobile. However, for ethernet, there
are complications. When I connect the ethernet to usb adapter, it thinks
it already has ETHERNET connection, whether the ethernet cable is
connected or not. Only when removing the adapter, it knows the ethernet
connection was removed.
I tried using a socket, and this kind of works:
private static boolean checkSocket(String host, int port) {
Socket socket = null;
boolean reachable = false;
try {
socket = new Socket(InetAddress.getByName(host), port);
reachable = true;
} catch (UnknownHostException e) {
} catch (IOException e) {
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
}
}
}
return reachable;
}
When there is a connection, it works perfectly and fast. When the
connection is lost, it takes way too long for the program to know it has.
I need this solution, but it should know way faster that the ethernet
connection has been lost. Also, this relies on Exceptions, which I'm not
fond of at all.
Lastly I tried a simple ICMP message:
try {
InetAddress address = InetAddress.getByName(host);
if (address.isReachable(timeout)) {
return true;
}
} catch (UnknownHostException e) {
} catch (IOException e) {
}
return false;
This should work, right? Unfortunately, it doesn't. Until now, I've always
received a false when executing this code.
What am I doing wrong and what is the correct way to do this?

How Should I Debug Samba with GDB

How Should I Debug Samba with GDB

I'm not good at English, and I'm sorry about that.
Now, There is a question about when I debug samba with GDB.
gdb /usr/local/samba/sbin/smbd
GNU gdb Red Hat Linux (5.2.1-4) Copyright 2002 Free Software Foundation,
Inc. GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under certain
conditions. Type "show copying" to see the conditions. There is absolutely
no warranty for GDB. Type "show warranty" for details. This GDB was
configured as "i386-redhat-linux"... (gdb) r Starting program:
/usr/local/samba/sbin/smbd
Program exited normally. (gdb) info program
The program being debugged is not being run.
So, How should I debug samba with GDB.
ps: Version of Samba 3.0.5 I install samba from source code.

Getting a '405 error page' when a modified request containing 'web' in the URL is submitted in WebShere

Getting a '405 error page' when a modified request containing 'web' in the
URL is submitted in WebShere

When a user tries to modify the url and add "web" in it and submit it, he
gets an '405 error page. 405 Method Not Allowed'. This is a security issue
as the user is not supposed to know that such a folder exists in the
project. How to block this request in the Websphere Application Server
6.0?

Python 3, increment iterator

Python 3, increment iterator

I am processing a file line by line. Each line is checked, whether it
contains a given text. Then, the next line needs to be assigned to the
variable
i_line = iter(file)
for i_line in file:
if text in i_line:
#Go to the next line
line = next(i_line, None) #A problem
break
How to increment iterator i_line so as to point to the next line of the
file? Both constructions do not work for me
next(i_line, None)
i_line.next()

Mobile Phone Touch Event

Mobile Phone Touch Event

I want to create a slider. Here is my javascript code:
<div
style='width:50px;height:50px;position:absolute;top:0;left:0;background:#000'>
</div>
<script type="text/javascript">
$(document).bind('mousemove',function(ev){
$('#ghgh').offset({left:(ev.pageX-25)});});
</script>
This, however, only works in computers but not touch screen. I have tried
to use events like touchmove,slide,scroll,etc. yet none of them works.
What events should I use in order to make it works in touch screens?

Read only SSCC from EAN-128 barcode

Read only SSCC from EAN-128 barcode

We have a Motorola barcode scanner with datawedge installed. We use
EAN-128 barcodes that contain only the SSCC. For GS1 compliance, the
barcode also contains the application identifier ("00") because it is a
SSCC (FNC code is included in the barcode). At the moment, when we scan a
barcode in a application, we get "00123456789123456789" (the "00" at the
beginning are the application identifier for the SSCC) which cannot be
processed by our application. We have to also support barcodes that are
not SSCCs but look very similar: "000000009123456789" The "00" at the
beginning are not applications identifiers (there is no FNC code in the
barcode).
Question: Can the Datawedge software be configured to only extract the
SSCC number -> "123456789123456789" without the application identifier
while still supporting non GS1 barcodes that have leading zeros?

jQuery JSONP not working anymore?

jQuery JSONP not working anymore?

I have been trying to load a JSON file from a cross-domain server. I've
tried examples from stackoverflow and from the jQuery docs. I did get it
working in a previous project, but now it strangely does not. The error
returned from jQuery is unreadable to me. What can possibly go wrong here?
$(document).ready(function() {
console.log("Start loading");
$.ajax({
type: 'GET',
url: "http://www.nightoferror.nl/data/test.js",
dataType: 'jsonp',
crossDomain: true,
error: function(data) {
console.log('error', data);
},
success: function(data) {
console.log('success', data);
}
});
});
And the erratic JSFiddle here: http://jsfiddle.net/ZuyJV/1/

Tuesday, 20 August 2013

left join result is not as expected

left join result is not as expected

I have two table From microsoft Access Database like this
1.HR_Personnel
+-----+---------------+----------------------+
| ID | NIP | Name |
+---------------------+----------------------+
| 1 | 050803075200 | Teguh |
| 2 | 050803075201 | Supomo |
| 3 | 091121128829 | DHINI ADHITYAS M |
| 4 | 011103078923 | INDAHSARI YULIYANTI |
| 5 | 050825018108 | BAGUS NANDANG SATRIA |
| 6 | 050917077217 | IMAM ABADI |
| 7 | 050811118407 | EKA ANDIKA LATIF |
| 8 | 011102018725 | YANUAR ADE BAGUS |
| 9 | 011208088831 | RIZKY BESAR WIBOWO |
| 10 | 021208088832 | FAJAR HIDAYAT |
| 11 | 011107068624 | DWI PUTRI FITRIANI |
| 12 | 031105098527 | VERA HELZA |
| 13 | 121919128522 | MAYLINDA ALFIANDA |
| 14 | 191122198630 | M ESACK MAULANA |
| 15 | 061204291133 | YUSTIANA PRIMA P |
| 16 | 050809096910 | SAPTO WIDODO |
| 17 | 050828107812 | SATINO |
| 18 | 050819098811 | PURNOMO SETIAWAN |
| 19 | 19 | URIPTO WIBOWO |
| 20 | 121228018835 | RISKA IRMANANINGTYAS |
| 21 | 121202108834 | OKTARISA HALIDA |
| 22 | 22 | heri |
+-----+---------------+----------------------+
TA_Record_Info
+---------+-----------------------+
| Per_Code| Date_Time |
+---------+-----------------------+
| 14 | 2013-02-20 07:45:57 |
| 7 | 2013-02-20 17:24:13 |
| 18 | 2013-02-20 18:18:07 |
| 5 | 2013-02-21 07:53:40 |
| 2 | 2013-02-21 20:31:02 |
| 17 | 2013-02-21 17:31:57 |
| 15 | 2013-02-21 17:31:57 |
| 6 | 2013-02-21 17:31:57 |
| 16 | 2013-02-21 17:31:57 |
| 9 | 2013-02-21 17:31:57 |
| 8 | 2013-02-21 17:31:57 |
| 4 | 2013-02-21 17:31:57 |
| 13 | 2013-02-21 17:31:57 |
| 17 | 2013-02-21 17:31:57 |
| 6 | 2013-02-21 17:31:57 |
| 4 | 2013-02-21 17:31:57 |
| 14 | 2013-02-21 17:31:57 |
| 10 | 2013-02-21 17:31:57 |
| 9 | 2013-02-21 17:31:57 |
| 5 | 2013-02-21 17:31:57 |
| 11 | 2013-02-21 17:31:57 |
| 14 | 2013-02-21 17:31:57 |
| 3 | 2013-02-21 17:31:57 |
| 2 | 2013-02-21 17:31:57 |
| 15 | 2013-02-21 17:31:57 |
| 19 | 2013-02-21 17:31:57 |
| 1 | 2013-02-21 17:31:57 |
| 13 | 2013-02-21 17:31:57 |
| 3 | 2013-02-21 17:31:57 |
| 2 | 2013-02-21 17:31:57 |
+---------+-----------------------+
I want to join 2 tables left is then split datetime into date, InTime, and
OutTime so that we know employees who do not the present(no datetime, in
time and out time).But when I left join that tables The result just show
heri (NIP = 22) and OKTARISA Halida (NIP = 121 202 108 834) as the results
who employees are not present . I use this query and results
Microsoft Access Query
SELECT p.Per_Code AS NIP,
p.Per_Name AS Nama,
Format (a.Date_Time, 'yyyy-mm-dd') as adate,
IIF((Min(a.Date_Time) <> Max(a.Date_Time)),
Format (Min(a.Date_Time), 'hh:mm:ss'),
IIF( Format (Min(a.Date_Time),
'hh:mm:ss') < '12:00:00',
Format (Min(a.Date_Time),
'hh:mm:ss'),
'-'
)
)as InTime,
IIF((Max(a.Date_Time) <> Min(a.Date_Time)),
Format (Max(a.Date_Time), 'hh:mm:ss'),
IIF( Format (Max(a.Date_Time),
'hh:mm:ss') > '12:00:00',
Format (Max(a.Date_Time),
'hh:mm:ss'),
'-'
)
)as OutTime
FROM HR_Personnel AS p
LEFT JOIN TA_Record_Info a
ON p.ID=a.Per_Code
GROUP BY p.Per_Code,
p.Per_Name,
Format (a.Date_Time, 'yyyy-mm-dd')
Order BY Format (a.Date_Time, 'yyyy-mm-dd'),
Right(p.Per_Code,2),
p.Per_Name;
Result
+----------------+---------------------+-------------+-------------+-------------+
| NIP | Nama | adate | InTime |
OutTime |
+----------------+---------------------+-------------+-------------+-------------+
| 22 | heri | | | -
|
| 121202108834 | OKTARISA HALIDA | | | -
|
| 050812066200 | TEGUH SUMARYONO | 2012-08-31 | - |
18:18:07 |
| 050803075201 | SUPOMO | 2012-08-31 | 15:06:06 |
20:57:48 |
| 050811118407 | EKA ANDIKA LATIF | 2012-08-31 | - |
14:59:18 |
| 050825018108 | BAGUS NANDANG SATRIA| 2012-08-31 | 15:03:45 |
17:31:57 |
| 050809096910 | SAPTO WIDODO | 2012-08-31 | - |
15:56:02 |
| 050819098811 | PURNOMO SETIAWAN | 2012-08-31 | - |
15:01:16 |
| 050828107812 | SATINO | 2012-08-31 | 15:09:07 |
16:30:22 |
| 050917077217 | IMAM ABADI | 2012-08-31 | 15:54:38 |
16:31:50 |
| 19 | URIPTO WIBOWO | 2012-08-31 | - |
18:07:06 |
| 121919128522 | MAYLINDA ALFIANDA | 2012-08-31 | 16:27:06 |
20:53:20 |
| 011103078923 | INDAHSARI YULIYANTI | 2012-08-31 | 16:25:46 |
16:32:37 |
| 011107068624 | DWI PUTRI FITRIANI | 2012-08-31 | - |
17:24:20 |
| 011102018725 | YANUAR ADE BAGUS | 2012-08-31 | - |
16:24:50 |
| 091121128829 | DHINI ADHITYAS M | 2012-08-31 | 17:25:30 |
20:53:39 |
| 191122198630 | M ESACK MAULANA | 2012-08-31 | 14:47:00 |
17:25:21 |
| 011208088831 | RIZKY BESAR WIBOWO | 2012-08-31 | 16:23:38 |
16:35:37 |
| 021208088832 | FAJAR HIDAYAT | 2012-08-31 | - |
16:35:14 |
| 061204291133 | YUSTIANA PRIMA P | 2012-08-31 | 15:15:42 |
17:30:21 |
+----------------+---------------------+-------------+-------------+-------------+
I've tried with a simple query that just left the join of the two tables
but the result is still the same.The result just show heri (NIP = 22) and
OKTARISA Halida (NIP = 121 202 108 834) as the results who employees are
not present
Query
SELECT p.Per_Code AS NIP,
p.Per_Name AS Nama,
a.Date_Time as adate
FROM HR_Personnel AS p
LEFT JOIN TA_Record_Info a
ON p.ID=a.Per_Code
Order BY a.Date_Time
Please help me out from my problem. thanks

Due to modal other links are disabled even it is disappear

Due to modal other links are disabled even it is disappear

I am creating a list of message and each message is having a link. If I
click on link then a modal is popping up. My problem is even modal is
disappeared other links on the page (I am talking about parent page not
modal page) is getting disabled. If I remove the modal, links are working
and if I change the position of modal then other links are getting the
same issue. I am using twitter bootstrap for creating modal. Any
suggestion will be appreciated.

Amazon MWS (PHP) - How does the request work

Amazon MWS (PHP) - How does the request work

I am trying to pull a report in PHP for active listings.
I've made progress, however, I cannot understand how this works and there
is nothing out there that can explain it.
For example, in the Samples provided from the PHP library, I see quite a
few XML files. When you run the RequestReportResponse sample, does that
generate the XML file, or does the XML file tell the RequestReportResponse
what to do based on values and functions?
I am asking because, with the MWS Scratchpad - I select all the necessary
fields, submit it then refresh the Amazon Reports page of my seller
central section and it shows a pending report.
I'm just asking how the XML content affects the report or how the report
can affect the XML.
Thanks all, I appreciate any help.

In Magento, how can I modify the tax amount on the fly depending on a custom address attribute?

In Magento, how can I modify the tax amount on the fly depending on a
custom address attribute?

I need to only charge taxes on orders where the custom address attribute I
created called "Home Address" is set to be true. How/where can I set this
up?

Display angularFireCollection

Display angularFireCollection

I'm having trouble getting angularFireCollection to work with ng-repeat.
My template is not populating, however, when I execute the add method,
then my ng-repeat list does populate with existing data + the new item I
added.
I would like to see all players in the db load immediately.
I'm initializing my object like this:
`$scope.players = angularFireCollection(url);
My template looks like this:
<li ng-repeat="p in players">{{ p.name }}</div>
Immediately after I initialize $scope.players, I run console.log on
$scope.players, and get this: (note, you can see I have a name value in
the first element set to test.
[getByName: function, add: function, remove: function, update: function,
order: Array[3]]
0: angularFireItem
$$hashKey: "004"
$id: "-J1PUOMGmf0h19PJeUlu"
$index: 0
$ref: J
name: "test"
priority: null
__proto__: angularFireItem
1: angularFireItem
2: angularFireItem
add: function (item, cb) {
getByName: function (name) {
length: 3
order: Array[3]
remove: function (itemOrId, cb) {
update: function (itemOrId, cb) {
__proto__: Array[0]

multiple dynamic url convert into static url using .htacess file in php for linux hosting

multiple dynamic url convert into static url using .htacess file in php
for linux hosting

http://kyitseling.org/sysinfotools/viewproductdetail.php?name=BKFRecovery
firstdynamic url
http://kyitseling.org/sysinfotools/viewproductds.php?catname=Backup
Recovery Software
second url
http://kyitseling.org/sysinfotools/Product-buy-now.php?pid=80
third url
http://kyitseling.org/sysinfotools/Buy-Now.php?id=19
fourth url
i want to display all dynamic page like this way
http://kyitseling.org/sysinfotools/Backup Recovery Software
http://kyitseling.org/sysinfotools/BKF%20Recovery
http://kyitseling.org/sysinfotools/80
http://kyitseling.org/sysinfotools/19
in my website.so what code i have to write.htacess file in my .htacess
file in php project .htacess file
my current .htacess code is
RewriteEngine On RewriteRule (.).htm$ viewproducts.php?catname=$1 this
code only work for second url when i am write RewriteRule (.).htm$
viewproductsdetails.php?name=$1 then this case we redirect
viewproductspage only one work so how i rewrite all url .please help
me.........