w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Field default timestamp set to table creation time instead of row creation time
Aha, worked it out-- seems you need to tell the server_default command if you're sending in some SQL that needs to be executed on the DBMS itself: from sqlalchemy import text class Test(db.Model): id = db.Column(db.Integer, primary_key=True) created = db.Column(db.DateTime, server_default=text('now()')) That generates: CREATE TABLE test ( id SERIAL NOT NULL, created TIMESTAMP WITHOUT TIME ZONE DEFAULT now(), PRIMARY KEY (id) )

Categories : Python

css position label text in the true center (vertical and horizontal) without moving the label
You can use line-height: 30px; to center a single line of text instead. The 30px needs to be the same value as the height of the element you wish to vertically center text in. Note: The fiddle has height:40px whereas the code in question has height:30px. Just choose the line-height to match the height. vertical-align would actually moving the entire <label> (and text) down but only applies to inline-level and table-cell elements. It is not applying in your case as the <label> is floated.

Categories : HTML

Highcharts x axis label text wrapping lost on setting label step
It's a bit of a hack, but you could replace each space in the name with <br /> by using the formatter: labels: { step: 1, formatter: function () { return this.value.replace(/ /g, '<br />'); } } It's not exactly what you want as it doesn't split the name according to the space available between ticks, but maybe you can improve the formatter to better suit your needs (splitting by a given n characters for example instead of by space). See it running here.

Categories : Highcharts

Xcode Autolayout: Place a label next to a dynamic label at a constant distance
Make sure that the spacing between your two labels is set to auto and that your days remaining label is left aligned. I suggest keeping a constraint between the trailing edge of your days remaining and the superview, but lowering the priority a bit. The goal there is to ignore it when the label should be far away from the superview, but not clip or go outside of the visible area when the date is very long. You may also need to increase the content hugging priority of the date label and/or decrease the compression resistance of your days remaining label. You may get better insight into what your labels are doing by setting the background color on them temporarily. The goal is to see how large your labels are, where the text is in the label, and where the spaces are. If there are lar

Categories : IOS

