self.tabBarController.selectedViewController thrown off by uinavigationController - uinavigationcontroller

I have a single view application containing a tabBarController, a navigationController, and two views (xcode 4.2). I want to identify when a given tab has been selected, and planned on doing so using the following code:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSLog(#"in testtableView. %#", self.tabBarController.selectedViewController);
NSLog(#"in testtableView. tab bar index is: %i", self.tabBarController.selectedIndex);
}
this code is included in both views. It works perfectly when the navigationController is not there, ie, when the application is a simple tabbed application. But when the navigationController is included, it causes the indexes to "slip" by one the first time the second tab (the navigationController) is selected, but not there-after if the user decides to continue switching between the tabs.
Here are two screen-shots:
screen shots http://s1305.photobucket.com/user/michael_jensen2/media/Screenshot2013-04-07at50743PM_zps1fab25ab.png.html?evt=email_share.
I tried putting them on photobucket.. any better way of doing it? Here is the output, calling each of the functions in different tests:
2013-04-07 17:21:31.728 testTabBar[1921:207] in firstViewController. <tabBarTestFirstViewController: 0x684ea80>
2013-04-07 17:21:53.626 testTabBar[1921:207] in secondViewConroller. <UINavigationController: 0x684fce0>
2013-04-07 17:22:04.528 testTabBar[1921:207] in firstViewController. <UINavigationController: 0x684fce0>
2013-04-07 17:22:06.544 testTabBar[1921:207] in secondViewConroller. <tabBarTestFirstViewController: 0x684ea80>
2013-04-07 17:22:07.392 testTabBar[1921:207] in firstViewController. <UINavigationController: 0x684fce0>
2013-04-07 17:22:07.816 testTabBar[1921:207] in secondViewConroller. <tabBarTestFirstViewController: 0x684ea80>
2013-04-07 17:22:08.288 testTabBar[1921:207] in firstViewController. <UINavigationController: 0x684fce0>
.
2013-04-07 17:50:33.075 testTabBar[2066:207] in firstViewController. tab bar index is: 0
2013-04-07 17:50:37.526 testTabBar[2066:207] in secondViewConroller. tab bar index is: 1
2013-04-07 17:50:37.982 testTabBar[2066:207] in firstViewController. tab bar index is: 1
2013-04-07 17:50:38.301 testTabBar[2066:207] in secondViewConroller. tab bar index is: 0
2013-04-07 17:50:38.668 testTabBar[2066:207] in firstViewController. tab bar index is: 1
2013-04-07 17:50:39.100 testTabBar[2066:207] in secondViewConroller. tab bar index is: 0
2013-04-07 17:50:39.532 testTabBar[2066:207] in firstViewController. tab bar index is: 1
2013-04-07 17:50:39.988 testTabBar[2066:207] in secondViewConroller. tab bar index is: 0
2013-04-07 17:50:40.372 testTabBar[2066:207] in firstViewController. tab bar index is: 1
any thoughts? There may be a solution to this already posted, but I haven't found it yet.
-mike

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController;
{
if (tabBarController.selectedIndex == 0) {
}
else if (tabBarController.selectedIndex == 1)
{
}
}

Related

what would be the best way to make unordered list (ul) responsive?

I have some data and would like to organise them in a responsive way. It does not have to be unordered list, can be divs or anything else really.
I would like to see first 6 elements in a row on a big screen, then the next 6 etc. see the picture below.
on smaller screen 4 and 2 on the smallest. What do you recon would be the best way to use? flex? floats? grid?
Dont want to use tables.
domainname:
something.com
sld:
something
tld:
com
backend:
Veri
registrant:
DEMYS-C-1999
admin:
DEMYS-C-1999
tech:
C-1999
billing:
-C-1999
status:
clientUpdateProhibited
clientDeleteProhibited
clientTransferProhibited
authinfo:
C4m7
lapse:
0000-00-00 00:00:00
locked:
0
ROID:
24660317_DOMAIN_COM-VRSN
missioncritical:
1
domaincreation:
2000-04-11 09:40:35
domainexpiration:
2027-04-30 11:59:59
domainupdate:
2017-09-27 10:24:51
domainportfolio:
2002-04-12 00:00:00
dnsaverage:
1294753
additional:
{"custom
account:
2005
ID:
2438
created:
2016-01-13 09:44:03
updated:
2017-11-14 21:20:12
changed:
onSaveCallbacks:
accountname:
Demo
accountid:
20059
organisation:
Limited
nameservers:
ns0.

Firebase resetting the key

I am using Firebase as follow:
Post--
-Kwc6asRRI1SUqrigYeD <- First input
-> Date: 1:00pm
-> ID: 1
-> Content: Hello!
-Kwc6fXQsN2xIQtHOofZ
-> Date: 2:00pm
-> ID: 2
-> Content: How are you?
-Kwc6fXQsN2xRO39LDPD <-Most recent one
-> Date: 3:00pm
-> ID: 3
-> Content: I am good.
These are "pushed" thus an unique key is generated which can be used to display them according to the "most recent to old" (or ID:3 to ID:1).
Now, when I need to update a data, let say ID:1 post's content from "Hello" to "My name is Steve", then it still maintains the unique key even though this is the most recent one.
Post--
-Kwc6asRRI1SUqrigYeD <-Most recent one
-> Date: 4:00pm
-> ID: 1
-> Content: My name is Steve
-Kwc6fXQsN2xIQtHOofZ
-> Date: 2:00pm
-> ID: 2
-> Content: How are you?
-Kwc6fXQsN2xRO39LDPD
-> Date: 3:00pm
-> ID: 3
-> Content: I am good.
I guess I can delete the post and set a new one, but that seems inefficient especially if I have more data on each child.
Is there a way to re-set the key so that it reflects the time change (like below)?
Post--
-Kwc6fXQsN2xIQtHOofZ
-> Date: 2:00pm
-> ID: 2
-> Content: How are you?
-Kwc6fXQsN2xRO39LDPD
-> Date: 3:00pm
-> ID: 3
-> Content: I am good.
-Kwc6asRRI1KDodkeixk <-Most recent one
-> Date: 4:00pm
-> ID: 1
-> Content: My name is Steve
There is no way to update the key of an existing node (see 1, 2, 3). If you want a new key, you'll have to generate a new node with the same content.
But in this case it seems much more likely that you want to keep your data structure as is and instead add a lastUpdated timestamp to each post:
Post--
-Kwc6asRRI1SUqrigYeD
-> Date: 1:00pm
-> lastUpdated: 1508215054096
-> ID: 1
-> Content: Hello!
-Kwc6fXQsN2xIQtHOofZ
-> Date: 2:00pm
-> lastUpdated: 1507610306270
-> ID: 2
-> Content: How are you?
-Kwc6fXQsN2xRO39LDPD
-> Date: 3:00pm
-> lastUpdated: 1508128668412
-> ID: 3
-> Content: I am good.
With this structure you can use a Firebase query to get the results in the order you want. In JavaScript this would look something like:
var ref = firebase.database().reference("Post");
ref.orderByChild("lastUpdated")
.once("value")
.then(function(snapshot) {
snapshot.forEach(function(post) {
console.log(snapshot.key+": "+snapshot.val().Content);
});
});

Format number with localizednumber('currency') give me ¤ instead $

I have a symfony app, and I change locale in app/config/config.yml based on user preference.
I'm using this twig filter(from intl extension) on my template
<td> {{ entity.total | localizednumber('currency')}} </td>
For example, using 'es' locale I want this output
Id Total
28 250,00 $
For 'en' locale I want this output:
Id Total
28 $ 250.00
However I get this output:
Id Total
28 250,00 ¤
So what is that ¤ simbol? A error or I'm doing something wrong?
You probably declare the charset iso-8859-1 instead of iso-8859-15
in iso-8859-1, 0xA4 represent ¤
in iso-8859-15, 0xA4 represent €

qt QWebView fails on loading jQuery page

I have been struggling this problem lately and couldn’t find any solution for that. So, I’d appreciate if you could really look into this.
There is a target website which runs JQuery when I click on a specific button. When I connect to the signals of QWebView and QNetworkAccessManager, I see the it hangs loading jquery_modules.min_22190.js. I have no clue why this happens.
Here is a minimal code that you can try and see: https://www.dropbox.com/s/4rooelcjbcl9qus/minimal_webview.zip
Last thing that I see in the logs:
finished "Unknown error" , code: 0 QUrl( "http://www2.thewebsite.be/nl/js/jquery/jquery_modules.min_22190.js" )
Header 1 = "Date" : "Sat, 26 Jul 2014 08:50:55 GMT"
Header 2 = "Server" : "Apache"
Header 3 = "X-Frame-Options" : "SAMEORIGIN"
Header 4 = "Cache-Control" : "max-age=604800"
Header 5 = "Expires" : "Sat, 02 Aug 2014 08:50:55 GMT"
Header 6 = "Vary" : "Accept-Encoding,User-Agent"
Header 7 = "Content-Encoding" : "gzip"
Header 8 = "P3P" : "CP='NOI DSP COR PSAo PSDo'"
Header 9 = "Keep-Alive" : "timeout=5, max=200"
Header 10 = "Connection" : "Keep-Alive"
Header 11 = "Content-Type" : "text/html; charset=iso-8859-15"
Thanks a lot in advance,
I have solved the issue by moving to Qt 5.3. The above mentioned problem is not reproducible there.

Sling Servlet as a Service in CQ5 (OSGi Bundle)

We trying to create a osgi backend service for CQ5. We are using the cqblueprints archetype with eclipse as the dev environment. And we are able to deploy it to CQ using the console. In the CQ Web console we can view the details of the bundle as
com.acme.wcm.cq - acme-corporate-servicescom.acme.wcm.cq.acme-corporate-services
Symbolic Name com.acme.wcm.cq.acme-corporate-services
Version 1.0.0.SNAPSHOT
Bundle Location inputstream:acme-corporate-services-1.0.0-SNAPSHOT.jar
Last Modification Fri Apr 18 12:30:34 PDT 2014
Description Bundle containing the backend services for acme CQ
Start Level 20
Bundle Classpath .,OSGI-INF/lib/json-simple-1.1.jar,OSGI-INF/lib/commons-lang-2.3.jar,OSGI-INF/lib/gson-2.2.4.jar,OSGI-INF/lib/org.apache.servicemix.bundles.rome-1.0_3.jar,OSGI-INF/lib/org.apache.servicemix.bundles.jdom-2.0.2_1.jar,OSGI-INF/lib/org.apache.servicemix.bundles.jaxen-1.1.6_1.jar,OSGI-INF/lib/org.apache.servicemix.bundles.dom4j-1.6.1_5.jar,OSGI-INF/lib/xml-apis-1.0.b2.jar
Exported Packages com.acme.wcm.cq.exception,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.feed,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.feed.util,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.filter,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.osgi,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.search,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.servlet,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.servlet.model,version=1.0.0.SNAPSHOT
com.acme.wcm.cq.util,version=1.0.0.SNAPSHOT
Imported Packages com.day.cq.search,version=0.0.0 from com.day.cq.cq-search (209)
com.day.cq.search.result,version=0.0.0 from com.day.cq.cq-search (209)
com.day.cq.wcm.api,version=1.0.0 from com.day.cq.wcm.cq-wcm-api (288)
javax.jcr,version=2.0.0 from org.apache.sling.jcr.jcr-wrapper (76)
javax.jcr,version=1.1.0 from org.apache.sling.jcr.jcr-wrapper (76)
javax.servlet, ble,version=0.0.0.1_007_JavaSE from org.apache.felix.framework (0)
javax.swing.tree,version=0.0.0.1_007_JavaSE from org.apache.felix.framework (0)
javax.xml.bind,version=2.1.0 from org.apache.felix.framework (0)
javax.xml.namespace,version=0.0.0.fragment_xml from org.apache.felix.framework (0)
javax.xml.stream,version=1.0.0 from org.apache.felix.framework (0)
javax.xml.stream.events,version=1.0.0 from org.apache.felix.framework (0)
javax.xml.stream.util,version=1.0.0 from org.apache.felix.framework (0)
javax.xml.validation,version=0.0.0.fragment_xml from org.apache.felix.framework (0)
org.apache.sling.api,version=2.2.0 from org.apache.sling.api (123)
org.apache.sling.api.request,version=2.3.0 from org.apache.sling.api (123)
org.apache.sling.api.resource,version=2.3.2 from org.apache.sling.api (123)
org.apache.sling.api.servlets,version=2.1.0 from org.apache.sling.api (123)
org.osgi.framework,version=1.6.0 from org.apache.felix.framework (0)
org.slf4j,version=1.6.4 from slf4j.api (14)
Manifest Headers Bnd-LastModified: 1397849403046
Build-Jdk: 1.7.0_45
Built-By: jsunny
Bundle-Activator: com.acme.wcm.cq.osgi.Activator
Bundle-ClassPath: ., OSGI-INF/lib/json-simple-1.1.jar, OSGI-INF/lib/commons-lang-2.3.jar, OSGI-INF/lib/gson-2.2.4.jar, OSGI-INF/lib/org.apache.servicemix.bundles.rome-1.0_3.jar, OSGI-INF/lib/org.apache.servicemix.bundles.jdom-2.0.2_1.jar, OSGI-INF/lib/org.apache.servicemix.bundles.jaxen-1.1.6_1.jar, OSGI-INF/lib/org.apache.servicemix.bundles.dom4j-1.6.1_5.jar, OSGI-INF/lib/xml-apis-1.0.b2.jar
Bundle-Description: Bundle containing the backend services for acme CQ
Bundle-ManifestVersion: 2
Bundle-Name: com.acme.wcm.cq - acme-corporate-services
Bundle-SymbolicName: com.acme.wcm.cq.acme-corporate-services
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *; scope=compile|runtime
Embed-Directory: OSGI-INF/lib
Embed-Transitive: true
Embedded-Artifacts: OSGI-INF/lib/json-simple-1.1.jar; g="com.googlecode.json-simple"; a="json-simple"; v="1.1", OSGI-INF/lib/commons-lang-2.3.jar; g="commons-lang"; a="commons-lang"; v="2.3", OSGI-INF/lib/gson-2.2.4.jar; g="com.google.code.gson"; a="gson"; v="2.2.4", OSGI-INF/lib/org.apache.servicemix.bundles.rome-1.0_3.jar; g="org.apache.servicemix.bundles"; a="org.apache.servicemix.bundles.rome"; v="1.0_3", OSGI-INF/lib/org.apache.servicemix.bundles.jdom-2.0.2_1.jar; g="org.apache.servicemix.bundles"; a="org.apache.servicemix.bundles.jdom"; v="2.0.2_1", OSGI-INF/lib/org.apache.servicemix.bundles.jaxen-1.1.6_1.jar; g="org.apache.servicemix.bundles"; a="org.apache.servicemix.bundles.jaxen"; v="1.1.6_1", OSGI-INF/lib/org.apache.servicemix.bundles.dom4j-1.6.1_5.jar; g="org.apache.servicemix.bundles"; a="org.apache.servicemix.bundles.dom4j"; v="1.6.1_5", OSGI-INF/lib/xml-apis-1.0.b2.jar; g="xml-apis"; a="xml-apis"; v="1.0.b2"
Export-Package: com.acme.wcm.cq.exception; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.feed; uses:="javax.jcr, com.day.cq.search.result, org.apache.sling.api.resource"; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.feed.util; uses:="javax.jcr, com.day.cq.search.result, org.apache.sling.api.resource"; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.filter; uses:="javax.servlet, org.apache.sling.api.request, org.apache.sling.api, org.slf4j"; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.osgi; uses:="org.osgi.framework"; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.search; uses:="javax.jcr, com.day.cq.search.result, org.apache.sling.api"; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.servlet; uses:="org.apache.sling.api.servlets, javax.servlet, org.apache.sling.api, org.slf4j, javax.jcr, com.acme.wcm.cq.search, com.day.cq.search.result, com.acme.wcm.cq.exception, com.acme.wcm.cq.servlet.model"; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.servlet.model; version="1.0.0.SNAPSHOT", com.acme.wcm.cq.util; uses:="javax.jcr, com.day.cq.search.result, org.apache.sling.api, com.day.cq.search, org.apache.sling.api.resource, com.day.cq.wcm.api, org.apache.sling.api.servlets, javax.servlet"; version="1.0.0.SNAPSHOT"
Import-Package: com.acme.wcm.cq.search, com.day.cq.search, com.day.cq.search.result, com.day.cq.wcm.api, com.sun.msv.datatype; resolution:=optional, com.sun.msv.datatype.xsd; resolution:=optional, javax.jcr; version="[2.0, 3)", javax.servlet, javax.swing.table, javax.swing.tree, javax.xml.bind, javax.xml.namespace, javax.xml.stream, javax.xml.stream.events, javax.xml.stream.util, javax.xml.validation, nu.xom; resolution:=optional, org.apache.sling.api; version="[2.2, 3)", org.apache.sling.api.request; version="[2.2, 3)", org.apache.sling.api.resource; version="[2.1, 3)", org.apache.sling.api.servlets; version="[2.1, 3)", org.gjt.xpp; resolution:=optional, org.jdom; resolution:=optional, org.jdom.input; resolution:=optional, org.jdom.output; resolution:=optional, org.osgi.framework; version="[1.4, 2)", org.relaxng.datatype; resolution:=optional, org.slf4j; version="[1.6, 2)", org.xmlpull.v1; resolution:=optional
Manifest-Version: 1.0
Tool: Bnd-1.50.0
But, if I search in the Services menu (in the Felix Console) nothing I could find which I have created.
Is this normal? To verify this I have crated a Simple servelet
import java.io.IOException;
import javax.servlet.ServletException;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.slf4j.Logger;
org.slf4j.LoggerFactory;
#Component(immediate = true, metatype = false)
#Service(value = javax.servlet.Servlet.class)
#Properties(value = { #Property(name = "sling.servlet.methods", value = { "GET" }),
#Property(name = "sling.servlet.paths", value = { "/path/to/my/servlet", "/apps/path/to/my/servlet" }) })
public class AbsoluteUrlServlet extends SlingSafeMethodsServlet {
private static final long serialVersionUID = -1920460619265757059L;
private static final Logger logger = LoggerFactory.getLogger(AbsoluteUrlServlet.class);
#Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
logger.debug("AbsoluteUrlServlet::doGet()");
response.setContentType("text/plain");
response.getOutputStream().print("Hello AbsoluteUrlServlet World!");
}
}
But, when I request the servlet from browser,
http://localhost:4502/apps/path/to/my/servlet
I'm getting the following error.
No resource found
Cannot serve request to /apps/path/to/my/servlet in /libs/sling/servlet/errorhandler/404.jsp
Request Progress:
0 (2014-04-18 12:33:58) TIMER_START{Request Processing}
0 (2014-04-18 12:33:58) COMMENT timer_end format is {<elapsed msec>,<timer name>} <optional message>
0 (2014-04-18 12:33:58) LOG Method=GET, PathInfo=/apps/path/to/my/servlet
0 (2014-04-18 12:33:58) TIMER_START{ResourceResolution}
0 (2014-04-18 12:33:58) TIMER_END{0,ResourceResolution} URI=/apps/path/to/my/servlet resolves to Resource=NonExistingResource, path=/apps/path/to/my/servlet
1 (2014-04-18 12:33:58) LOG Resource Path Info: SlingRequestPathInfo: path='/apps/path/to/my/servlet', selectorString='null', extension='null', suffix='null'
1 (2014-04-18 12:33:58) TIMER_START{ServletResolution}
1 (2014-04-18 12:33:58) TIMER_START{resolveServlet(NonExistingResource, path=/apps/path/to/my/servlet)}
1 (2014-04-18 12:33:58) LOG {0}: no servlet found
1 (2014-04-18 12:33:58) TIMER_END{0,resolveServlet(NonExistingResource, path=/apps/path/to/my/servlet)} Using servlet org.apache.sling.servlets.get.DefaultGetServlet
1 (2014-04-18 12:33:58) TIMER_END{0,ServletResolution} URI=/apps/path/to/my/servlet handled by Servlet=org.apache.sling.servlets.get.DefaultGetServlet
1 (2014-04-18 12:33:58) LOG Applying Requestfilters
1 (2014-04-18 12:33:58) LOG Calling filter: org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter
1 (2014-04-18 12:33:58) LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter
Please provide some pointers to solve the issue.
Finally able to find the reason.
I missed the maven-scr-plugin in my POM.xml due to which the serviceComponents.xml was missing in my bundle.(Please see My previous thread)

Resources