w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
NullPointerException some times on calendar.get(Calendar.Year)
It means that MainActivity.calenda is null. How do you initialize that reference in your code? Sometimes suggests that you haven't paid any attention to thread safety. I think it makes sense now. You've created a static Calendar, which is initialized to null as coded. You only set that instance to a non-null reference in calls to onCreate method. If you do anything else before calling that method, the reference is still null.

Categories : Android

Lots of big textures is slow. Best way to speed up?
First way to speed up that code is to get rid of all functions that are from 20 years ago and convert it to shaders. Fixed pipeline can be very unoptimal on modern hardware, and constant sending data to GPU is also probably killing the performance. Bear in mind that I am using freeglut and so am rather limited to opengl 2. No, that's not true. Freeglut is concerned mostly with window and context creation, and you can still use GLLoad or GLEW to get OGL 3.x or 4.x functions. A quick list of things I see: Fixed pipeline state used glColor No VBO used / combined with deprecated glVertexPointer Perhaps FBO should be used to fill the textures initially?

Categories : Opengl

Slow running order by for a query that has lots of joins
I would suspect that indexing on type and is_draft might not narrow things down enough for MySQL to take any notice of those indexes. If you have an index on creator_id, another on is_public and another on id (which I presume you do as it is probably the primary id) then 3 unioned queries like this might do some good. SELECT * FROM tbl_story t0_ LEFT JOIN tbl_user t1_ ON t0_.creator_id = t1_.id LEFT JOIN tbl_image t2_ ON t1_.avatar_id = t2_.id LEFT JOIN tbl_image t3_ ON t0_.id = t3_.story_id LEFT JOIN tbl_like t4_ ON t0_.id = t4_.story_id AND (t4_.creator_id = 3) LEFT JOIN tbl_comment t5_ ON t0_.id = t5_.story_id LEFT JOIN tbl_like t6_ ON t5_.id = t6_.comment_id AND (t6_.creator_id = 3) LEFT JOIN tbl_user t7_ ON t5_.creator_id = t7

Categories : Mysql