IOS Label Animation will not draw inside of label if changing the frame size
Ended up animating the image of the label / view. Here is the code, maybe will help someone. Assuming ARC and Quartz include. - (void) animateFromFrame:(CGRect)fromFrame toFrame:(CGRect)toFrame andView:(UIView*)view { UIGraphicsBeginImageContext(view.bounds.size); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageView* imageView = [[UIImageView alloc] initWithImage:image]; imageView.frame = fromFrame; imageView.layer.cornerRadius = 10; imageView.layer.borderWidth = 4; [self.view addSubview:imageView]; [UIView animateWithDuration:1.0 delay:0.25 options:nil animations: ^{ imageView.frame = toFrame; } completion:^ (BOOL finished) { [imageView

Categories : IOS

How can you drag and drop a list item to a label so it's the label's text in C#?
Test for correct type and then grab it: private void posLB_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.Text)) { String s = e.Data.GetData(DataFormats.Text) as String; if (!String.IsNullOrEmpty(s)) posLB.Text = s; } }

Categories : C#

If input box is empty show label, if there is text, hide label
yes there is, use keyup() function.. $('#name').keyup(function(){ if($(this).val() == ''){ $(this).prev().show(); }else{ $(this).prev().hide(); } }); this is considering your label is always the previous element of textbox else you can use.. $('#name').keyup(function(){ if($(this).val() == ''){ $('label[for="name"]').show(); }else{ $('label[for="name"]').hide(); } }); this gets that particular label whose attribute for is name.

Categories : Jquery

How to show label with line and display label outside in piechart in extjs4.1
You've got the display option of the label config, that you can set to 'outside'. As for the lines, you'll have to draw them yourself... Which would be a quite involved hack IMO. If you're interested in trying, that takes place in Ext.chart.Label#renderLabels(), and uses Ext.chart.series.Pie's onCreateLabel() and onPlaceLabel() methods. Don't forget to take your trigonometry with you before diving in there!

Categories : Extjs

Click on Label and show Div (Label name change dynamically)
Try this HTML <label id="search">Advanced Search</label> <div id="searchContent" style="display:none;">Something</div> JavaScript $(function () { $("#search").click(function () { var text = $(this).text(); if (text === "Advanced Search") { $(this).text("Basic Search"); $("#searchContent").show(); } else { $(this).text("Advanced Search"); $("#searchContent").hide(); } }); }); Demo: http://jsfiddle.net/AM6Wz/

Categories : Jquery

iOS 7: Misplaced View Frame for "Label - Label" will be different at run time
I had the same issue and I get below response form Apple: You need to update the constraints to match the frames of these views. I did the following: Editor -> Resolve Auto-Layout Issues -> Clear all constraints in ** view controller then I reordered my objects again in the view. PS: Try Enrico's solution first.

Categories : IOS

UIButton title label transform cuts off label
The titleLabel property is primarily used to configure the text of the button, not its bounds. I don't think you can achieve what you want to achieve. If I understand you correctly, you make a button with a small width and big height in interface builder, then set the transformation on the label of the button to 90º, and then expect the button to behave as if the width became the height and vice versa. I suppose you could still set the button in interface builder, but make it horizontal, as if it's rotated -90º, and then set the transformation on the UIButton in viewDidLoad

Categories : Iphone

allow user to tap label and then tap buttons to edit label.text?
To know which UILabel has been touched add a tap gesture to each label which triggers an action. In that actions store which label has been touched in e.g. a property. For the buttons, just connect them to action methods (could also be a single one), inside these methods do your calculation and updated the label indicated by the property described above.

Categories : IOS

Should i use Associatedcontrolid in label control to render label HTML tag?
The <label> element in html is a label for an <input> element. So the TextBox that is made as an <input> tag if it is associated with a asp:Label or ASPxLabel which is just an extention of the asp:Label will indicate to the .Net framework to translate it as a html <label> tag. In essence if you don't have a TextBox there is no point to translate the asp:Label to html tag. You had better add a new CSS class and format the span as you please if you don't want the TextBox. If you do want a TextBox, then you should add it to your ASPX file and assign to id the same ID attribute value with the AssociatedControlId value at your label.

Categories : C#

Labelling a grid using n labels, where every label neighbours every other label
You can experiment with a simple greedy algorithm. I don't think that I'm able to give you a strict mathematical prove, at least because the question is not strictly defined, but the algorithm is quite intuitive. First, if you have 1...K numbers (K labels) then you need at least K*(K-1)/2 adjacent cells (connections) for full coverage. A matrix of size NxM generates (N-1)*M+(M-1)*N=2*N*M-(N+M) connections. Since you didn't mention what you understand under 'smallest matrix', let's assume that you meant the area. In that case it is obvious that for the given area the square matrix will generate bigger number of connections because it has more 'inner' cells adjacent to 4 others. For example, for area 16 the matrix 4x4 is better than 2x8. 'Better' is intuitive - more connections and more c

Categories : Algorithm

why is it not assigning the string to the label? or how do i get the value out of the array into the label?
cowid is clearly null here so has not been initialized. stringWithFormat shows this with the (null). You can have the confirmation by if (detalles.Cowid == nil) { NSLog(@"The Cow has no id"); }

Categories : IOS

What is the difference between =label and [label] in ARMv6 assembly?
ldr r0,=something ... something: means load the address of the label something into the register r0. The assembler then adds a word somewhere in reach of the ldr instruction and replaces it with a ldr r0,[pc,#offset] instruction So this shortcut ldr r0,=0x12345678 means load 0x12345678 into r0. being mostly fixed length instructions, you cant load a full 32 bit immediate into a register in one instruction, it can take a number of instructions to completely load a register with a 32 bit number. Depends heavily on the number. For example ldr r0,=0x00010000 will get replaced by the gnu assembler with a single instruction mov r0,#0x00010000 if it is an ARM instruction, for a thumb instruction though it may still have to be ldr r0,[pc,#offset] These ldr rd,=things are a shortc

Categories : Assembly

Separate CSS for label checkbox to label input
You could write your css selector like this: label[for=Username] label[for=Live] You may also have a look at this thread: CSS Selector for selecting an element that comes BEFORE another element?

Categories : HTML

Align Label and value like Label and Input with BootStrap
Bootstrap seems to expect form controls within class="controls" elements. It's a bit hacky but adding the following css rule should work div.controls p { margin-top:5px; }

Categories : CSS

Align 6 elements at 1 line (Label+Input, Label+Input, Label+Input)
If this is your raw HTML: <form action=""> <p>First Name</p> <input type="text" name="fname" /> <p>Middle Name</p> <input type="text" name="mname" /> <p>Last Name</p> <input type="text" name="lname" /> <p>Age</p> <input type="text" name="age" /> <p>Gender</p> <select name="gender"> <option value="male">Male</option> <option value="female">Female</option> </select> <p>Phone Number</p> <input type="text" name="fname" /> </form> You can use CSS to style the page. Check out this link. It utilizes CSS to create 2 rows ('walls') with 6 columns ('panels') in each row. http://jsfiddle.net/chiperific/kFr4h/ If y

Categories : HTML

How to grow label into scrollable label?
Without seeing your code, I can only speculate. But a common omission is failing to set the contentSize property of your UIScrollView after its content have changed or moved.

Categories : IOS

ios: fit cell with label in it to the size of the label
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; { NSString * datum = [[json_Array objectAtIndex:indexPath.row] objectForKey:@"datum"]; CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), 20000.0f); CGSize size = [datum sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; CGFloat height = MAX(size.height, 77.0f); return height + (CELL_CONTENT_MARGIN * 2); } Consider a string wich is having max height then fit height for the cell .I considered datum string you implement according to your requirement

Categories : IOS

Put datatip stack on top of axis label and update axes label after a change was done on axes position
How about explicitly setting the z-position of the y-label via it's handle? If I put this after your loop it seems to work in R2012b: ylh = get(gca,'Ylabel') ylpos = get(ylh,'Position'); set(ylh,'Position',[ylpos(1:2) 0]); If I adjust the z-position I can get the y-label to pop up and even interleave between the datatips. I'm not completely sure if this is a bug or a feature, but sometimes there are workarounds to rendering issues that involve tweaking the position of an element slightly to get Matlab to recalculate and redraw the figure.

Categories : Matlab

How to make a text in a label as url, to move to webpage / make a call by click on a text in a label
It's pretty much all the same idea, all applications in iOS can be opened with using the format appShortName://whatyouwantToHandle, for websites its just http://myurl To make a call, it's tel: NSURL *phoneURL = [NSURL URLWithString:@"tel:+123456789"]; [[UIApplication sharedApplication] openURL:phoneURL]; To start composing an email, it's mailto:, and it supports GET parameters to fill-out the email. const NSString* mailFormat = @"mailto:%@?subject=%@&body=%@"; const NSString* mailEmails = @"person1@gmail.com,person2@gmail.com"; const NSString* mailBody = @"This is the mail body Hi!"); const NSString* mailSubject = @"This is the mail Subject!"; NSString *urlString = [NSString stringWithFormat:(NSString*)mailFormat,[mailEmails stringByAddingPercentEscapesUsingEncoding:NSUTF8S

Categories : Iphone

The object 'Label' already has a child and cannot add ''. 'Label' can accept only one child
Without having tested i, I suppose there's a bug in the definition of the attached property, because it is attached to the Helper class itself and not to Label. That way you just create a new instance of Helper in your labels content. When you then add the binding to the content as well, you get the exception, because there already is a content. I don't actually see a reason to make it an attached property anyway and binding to the attached property of self seems clumsy to me. Try the following; Make Helper.Text a normal dependency property by replacing RegisterAttached(...) with Register(...). (Rename helper to something like CompositeString.) Then define a CompositeString as a resource of the label and bind the content of the label to this resource: <Label> <Label.Resourc

Categories : Wpf

Can I update the UI during PDF creation?
Run the PDF creation on a background thread, but update the UI on the main (aka UI) thread. Once the PDF creation is complete, call the method (in this case presentPDF) to present the PDF to the user, making sure to switch to the main thread before doing so. For example: -(void)presentPDF{ // Make sure this runs on the main (UI) thread dispatch_sync(dispatch_get_main_queue(), ^{ //Insert code to present the PDF... }); } - (void) testPDF { // Run on background thread dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ CGRect pageSize = CGRectMake(0.0f, 0.0f, 595.28, 841.89); UIGraphicsBeginPDFContextToFile([self filePath], pageSize, nil); { UIGraphicsBeginPDFPage(); for( int y =

Categories : IOS

Is there support for new row creation?
Does something like this work for you? EntityType myEntity = null; if(newItem) { context.TableName.Add(myEntity = new EntityType()); } else { myEntity = context.TableName.Where(item => item.PrimaryKey == key).Single(); } context.SaveChanges();

Categories : C#

Kml creation error
Google's description suggests that a placemark can have: a description that appears in the "balloon" attached to the Placemark. a name a point You can add this information in python using pnt = kml.newpoint(name="Kirstenbosch", coords=[(18.432314,-33.988862)]) pnt.description = 'population: 150000 age: 32'

Categories : Python

Bad Loading/Creation of UI
Why not using UITableView/UICollectionView? - It's much faster and memory efficient. The only thing you should take care of, it's saving the user inputs in some array so you can display it again when needed.

Categories : IOS

Threads creation
Thread bbb = new Thread(()=>MonitorMethodAccess.ModifyNumericField(12)); Thread ccc = new Thread(() => MonitorMethodAccess.ReadNumericField()); But if you want to return values from threads as in your third thread, you should think to use Tasks

Categories : C#

File creation in c#
File.Create creates and returns a file stream. The file with its data will only be written when you close that file stream. A convenient way of doing this is by using a using block: using (FileStream fs = File.Create(...)) { // write to file here } Also, note that it is not a good idea to first check for the file's existence and then create the file. The file may have been absent during your call to File.Exists, then a file of the same name could have been created by some other process, and then your call to File.Create would be executed and fail. When attempting to create a file, just try it and catch exceptions to learn that it is not possible.

Categories : C#

socket creation in C++
I suppose you should check the descriptor after creation in constructor. If socket in constructor is good then in other functions you use differ(from initialized) socket variable. In this case it's your code problem. If the descriptor is bad in constructor too you should revise the descriptor initialization code. Also possible that descriptor checking code has mistake. Anyway code snippet of your problem will be helpful.

Categories : C++

How can I fix this creation vector in C++
I believe that your problem is with the line vecHilos.push_back(Hilo(this->contadorHilos,tiempo_vida));. In this line you are creating a new const Hilo object, this is then copied into the back of vecHilos. Most of your class can be copied without hassle, however the boost::thread is not copyable: The boost::thread class is responsible for launching and managing threads. Each boost::thread object represents a single thread of execution, or Not-a-Thread, and at most one boost::thread object represents a given thread of execution: objects of type boost::thread are not copyable. You should be able to verify this behaviour by removing all instances of boost::thread from your code, it should then compile fine (unless there are other errors). In this case, you will need to wr

Categories : C++

Is it possible to use the .NET DeflateStream for pdf creation?
Is there any reason why Microsoft's implementation of the DeflateStream class isn't working? Am I using it incorrectly or is it implemented incorrectly or what? DeflateStream is actually implementing RFC 1951 (DEFLATE), where PDF is compressed using a compression compatible with RFC 1950. This is detailed, with a workaround, in this related Microsoft Connect bug report. A simple workaround would be to use a third party compression library, such as [DotNetZip], 4 which will support the proper format. That being said, the Connect report suggests that skipping the first two bytes may cause this to work in most cases.

Categories : C#

Database creation
I use Connection conn=Drivermanager....etc dont use typecasting. Also always use prepared statements. It is neat and safe. One small error. Eg. id int(10) not null auto_increment must be used size of int must be given. Assuming mysql

Categories : Java

Logfile creation
Use delay=True in the handler's initialisation: see the documentation, as long as you are using Python 2.6 or later (and if not, consider updating). This defers creating/opening a file until something is actually logged.

Categories : Python

Wix Patch Creation
Another option would be to run torch against 1.0.0.0 and 1.0.0.2 and setting the patchFamily attribute Supersede="yes". (Assuming the .1 code is also in your .2 build) This will include .1 files in the .2 patch as well. If the .1 patch is installed it will be superseded with .2, if .1 is not installed it won't matter because .2 already includes it.

Categories : Wix

How to Loop table creation
It sounds like you're in need of a cursor, something like: DECLARE @Iterator NVARCHAR(100) ,@sql NVARCHAR(MAX) DECLARE xyz CURSOR FOR --Select stuff to iterate over SELECT DISTINCT SRC_CD FROM w OPEN xyz FETCH NEXT FROM xyz INTO @Iterator WHILE @@FETCH_STATUS = 0 BEGIN --Do stuff SET @sql = 'SELECT [CD],[SRC_CD],[SRC_CD_DESC],[DSC],[REFRESH_DT],[GEN_DSC] = CAST(null as VARCHAR(50)) INTO dbo.vv_' + @Iterator +' FROM [vv] A WHERE A.SRC_CD <> ''GEN'' AND A.DSC <> ''NO DATA'' AND A.DSC <> ''(BLANK) NO'' AND A.src_cd = ''' + @Iterator + '''' PRINT (@sql) FETCH NEXT FROM xyz INTO @Iterator END CLOSE xyz DEALLOCATE xyz GO I left PRINT in there so you can

Categories : SQL

C# : dzi image creation opensedragon
This has been fixed, see notes at: https://github.com/openseadragon/openseadragon/issues/205#issuecomment-23394315

Categories : C#

dynamic thread creation in c++
There is no code that stops your main() from terminating the process before your worker threads have completed. main() should look something like: int main() { Example ExampleObj; // Start threads. pthread_t threads[10]; for(size_t i = 0; i < sizeof threads / sizeof *threads; ++i) { pthread_create(threads + i, NULL,start,&ExampleObj); } // Wait for the threads to terminate. for(size_t i = 0; i < sizeof threads / sizeof *threads; ++i) { pthread_join(threads[i], NULL); } }

Categories : C++

Image creation in model
Of course you would have a null reference exception since you didn't initialize your image and tried to access one of its properties. in the model use BitmapImage in place of image. then in the xaml in the template create Image control and bind it with the property Country check the answer in here C# initialize class

Categories : C#



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