w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
UIButton vertical alignment doesn't work
UIButton has a very nifty property named "titleEdgeInsets" which you can use (via UIEdgeInsetsMake to reposition the top and bottom margins of the title and get the thing centered, vertically.

Categories : IOS

CSS, vertical alignment doesn't correctly work in Mozilla Firefox
Have a look at working demo here: Demo #contentWrapper{ width: 100%; position: static; display: table; overflow: hidden; min-height: 100%; height: 100%; background: red; } This is working fine in Firefox . Is this what you are looking for?

Categories : HTML

scrollview doesn't work in my layout
If you want to avoid buttons going up when the keyboard appears you could put android:windowSoftInputMode="adjustNothing" on the activity node of your Android Manifest. Then, they won't bother you when typing.

Categories : Android

CSS 100% width layout with two panels - why it doesn't work?
Just modify your css for #over : #over { height: 100%; /* Instead of auto */ min-height: calc(100% - 150px); } That should solve your problem. JSFiddle height : auto sets the height as the height of its content, i.e its child elements. height : 100% inherits the height of its parent. So, here, #over calculates the height of #side-nav and #content which in-turn depend on the height of #over. And since, #side-nav and #content don't have any content, so the height for all is 0. So, this problem should be rectified as content builds up. One more solution would be to set min-height for #side-nav and #content with some px value. Hope this helps.

Categories : HTML

'arbor' layout doesn't work in cytoscape.js
From the docs: http://cytoscape.github.io/cytoscape.js/#core/visuals/cy.layout NB: You must reference the version of arbor.js included with Cytoscape.js in the <head> of your HTML document: <head> ... <script src="arbor.js"></script> ... </head> Arbor does some automatic path finding because it uses web workers, and so it must be included this way. Therefore, you can not combine arbor.js with your other JavaScript files — as you probably would as a part of the minification of the scripts in your webapp.

Categories : Javascript

Ruby .gets doesn't work
Here's how I understand it. gets and puts are instance methods of IO, and the default IOs are $stdout and $stdin. Calls to gets/puts will only be effective if the translator is capable of handling stdout/in e.g. IRB If you run a ruby file from bash it works too. io_test.rb puts gets in bash ruby io_test.rb Then it will "put" into stdout whatever it "gets" from stdin.

Categories : Ruby

Scaling a right aligned layout doesn't work as expected
Apparently, Androids scaling is doing all sorts of bad stuff, for example it does not scale a 9-patch correct. Here is a custom animation for scaling that will solve the above and is compatible with 9-patch images. I also got some info here for the basics, this is just a rewrite of his solution: How to implement expandable panels in Android? public class ExpandAnimation extends Animation { private final int mStartWidth; private final int mDeltaWidth; private View view; public ExpandAnimation(View view, int startWidth, int endWidth) { mStartWidth = startWidth; mDeltaWidth = endWidth - startWidth; this.view = view; } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { android.view.View

Categories : Android

TextView setText doesn't work on custome layout in PreferenceFragment
Here is a solution: You need to implement a custom Preference class that extends the Android Preference class. Ensure that your custom class is in a separate file -- not part of another class -- otherwise you will get an 'Inflate XML error' like this. Here's an example: My CustomPreference.java file: public class CustomPreference extends Preference { private TextView txt; public CustomPreference(Context context, AttributeSet attrs) { super(context, attrs); this.setWidgetLayoutResource(R.layout.test_conn); } @Override protected void onBindView(View view) { super.onBindView(view); txt = (TextView) view.findViewById(R.id.summary); } public void setText(String text, int color) { txt.setText(text); txt.setTextColor

Categories : Android

Why doesn't the grid layout work without specifying RowDefinitions and Column Definitions?
You have to specify RowDefinitions and ColumnDefinitions so that it knows how to size the rows and columns. Otherwise it doesn't know whether you want auto-sizing or star-sizing. And it also needs to know how many rows and columns you need up front; it doesn't add them on the fly based on your values of Grid.Row and Grid.Column. I think the code you wrote looks reasonable, and it would be nice if it used a default when you don't specify, but unfortunately it doesn't. Instead, it builds a single-column, single-row grid and stacks all the children on top of each other. I can think of a couple ways to write some XAML that will do what you want. One way: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto"

Categories : Xaml

Freezing variables in Ruby doesn't work
You freeze objects, not variables, i.e. you can't update a frozen object but you can assign a new object to the same variable. Consider this: a = [1,2,3] a.freeze a << 4 # RuntimeError: can't modify frozen Array # `b` and `a` references the same frozen object b = a b << 4 # RuntimeError: can't modify frozen Array # You can replace the object referenced by `a` with an unfrozen one a = [4, 5, 6] a << 7 # => [4, 5, 6, 7] As an aside: it is quite useless to freeze Fixnums, since they are immutable objects.

Categories : Ruby

Why doesn't this ternary operator work (Ruby)?
Your ternary operator is set up correctly, but your variable a is not defined at the point where you do the multiplication. This will work because b has a value: b = 5 1.upto(number) {|x| a = x==1 ? 1 : b*x }

Categories : Ruby

Why doesn't it work when using Python to encrypt, then Ruby to decrypt?
PyCrypto uses a different segment_size When encoding, specify segment_size, and pad the plain text. from base64 import standard_b64encode from Crypto.Cipher import AES def pad(x, n=16): p = n - (len(x) % n) return x + chr(p) * p key = "abcdefghijklmnop" en = AES.new(key=key, mode=AES.MODE_CFB, IV="0" * 16, segment_size=128) cipher = en.encrypt(pad("apple")) cipher64 = standard_b64encode(cipher) print cipher64 Using the above code, you will get applex03x03x03. On the Ruby side, you should remove the padding. Ruby part (decoding): require "openssl" de = OpenSSL::Cipher::Cipher.new("aes-128-cfb") de.decrypt de.key = "abcdefghijklmnop" de.iv = "0000000000000000" plain = de.update(ARGV[0].unpack('m')[0]) + de.final plain = plain[0...-plain[-1].ord] puts plain Alternatively,

Categories : Python

How can I have these two
I believe display:inline-block is what you are looking for. Place it in .results and replace float:right in .map with it. Here is the updated jsFiddle

Categories : CSS

Compiling with MAKE after CMAKE doesn't work (MySQL on OS X)
If you want to compile with make, why are you using the Xcode generator? If you use the Xcode generator then no makefiles will be written: you'll need to use Xcode to compile. Try using the makefile generator if you want to use make to compile.

Categories : Osx

Android layout correct alignment
May be try android:layout_gravity="center" that should do the trick :) Also in addition, you can add android:layout_centerInParent="true" and take a look at this thread as well.

Categories : Android

Android: layout alignment on different screen sizes
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:layout_gravity="center" android:orientation="vertical" android:padding="5dp" android:background= "@drawable/chalk" > <Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:gravity="center" android:layout_gravity="center" android:onClick="login" android:text="Login" android:textStyle="bold" /> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_conte

Categories : Android

Android XML Layout alignment (button grid)
You could try GridLayout It also looks like you could do this in RelativeLayout as well, just have to be a little more careful. Edit: Post your XML file if you have trouble and if I have the time, I will redo it and post the solution xml.

Categories : Android

Ruby on Rails Tutorial by Michael Hartl Chapter 2 exercise (demo_app): app works on Windows 8 localhost, but doesn't work on Heroku
The error is here: 2013-07-18T23:47:29.239184+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 40177 -e $RAILS_ENV` 2013-07-18T23:47:30.141486+00:00 app[web.1]: bash: bin/rails: No such file or directory Try adding a Procfile to your application that has this: web: bundle exec rails server -p $PORT

Categories : Ruby On Rails

CSS Accordion - Used jquery to make "hover" a toggle, the JS is correct, but doesn't work in my HTML
You forgot to close your second opening script tag : <script src="jquery.js"></script> <script> $(document).ready(function() { $('h3, ul.accordion li').on('click',function() { console.log('hi'); $(this).closest('li').toggleClass('hover').siblings().removeClass('hover'); }); }); </script>

Categories : Jquery

Issue with programmatical alignment inside Relative layout in Android
You have to specify how the TextView and ImageView are related in their respective LayoutParams. You can use the addRule method to do the same. For egs: item.setId(A_POSITIVE_INTEGER); myparam.addRule(RelativeLayout.BELOW, item.getId()); tv.setLayoutParams(myparam); will make the TextView appear below the ImageView.

Categories : Android

HTML, PHP, JavaScript -- How to make a button for each individual record in a database? Seems simple but doesn't work
Your problem is $resultArrayImplode; is a string, so var resultArray = <?php echo $resultArrayImplode; ?> renders as: var resultArray = 1,2,3,4,5 Which is a syntax error. What you can do is use JSON. JSON syntax is JavaScript syntax, so all you need to do is: var arrayEntries = <?php echo json_encode($resultArray); ?>; This should render as something like: var arrayEntries = [1,2,3,4,5]; Which is perfect JavaScript syntax. Then the rest of your code should work.

Categories : PHP

inline-block with empty content makes layout disordered (vertical alignment)?
use 'vertical-align: middle;' to the inline-block element vertical-align: middle; http://jsbin.com/ajexab/1/edit

Categories : Misc

Android layout , does it support orientation layout xml files? Does -land work at all?
for the activity in the manifest remove the orientation flag,...then your activity will destroy and recreate itself on rotation giving you the correctly included layout. android:configChanges="keyboardHidden" If you leave it in, it is up to YOU to handle the orientation change with code.

Categories : Android

How can I make stylish xml layout design when using Scrolling View for xml layout?
You should use Navigation Drawer instead of using third party library for api 18 or above, Use official doc for this : Navigation Drawer

Categories : Android

how to make UI to show three images on same layout and three textview onsame layout
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:orientation="horizontal" > <ImageView android:id="@+id/img1" android:layout_width="100dp" android:layout_height="100dp" android:contentDescription="@null" android:clickable="true" android:onClick="imageClick" android:background="@drawable/imagebgborder" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/img2" android:layout_width="100dp" android:layout_height="100dp" android:contentDescription="@null" android:background="@drawable/imagebgb

Categories : Android

How to make a .xml layout file the layout of a custom View?
You need to inflate the .xml layout you created. Do it like this: public class CustomLinearLayout extends LinearLayout { // you need this constructor when you use the customview from code public CustomLinearLayout (Context context) { super(context); addView(LayoutInflater.from(context).inflate(R.layout.yourlayout, null)); } // you need this constructor when the customview is used from .xml public CustomLinearLayout (Context context, AttributeSet attrs) { super(context, attrs); addView(LayoutInflater.from(context).inflate(R.layout.yourlayout, null)); } }

Categories : Android

Layout : How to make one widget 3x the rest in a verical layout
On the layout that contains the 3 tables, set the layoutStretch property to 3,1,1 in Qt Designer. This specifies that the first element in the layout should have 3 times the space as the other two elements in the layout. Update: For your updated example .ui file, you can make the topmost widget to be 2 times larger than the others by setting the layoutStretch to 2,1,1,1: <layout class="QVBoxLayout" name="verticalLayout_2" stretch="2,1,1,1"> Note that the stretch property specifies ratios between the different elements of the layout. In other words, you won't get the desired results if you set one of the elements in the layoutStretch property to 0.

Categories : Qt

If I put scrollview then layout,layout doesn't show
You aren't setting any LayoutParams anywhere, so the layouts have no guidance on whether they should match their parent Views' height, wrap the content height, etc. I would suggest using a layout XML file instead, as it will make the process of defining, using, and adjusting your layout far easier. If you need to continue defining this in code for whatever reason, set LayoutParams for your Views. A View's LayoutParams come from the ViewGroup that contains them. For a View within a LinearLayout you should use LinearLayout.LayoutParams; Similarly a child View in a RelativeLayout uses RelativeLayout.LayoutParams. In this case, you would want to use LinearLayout.LayoutParams like so: LinearLayout ldialog = new LinearLayout(Gestionarez.this); ScrollView scroll = new ScrollView(Gestionarez

Categories : Java

how to make file alignment using fprintf in c?
As like printf() You need to use some left and right alignments printf() write output to stdout fprintf() write output to the given output stream; printf("%6d",num); // if num have 3 digits then adds three more spaces at left of num. like this only you need to use with fprintf() In your file you have only 6 digits in the maximum number. replace all %ld with %7ld and add after every 3 or 4 numbers to get perfect allignment fprintf(fpscrip," %7ld , %7ld , %7ld , %7ld , %7ld , %7ld , %7ld , %7ld , %7ld , %7ld , %7ld ",scripCode,tradeVolume,LTQ,LTR,OpenRate,CloseRate,HighRate,LowRate,TotBuyQty,To‌​tSellQty,LowerCircuitLimit,UpperCircuitLimit);

Categories : C

hot to make a textView in a layout only scrollalbe not the whole layout?
Try this: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/inner_content" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/bg" android:orientation="vertical" > <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="45dip" android:background="@drawable/header" android:paddingLeft="2dip" android:paddingRight="2dip" > <Button android:id="@+id/sample_button" style="@android:style/Widget.Button.Small" android:layout_width="35dip" android:layout_height="wrap_content" android:layout_alignParentLeft

Categories : Android

RedactorJS: linebreaks true -> Alignment does not work
The alignement is apply on <p> element, so your problem is logic. You must create a plugin that adds a frame around the content selected. Then you change the alignment value. You can modify alignmentSet function on redactor.js Redactor support should fix it. It is fixed in Version 9.0.3: http://imperavi.com/redactor/log/

Categories : Misc

Make div responsive and control text alignment
this is your solution html with css <html> <head> <title>test</title> <style> .main{ width:97%; border:1px solid #000; height:100px; padding:1%; } .subone{ width:30%; border:1px solid #000; float:left; height:100px; margin-right:2%; } .subtwo{ width:67%; border:1px solid #000; float:left; height:100px; } </style> </head> <body> <div class="main"> <div class="subone"> </div> <div class="subtwo"> </div> </div> </body> </html>

Categories : Javascript

Make boost::python respect data alignment
To control the allocation of C++ types, register a factory function as the Python object's constructor with make_constructor. Often times, custom allocation also implies custom deallocation, in which case boost::shared_ptr can be used to manage the lifetime of the object and invoke a custom dealloction strategy. This answer goes into more details, but here is a complete example with a basic custom allocator. #include <cstdlib> #include <boost/python.hpp> #include <boost/shared_ptr.hpp> /// @brief Basic custom allocator. template <typename T> class custom_allocator { public: typedef size_t size_type; typedef T* pointer; typedef T value_type; public: pointer allocate(size_type num, const void* hint = 0) { std::cout << "custom_allocato

Categories : C++

Alignment plugin in Sublime Text does not work with style.less (less file)
I haven't tested this yet, but I have a pretty strong hunch that it might help your case. Open sublime text, and go to Preferences>Browse Packages Look for the Alignment plugin folder and enter in it. Look at the files in there, you will see: Base File.sublime-settings CSS.sublime-settings Javascript.sublime-settings JSON.sublime-settings Try your hand at creating a LESS.sublime-settings file in there, copying the contents of another of the settings files, for example, the JSON.sublime-settings contains this: { "alignment_chars": ["=", ":"] } It seems to me, that to enable alignment to work as expected with other filetypes not designed as default with the plugin, one would have to add this settings file to the plugin in order for it to work out. I am not sure if the file

Categories : CSS

How does this Ruby block work from Eloquent Ruby?
Pass a block. 1. each_word{|w| puts "**#{w}**"} output **fuing** **wtrds** **iiha** 2. each_word{|w| puts w.capitalize} output Fuing Wtrds Iiha etc.

Categories : Ruby

Ruby Layout Inheritance
Ruby on Rails views have a feature called "partials". I partial is a view that generates a bit of html and can be included in other views. The partials can also accept arguments (local variables) that customize their behavior. The partials can include other partials. This is probably a good place to start learning about that: http://guides.rubyonrails.org/layouts_and_rendering.html I have never needed to do some kind of layout inheritance thing like you are describing but I could imagine doing it pretty easily with partials and passing around ruby variables that say which partial to use in which situation.

Categories : Ruby On Rails

Why does this code work in ruby 1.8 and not ruby 1.9?
It's to avoid ambiguity. Consider the following: def foo(a, b = 1) # foo takes an optional second argument end [foo 1, 2] This could be interpreted as [(foo 1), 2] or as [(foo 1, 2)]. There are two references in the Calling Methods docs (although not directly related to the array literal): Note that the parenthesis are optional ... Except when there is difference between using and omitting parentheses In many cases parenthesis are not necessary when sending a message ... However, parenthesis are necessary to avoid ambiguity.

Categories : Ruby

can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1. Make sure all dependencies are added to Gemfile
Add; gem 'bcrypt-ruby', '~> 3.1.1' to your gemfile Or if you specifically want 3.0.0, follow Maximus's advice and add: gem 'bcrypt-ruby', '3.0.0' Then bundle update bcrypt-ruby. You might also want to try deleting your gemfile.lock and re-running bundle install.

Categories : Ruby On Rails

Multiple sequence alignment - appending to an alignment
If your primary issue in the time it takes to re-run alignment (re-computing the PWI matrix should be computationally cheap), then MUSCLE has the capability to do what you're looking for, a procedure commonly termed "profile-profile alignment". Profile-profile alignment When passing the -profile flag, the alignments will be "re-aligned to each other, keeping input columns intact and inserting columns of gaps where needed.": If you have two existing alignments of related sequences you can use the –profile option of MUSCLE to align those two sequences. Typical usage is: muscle -profile -in1 one.afa -in2 two.afa -out both.afa Implementing in Biopython Biopython has a wrapper around MUSCLE, but I find it easier to just use subprocess to call MUSCLE, then parse the results back

Categories : Python

struct alignment without argument and alignment on 16-bit target
If the compiler gets an unqualified __attribute__((aligned)) attribute, it defaults to the largest necessary alignment on the machine. That is not the same as saying 'you cannot set a larger alignment'; your test demonstrates that you can set a larger alignment explicitly. You just won't get a bigger (or smaller) alignment unless you are explicit about it.

Categories : C



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