Slow socket's recv on Windows for lots of small messages
The way to manipulate the amount of kernel memory held for a socket in a Java program is to set SO_RCVBUF (in a C/C++ program you'd use setsockopt to do this). I'd rather not reproduced large amounts of code here but rather give you some pointers to look at. Documentation of SocketOptions Documentation of SO_RCVBUF You can use those to cut down the amount that the kernel will buffer before it returns stuff to you. That said, I can't see any reason why if your application has a SOCK_STREAM, it doesn't immediately return any data available. I think something else is likely the issue.

Categories : Java

OpenGL: recommended way of making lots of edits to VBO
Last time I checked the preferred way to do buffer updates was orphaning. Basically, whenever you want to update your buffered data, you call glBindBuffer on your buffer, which invalidates the current content of the buffer, and then you write your new data with glMapBuffer / glBufferSubdata. Hence: Use a single big VBO for your static data is indeed a good idea. You must take care of the maximum allowed VBO size, and split your static data into multiple VBOs if necessary. But this is probably an over-optimization in most cases (i.e. "I wouldn't bother"). Data which is updated frequently should be grouped in the same VBO (with usage = GL_STREAM_DRAW), and you shall use orphaning to update that. Unfortunately, the actual performance of this stuff varies on different implementations. Thi

Categories : C++

Magento back end very slow to open product when lots of prices added
Yes, better hosting. Hosting should be 1% of revenue for companies with under $2million per yea. When you start pushing Magneto with large numbers of custom options, many tier prices, you are entering high end sites and need the hosting budget to match, often 200% or more of the 1% revenue until you hit the balance point. The balance point with pushing Magento is often companies with revenue in the $millions, so if you try and do this with a hosting budget in the $100s thousands you will hit a brick wall. Everything has to be balanced for the store, Google is smarter and know when it is not, so let's say you spend 3mths finding a solution. Google will penalise your ranking anyway, you will have lost 3mths of sales, you will find out that you need that level (unless you are Amazon), and be

Categories : Performance

IE9 and below starts to slow down and hang when adding lots of google map markers via Symbol (SVG path)
Okay I've found a way to load all the symbols in IE9 and below without it hanging, but it's not all at once like the other browsers. Basically, you have to throttle the addition of the markers to the map using setTimout. This allows the IE9 and below browsers to continue working with user interaction while it proceeds to load all the remaining images. If you attempt to load too many too fast without giving the browser a rest, it will start to get choppy in its rendering and appear to be hanging. Important note: it seems that the rendering rate keeps getting slower the more choppy it gets and especially when it hangs although I didn't verify this. Personally, I like one at a time as it shows the user it's still laoding markers. updated fiddle that shows the improvement with throttling.

Categories : Internet Explorer

Moving subviews from one view to another view without changing any position information in storyboard?
Yes there is an easy way to do this: Step 1: Select your views Step 2: Go Editor > Embed In > Scroll View Done! PS. This is a very handy way to group views in fact. You can embed any views into a 'container' view, move it wherever you like (even cross-scene) retaining relative position information and then you could keep it as a group or unembed them.

Categories : Iphone

JQuery Full Calendar - edit calendar view after initialization
If you go through their documentation it is clearly specified. There is a function to change the view. .fullCalendar( 'changeView', viewName ) http://arshaw.com/fullcalendar/docs/views/changeView/

Categories : Javascript

Print a 12 month calendar with only input being the year. Using C
The following compiles, but there are still opportunities for improvement: /* calender.c */ #include <stdio.h> #include <stdlib.h> #define JULIAN 1 #define GREGORIAN 2 /* * return the day of the week for particualr date * flag JULIAN or GREGORIAN * (the divisions are integer divisions that truncate the result) * Sun = 0, Mon = 1, etc. */ int get_week_day(int day, int month, int year, int mode) { int a, m, y; a = (14 - month) / 12; y = year - a; m = month + 12*a - 2; if (mode == JULIAN) { return (5 + day + y + y/4 + (31*m)/12) % 7; } return (day + y + y/4 - y/100 + y/400 + (31*m)/12) % 7; // GREGORIAN } int main(void) { int year, month, date; int startingDay; /* of the week: init from user input*/ char *names[] = {"January", "F

Categories : C

Kendo calendar year change event
Try defining the navigate handler as: navigate: function () { var cur = this._current; var prev = this._previous; if (prev && cur && prev.getFullYear() !== cur.getFullYear()) { alert("year change"); } this._previous = this._current; } What I do is get current date (_current) that is a reference date in current calendar view, then get its year and compare this with the previous date. In addition, and since there is no previous date in a Calendar, I save it for using in the next navigation event. Example here: http://jsfiddle.net/OnaBai/jf2XK/

Categories : Javascript

easily change month and year in calendar in asp.net
If you're looking at a dropdownlist, you have to build it yourself. Do take note of the Leap Year algorithm.

Categories : C#

Subviews management in view hierarchy in iOS
This can be done in two ways : Add subview and then remove old subview when click on other button Add all subview first time and then show and hide them. This is the proper way for memory management.

Categories : Iphone

Backbone.Marionette view with subviews
Why don't you simply use a layout and display your views within the layout's regions? You can see an example here: https://github.com/davidsulc/marionette-gentle-introduction/blob/master/assets/js/apps/contacts/list/list_controller.js#L43-L46

Categories : Javascript

IOS: moving subviews on parent view
You can add Pan gesture to what u want to move: // Add UIPanGestureRecognizer to each circle view u add and set a tag for each circle UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget: self action: @selector(handlePan:)]; [view addGestureRecognizer: panRecognizer]; -(void) handlePan: (UIGestureRecognizer *)sender { UIPanGestureRecognizer *panRecognizer = (UIPanGestureRecognizer *)sender; UIView *view = sender.view; // You can get to know which circle was moved by getting tag of this view if (panRecognizer.state == UIGestureRecognizerStateBegan || panRecognizer.state == UIGestureRecognizerStateChanged) { CGPoint currentPoint = self.center; CGPoint translation = [panRecognizer translationInView: self.superView];

Categories : Iphone

self.view.subviews not showing buttons
self.view.subviews will return only the subviews of that view. For eg. View A->View B ->view C Subviews of View A will list only View B,View C will be only available as the subview of view B So try some recursive method to drilldown into all the subviews

Categories : Objective C

how to add subview to subviews of scroll view
NSArray *greenViewsIndexes=[NSArray arrayWithObjects:[NSNumber numberWithInt:5],[NSNumber numberWithInt:6],[NSNumber numberWithInt:11],[NSNumber numberWithInt:12], nil]; for (int i=0; i<24; i++) { for (int j=0; j>greenViews.count; j++) { if ([[greenViews objectAtIndex:j]intValue]==i){ UIView *greenView=[[UIView alloc]initWithFrame:CGRectMake(71,61*(j+1),100,80)]; [greenView setBackgroundColor:[UIColor greenColor]]; } } //another operations }

Categories : IOS

Prevent view to layout Subviews
Hey super late to the party here but we had relatively the same issue and I wanted to shed a little light on it. We had 3 views contained in our main view: a label, a view containing login fields, and a view containing a facebook button. When you pressed a button it would toggle between the 2 login views and when it encountered an error, the label would scale to 0, switch the text, then scale back up to 1. We found that when the label animated and changed size, the constraints would be reapplied and the first view would be toggled back into position. We found that the documentation for "didLayoutSubviews" says it gets called on the parent of a view when that view changes bounds. We're assuming that it also counts as changing the bounds when you modify the transform of the view. So th

Categories : IOS

UITableViewCell with a lot of subviews or with a single view
Why you are not creating cell in -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath Here you can defines your custom type cell which will also reuse and whenever you want you can add the different thing to cell like this. static NSString *CellIdentifier = @"Cell"; UILabel *RequestSentTo; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ; cell.selectionStyle=UITableViewCellSelectionStyleNone; RequestSentTo = [[UILabel alloc] initWithFrame:CGRectMake(11, 2, 286, 40)]; RequestSentTo.backgroundColor = [UIColor clearColor]; RequestSentTo.tag = 200; RequestSentTo.numberOfLines = 3; RequestSentTo.font=[UIFont boldSystemFontOfSize:15.0]; Re

Categories : IOS

javascript: making a calendar navigation bar
When you are using document.write the second time the calender function is called, you are rewriting the whole HTML and your <head> tags gets lost. That happens when you use document.write after the page finished loading, you should use this instead: <!DOCTYPE html> <html> <style> table { border-collapse:collapse; } table img { width:50px; height:50px; } td,table { border-color:blue; text-align:center; } td:hover { cursor:pointer; background-color:yellow; } </style> <head> </head> <body> <script> var date=new Date(); var mn=['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC']; y=date.getFullYear(); m=date.getMonth(); function preyear() { y -= 1; calendar(); } function premonth(){ m -= 1; calenda

Categories : Javascript

Making Calendar on symfony2 and FOSUserBundle
For a really quick integration go with Google Calendar API and jQuery's FullCalendar. Advantage: API methods already there - just use them if you don't want to start from scratch. If you want Ajax JSON requests to fill the calendar try the FOSRestBundle.

Categories : Symfony2

IOS 6 subviews overlap toolbar in parent view
Your UIToolbar control's Z-Order on it's view is behind your blue view controller. Since you created it in IB, you can add an IBOutlet for it, and bring it's view to top of the parent view. You're loading the ViewControllers as subviews, so they are all subviews of self.view of your parent. In your header definition: IBOutlet *toolBar UIToolbar; Bring to front in your implementation. [self.view bringSubviewToFront:toolBar]; You can do this after you've added the blue controller subview or at the end of all your case statements.

Categories : IOS

How to disable accessibility for a view including all it's subviews?
I would try setting the accessibilityElementsHidden property of the main view to YES. If that does not what you want, I would try overriding the UIAccessibilityContainer methods on the main view to return 0 children.

Categories : Iphone

NSLayoutConstraint subviews won't autoresize to fit container view
I'm surprised you're setting the frame for a view. Generally in auto layout, you'd slide in the view by changing a constraint constant, not by changing a frame. For example, imagine that your constraints for the container's subviews are defined like so (for simplicity's sake, since the two views are supposed to take up 50% of the container, most easily done by defining the two subviews to be the same height): [containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[topView][botView(==topView)]|" options:0 metrics:nil views:views]]; [containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[topView]|" options:0 metrics:nil views:views]]; [containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[botView]|" option

Categories : IOS

Add UIPinchGestureRecognizer on main view and detect touch on subviews
Use hitTest:withEvent: Returns the farthest descendant of the receiver in the view hierarchy (including itself) that contains a specified point. - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event First get the touch Point from Gesture recogniser Object - (void)twoFingerPinch:(UIPinchGestureRecognizer *)recognizer { CGPoint touchPoint = [recognizer locationInView:self.view]; UIView *touchView = [self.view hitTest:touchPoint withEvent:nil]; if(touhView isKindOfClass:[UITextView class]) { } } PS: I hope I have not written wrong syntax. This i am writing without Mac.

Categories : IOS

Clean way to force view to load subviews early
You can call [myViewController loadView] to explicitly load the view, instead of abusing the .view getter. The .view getter actually calls loadView if necessary when called. It's still not a very nice solution, since the UIView Documentation's section on loadView explicitly instructs that You should never call this method directly

Categories : IOS

How many subviews and table views can one view controller handle
You can have massive amounts of views and subviews that are all handled by the same controller. Views are not drawn unless they are currently being displayed. That being said, there are definitely some recycling solutions you can utilize to speed things up if you start noticing performance issues (like removing the memory of a table if it is no longer immediately needed). The main reason you would start having complications is because of calculations to populate the data. If you have 10 tableviews all of the datasource and delegate methods could get slowed. You could use container views to encapsulate view logic. Also, as mentioned in comments, a UIPageViewController may be a good solution.

Categories : Iphone

When in the view lifecycle does UITableViewCell create its outlets/labels/subviews?
Generally speaking, objects should create their properties in their designated initializer, unless there is an overriding design principle (or a performance/resource issue) which mandates that they create them later. The designated initializer for UIView (and NSView on OS X) is -initWithFrame:. The designated initializer for UITableView is initWithFrame:style:. Since a view will usually need to have it's visible subviews available immediately upon being added to its superview, it is fine to create and set them in the designated initializer. -layoutSubviews is intended for updating the layout, which is to say the center, bounds (or frame) and (optionally) transform. Now, because of the ordering of messages. You don't want to create your subviews in -layoutSubviews because that method gets

Categories : IOS

UITableView Visible Cells Not Laying Out Subviews When View Appears
This is the behavior you'd see if you were setting frames in your layout code with Auto Layout enabled. This won't work. The Auto Layout system is responsible for setting frames and will overwrite the values you set. You should either specify your layout using constraints or turn off Auto Layout.

Categories : IOS

iPhone Xcode view will not space subviews vertically from 3.5" to 4" screen
you need to increase the Size of the User Interface from Storyboard/Xib's Interface ,look for a Rectangle with Two arrows ,and use Either Autolayout ,"springs and struts" or Use Frame and CGRect and do it programatically. S o!oenter image description here]1ver there

Categories : Iphone

Suggestions for MVC strongly typed view with lots of fields
If all these fields are a parts of something big, I would create one table in DB. Later it will be easely to work with and faster than searching data in different tables. As to 371 fields in your form, I think they can logicaly be devided by groups. In that case I would use jQuery to devide process by steps: Step1: show first ten fields; Step2:Hide first fileds and show next ten fields an so on. Technically it can be done by just playing with hide() and show() jQuery methods.

Categories : Asp Net Mvc

When adding subviews to a view, do I @synthesize it, or create it inside loadView method
Depends on your needs. If you wish to add it once and forget about it, a local variable is enough. It will be retained by the superview, and will not be released. However, if you wish to access it later, you could use an instance variable or a property to keep a reference to your view. Whether your property is weak or strong depends on your usage, again. If you add it to a superview and don't remove it again, weak is enough because it is retained by the superview. If, however, you dynamically add it and remove it, for example show it in landscape but remove it in portrait, then you would want the property to have a "strong" modifier, so that the object is retained even when not part of the view hierarchy.

Categories : Iphone

Using Calendar table to calculate fiscal week of year and business days in week
I’d rather try to create an UDF that would give me the number of work days or total number of weeks than trying to get this info from query itself. You have all these columns in GROUP BY statement only so you can count the number of records and you can probably simplify the query by using UDF. Here is a post that shows how to calculate the difference between two dates in workdays. How to calculate difference between two dates in workdays

Categories : Sql Server

In Matlab, how can I filter a structure by calendar year and insert the elements of interest into a new nested structure?
You should add a final inf term to your yrsStr and then you can use the amended code at the bottom of this answer to create your yoyComp structure. The main change I've made has been to use logical indexing, and capture the output of the structure's fields by surrounding the expression with square brackets (see [nxtPdOut.datePdLow]). Here's a basic demonstration of what I mean For the structure a(1).b = 5 a(2).b = 6 a(3).b = 7 You can interact with it in the following way, either: >> a.b ans = 5 ans = 6 ans = 7 Or by capturing the results into a vector: >> [a.b] ans = 5 6 7 For your code specifically, the following gives the result that you described in the question: yrsStr = [yrsStr, inf]; nn = 1; for n = 1:length(yrsStr)-1

Categories : Matlab

Swing TextArea function setLineWrap making execution slow
btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { >> processData(); << textArea.setText(str); } }); Don't execute time-consuming code on the GUI-thread (EDT). Use SwingWorker. See How SwingWorker works.

Categories : Java

How to select every year from a particular year to the current year as different rows?
The easiest thing for you to do would be to create a numbers table that you would use for these types of queries. You could also use a recursive Common Table Expression to generate the list of years: ;with cte (yr) as ( select 2000 union all select yr + 1 from cte where yr+1 <=2013 ) select yr from cte; See SQL Fiddle with Demo

Categories : Sql Server

Kendoui Scheduler Year View
Kendoui now offers a timeline view that you can customize by overriding the calculateDateRange function, Have a look at this: http://www.telerik.com/forums/timeline-year-view

Categories : Asp Net Mvc

How to change calendar view within in my app
Windows Phone Toolkit is open source and you can download the source code from their Codeplex repository: http://phone.codeplex.com/. This means that you can change everything you like, compile the code and then link those libraries instead of the NuGet package. Since you haven't described what you wish to change, it is hard to tell you how to change it exactly. If you edit your post and explain what you want to do, we can probably tell you how to do it.

Categories : Windows

making a data application that will store data on each day on the calendar
What type of database should be your first question: SQL, noSQL, Custom, other? Next, decide how your client and server will communicate: Ajax, Websocket, REST ect.. Then establish authentication. Then work out a way for the client to alter the database, but establish rules, or design it in a limited way. Then worry about calculating dates and such... You can go for a low storage cost method by only generating a record when a date is altered away from default. This way you will likely need to seek the database until you find the record(by matching a date field). This can be made faster by breaking the database into multiple databases for certain time ranges. Or you can go for the faster, but more storage intensive method of creating each record from past to future that will be acce

Categories : Javascript

Grid Calendar not getting full view
Instead of using Linear Layout try Relative Layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="90dp" android:layout_height="90dp" android:background="@color/reaction_color_selected"> <TextView android:id="@+id/num_events_per_day" style="@style/calendar_event_style" android:layout_gravity="right" android:text="1" android:layout_width="wrap_content" android:layout_height="wrap_content"> </TextView> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPar

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.