Id
int64 1.68k
75.6M
| PostTypeId
int64 1
1
| AcceptedAnswerId
int64 1.7k
75.6M
| Question
stringlengths 7
2.03k
| Answer
stringlengths 0
2.25k
| Image
imagewidth (px) 4
9.41k
|
---|---|---|---|---|---|
12,646,627 | 1 | 12,646,872 | I'm trying to build a thing that renders point cloud data stored in a specific way to a canvas using Javascript.
The data is stored as (JSON, where -> represents a range of values including the two extremes)
{"xangle":-Math.PI*2 -> Math.PI*2,"yangle": -Math.PI*2 -> Math.PI*2,"disntancefromorigin":10,"colour":blue}
I've been having some trouble working out what the maths should be for turning the xangle, which represents the angle away from the x axis the line is and the yangle, which is the same but from the yaxis, and the distance from the origin into a "3d" point.
I've been running code which generates a large array of points the same distance from the origin with the same distance and trying to manually brute force the algorithm till i got it right - but that didn't help much.
<IMAGE>
thanks for any help, if I've not made something clear or you want to see the code just ask.
EDIT: I should add, I'm just going for an Orthographic representation (at least till I can get that working) | '''
r = distancefromorigin
y=r*cos(yAngle)
x=r*cos(xAngle)
z=+-r*sqrt( 1-cos^2(yAngle) - cos^2(xAngle) )
'''
Edit: Last equation is from 'x^2 + y^2 + z^2 = r^2'
You cannot say if you have to pick + or - because your problem is ill defined! | |
8,850,590 | 1 | 8,850,729 | I am trying to use the attached nine patch image as the background for a View in my app (the image is from the android-15 sdk resources). As pictured, the image has two vertical dots to the left of image, two horizontal dots above the image, and a horizontal line below the image. These dots/line from the images show in my app.
I copied the file from the sdk folder into my resources directory, and set the drawable resource as the background for my view. What is the proper way to use this image as the background of a view, such that the dots/line do not show?
<IMAGE> | The lines and dots are what make this a 'NinePatch'. The dots on the left side and the top define the area that can stretch, while the other two lines define the bounding box for drawing things inside the 'NinePatch'.
If you set such an image as a background - those lines will not be shown. To create these images yourself, you can use the draw9patch tool in the android sdk (http://developer.android.com/guide/developing/tools/draw9patch.html).
One thing to remember, is that the file type for a 'NinePatch' image has to be, for example: 'image.9.png'. Otherwise those lines will be drawn. | |
41,700,872 | 1 | 41,702,047 | <IMAGE>
Hi guys!
I am preparing physical model of a robotic leg on my undergraduate studies and I have encountered a problem that I can not solve.
The problem is described in the picture. I have two angles, one of which is a angle between XZ plane and plane marked with a red color. The second angle lies on this plane as shown.
With the constant length AB and variable value of those two angles I want to find formula that describe position of point B in 3D Space. | Point A doesn't look as origin (0,0,0) as painted.
In any case, you can find position of point in XZ plane as
'''
B'' = (lAB * Cos(Gamma), 0, lAB * Sin(Gamma))
'''
then rotate B'' about X-axis by beta angle (<URL>.
If A really is not origin, then shift coordinates by z-coordinate of A | |
12,781,538 | 1 | 12,781,570 | I would like to have a login similar to <URL>:
<IMAGE>
The problem is that I don't know how to do the bottom, these two options. When I push, I'd like to put another view -- the sign up view or reset password view --, but I don't know how to do these elements (are they labels?). | They could be 'UIButton' with the type Custom and with a value for the text:
<IMAGE> | |
5,314,589 | 1 | 5,314,991 | Has someone else experienced something like this with Delphi and if so is there a known workaround!
I'm using the Delphi 2010 Rad Studio on Windows 7 64 bit.
A few times when editing the IDE hangs and I can't do any action either by keyboard or mouse. But there is a error-beep sound from windows like there is a modal window open somewhere, but hidden behind the ide it self.
Only by ending the ide via Task manager can I make this hidden modal window visible.
<IMAGE> | I have the same problem with older versions of Delphi like D6.
My solution is use another tool like <URL>.
With this solution I get the Delphi IDE on Top and appears the window that cause the lock. This is the only option I have worked for me.
Regards.
<IMAGE> | |
42,074,196 | 1 | 42,074,609 | I'm trying to add a pinned tab icon that is visible in Safari, like this:
<IMAGE>
I have found this instruction: <URL>
However, when I use this construction in my app.html.eex like this:
'''
<link rel="mask-icon" href="<%= static_path(@conn, "/website_icon.svg") %>" color="red" >
'''
or
'''
<link rel="mask-icon" href="/website_icon.svg") color="red" >
'''
where the website_icon.svg is in the static root;
the page redirects me to localhost:4000/website_icon.svg, which is correct, but then shows a 404 error page as if it should have been pointed towards in the router.
So my question: How can I get Phoenix to get the mask-icon to display correctly, rather than getting a 404? | In your 'endpoint.ex' file, there is a line specifying what the static plug should handle. Mine looks like the following
'''
plug Plug.Static,
at: "/", from: :my_app, gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt)
'''
You will want to either put your file in the images directory, or add a 'website_icon.svg' similar to the 'favicon.ico' entry. | |
10,479,523 | 1 | 10,479,565 | class file from cmd with the following command and i get the output:
<IMAGE>
The error is: "Error: Could not find or load main class CustomerManager.class"
Any idea how i could resolve this issue ? | just type in cmd 'java CustomerManager' , no need to add '.class' | |
23,641,568 | 1 | 23,641,649 | What is the difference between these two NSArray outputs using 'NSLog'?
'''
//Use to get all values from within Dictionary
NSArray * values = [self.dict allValues];
//Title
self.namesArray = [values valueForKey:@"Imade"];
'''
gives the following which is broken up into the KEY values they are stored in:
'''
Names : (
(
tttt,
tgrtg,
trgrtgrtgrtgrtg
),
(
fcxczxc,
zcxzc,
asad
),
(
sdedw,
frfefr
)
)
'''
and
'''
self.colorArray= [[NSArray alloc] initWithObjects: @"Red", @"Yellow", @"Green",
@"Blue", @"Purpole", nil];
'''
gives
'''
Names : (
Red,
Yellow,
Green,
Blue,
Purpole
)
'''
Now I can populate a uiTableViewCell with the colored NSArray however I cannot with the Names NSArray. Why is this and how do I fix it? Do I need to break the namesArray down further and how do I do this? Im sorry if this is obvious.
If needed
'''
//Use to get Key Values from within Dictionary
self.sectionArray = [self.dict allKeys];
'''
<IMAGE> | It looks like the first array is an array of arrays, and the second one is an array of strings. | |
17,703,245 | 1 | 17,733,886 | I created a SOAP1.2 web service with ServiceStack. We have a client using the Axis2 platform to create a proxy class to our service via the WSDL; however, they are receiving an error because the portType does not contain any methods (all of our operations appear under the portType with name "ISyncReply").
'<wsdl:portType name="IOneWay"></wsdl:portType>'
If i manually edit the WSDL and remove the IOneWay port type and all the things that reference it, they are able to add their Axis2 classes just fine.
Is there any way to get ServiceStack to output this PortType for Async if there are not any operations that are defined as asynchronous?
EDIT:
Also when trying to add a service reference using the wcftestclient it gives the following error; however, it appears to add the operations that exist under the
<IMAGE> | I found the answer...
No, you cannot turn off the IOneWay port binding in the WSDL - It appears that <URL>. | |
17,980,676 | 1 | 17,980,883 | Shouldn't this convention be in reverse?
Desktop app config
'''
cfg.width = 454;
cfg.height = 756;
'''
//Logcat also shows what's expected
'''
Gdx.app.log("height",Integer.toString(Gdx.graphics.getHeight()));.//756
Gdx.app.log("width",Integer.toString(Gdx.graphics.getWidth()));//454
'''
but then this:
'''
shapeRenderer.line(40, 400, 700, 400);
'''
produces this line:
<IMAGE> | By default no. LIBGDX uses OpenGL's default origin in the bottom left corner, with Y going up and X going right.
Your camera could be messed up.
Looks like you're running this on Mac. You using RoboVM or Mono? RoboVM support is very new. Its possible there's some bug. | |
20,503,394 | 1 | 20,503,574 | Can someone tell me what the rectangular symbol in the margin, right above the breakpoint, means? I want to turn it off, but I am not sure what it is called.
This is Intellij 13. Thanks.
<IMAGE> | This means that this file's line has been modified locally. It's being compared to your version control system. In this case, it probably means you added a newline here.
There might be a better way than this to turn it off, but I haven't found it: Go to Settings -> Version Control. From there click on the VCS tab and choose '<none>'. This, of course, will remove all your VCS integration so it's pretty heavy handed. Here's a screenshot:
<URL> | |
39,845,178 | 1 | 39,846,248 | I get lastest code and step by step from <URL>
'''
$ sh compile.sh -a x84
You must define ANDROID_NDK, ANDROID_SDK before starting.
They must point to your NDK and SDK directories.
'''
I pointed NDK and SDK on the terminal on Gnome CentOS 7
<IMAGE> | Modify your compile.sh script to see if the variables are being echoed out. If not, perhaps you'll need to hardcode them in the compile.sh script. e.g.,
'''
ANDROID_NDK=/your/path/android-ndk
ANDROID_SDK=/your/path/android-sdk
''' | |
15,629,752 | 1 | 15,630,065 | I've been working on an Ipad app for awhile now and to make the development a little faster I've been using some controls I found on the interwebz. Namely FSVerticalTabBar , AES Encryption.
It's just now that I noticed 2 folders inside every folder on my project which I didn't noticed before. the thing with these folders I can't select them with a mouse, I have to highlight it with the cursor, So I couldn't delete them. Was wondering if it's something I should be worried about or is it really include in xcode that I just never noticed before?
The folders are :
Folder and Developer
<IMAGE> | I believe you're seeing a bug in Finder. I've seen the same thing on occasion. If you restart your computer, it should go away. | |
20,156,277 | 1 | 20,228,980 | I have installed spring-security-core & spring-security-ui. also added testuser in roleadmin.
when I run the application I get all the controllers list, Login controller worked with username & password. but When click other controller its says
'Sorry, you're not authorized to view this page.'
Do I need to add any other role to get the user and role management UI access?
plugin version.
compile ':spring-security-core:2.0-RC2'
compile ":spring-security-ui:1.0-RC1"
accessing this URL:
//127.0.0.1:8080/sec-test/role/search
here is my screen, after login.
<IMAGE> | First create your roles and test user in BootStrap.groovy:
'''
import springsecurity.User
import springsecurity.Role
import springsecurity.UserRole
class BootStrap {
def init = { servletContext ->
def adminRole = new Role(authority: 'ROLE_ADMIN').save(flush: true)
def userRole = new Role(authority: 'ROLE_USER').save(flush: true)
def testUser = new User(username: 'testusername', password: '1234')
testUser.save(flush: true)
UserRole.create testUser, adminRole, true
assert User.count() == 1
assert Role.count() == 2
assert UserRole.count() == 1
}
def destroy = {
}
}
'''
Then override as suggested:
'''
grails s2ui-override auth
grails s2ui-override layout
grails s2ui-override user package.name
grails s2ui-override role package.name
'''
Finally added the secured annotations to your controllers, i.e.:
'''
package springsecurity
import grails.plugin.springsecurity.annotation.Secured
@Secured(['ROLE_ADMIN'])
class RoleController extends grails.plugin.springsecurity.ui.RoleController {
}
''' | |
13,145,672 | 1 | 13,147,687 | I'm using GWT 2.5 and am looking for a Tree widget which will allow me to have a multi-selection model controlled by checkboxes adjacent to each TreeNode. Something similar to the JQuery plugin described <URL> with the following results:
<IMAGE>
As you might expect, I'd hope that checking a box would select all children of the checked node, and if any children are unchecked, you'd get the "half-checked" icon (shown by the "Solutions" node) -- so I'll need a three-state checkbox.
Does this widget exist in GWT already, or would I need to code it myself? | There is no default widget in GWT 2.5 that supports this.
Your options:
1. Use third-party library
2. Implement you own widget
I used to implement my own based on <URL>. | |
25,930,423 | 1 | 25,935,620 | I have a ComboBox implemented with an auto-completion system. My ComboBox contains more than 100 items. When users are typing text in, the auto-completion system opens the dropdown list and highlights the most relevant item. Moreover, when the dropdown list is expanded, all items are available (no filters). But the most relevant item is always at the bottom of the dropdown list.
I would like it to be in the middle, if possible. One item can have the same reference but another type than another one, that's why I need to see most of them in my dropdown by placing them in the middle.
Any idea ? It's not really important but kind of useful for them. Thanks !
<IMAGE>
Here's my ComboBox with the open dropdown. Sorry about that, I had to blur its elements. As you can see, the user starts writting the reference in the ComboBox. The autocompletion works fine, but the corresponding item is found at the end of the dropdown list (in the red frame), almost out of bounds.
I wish it would be highlighted in the middle of my dropdown list instead of so far below. | Your item search may work well, but your list isn't visually filtered, which means it's size always remains the same.
It's scrolled into view, by the wpf system, but still displaying all other items around the relevant one. The reason why it's at the bottom is because wpf Scrollviewer just finished scrolling the item into view and sees no need to scroll it further into the middle.
You could use the CollectionViewSource class. Why ?
It's simple to use, will keep your viewmodel data as it is, and you would have your relevant completion item at the top. It can be obtained by GetDefaultView(..)
Let's say you have a viewmodel flag "IsHidden", stating that it's content does not match the user input:
'''
ICollectionView cv= CollectionViewSource.GetDefaultView(myComboBox.ItemsSource);
// switch filter on
cv.Filter = obj => (obj as myViewModel).IsHidden == false;
// switch off
cv.Filter = null
''' | |
8,612,871 | 1 | 8,706,095 | This may not be possible, but I have a DIV that I am transforming using CSS3.
'''
#mydiv.fallback {
-webkit-transform: scale(.9);
-webkit-transform-origin: center;
}
'''
Works like a charm. Except, I'm trying to create an effect similar to Mac OSX's Timemachine (faux 3D effect), where the DIV falls back in the background. For this to work aesteitcally, I need the transform-origin to NOT use it's element's center, but the user's web browser's center. It would work even if I was able to change it to use it's parent's elements coordinates for its transform.
Not sure if this is possible or not sadly. Quick image to help illustrate.
<IMAGE> | Just update 'transform-origin' whenever you want to pop out the modal window. For example:
'''
function modal() {
var transOrigin = window.innerHeight/2 + document.body.scrollTop;
container.style.webkitTransformOrigin = "50% " + transOrigin + "px";
}
'''
Here is a working example for webkit.
<URL><IMAGE> | |
25,410,758 | 1 | 25,410,943 | I want to create a settting UI like this in android:
<IMAGE>
Questions:
1. How to create the layout? I believe it's a Vertical LinearLayout containing some of TextView with Divider set, is that right?
2. How to create sub-textview? (see the image above)
3. How to create a checkbox which aligned at right? (again, see the image above)
4. Look at the image above, the "Keypress popup" can be clicked and it will show up a dialog. How to create a clickable TextView? I have tried giving android:onClick on the TextView, but nothing happened when I clicked the TextView. | <URL> tutorials.
<URL> should be used post Honeycomb. | |
41,955,704 | 1 | 41,956,621 | After performing numerous deployments of some software to Azure, I'm hitting a strange problem which is stopping the deployment from working. (I am doing all these deployments in this case by using Visual Studio's Package command, and then using the Azure portal's Upload button.)
The portal initially says it has successfully started the deployment:
<URL>
It also says it is creating the staging deployment:
():
<URL>
But that's all. It never proceeds to show the instance, going through various states and finally running, as has always happened before. There are no further notifications and no error messages. (Even after 24hrs, for the avoidance of doubt.)
[<IMAGE> | This held us up for several days. Incredible as it sounds, there's apparently a major bug in the "new portal" that stops the error reporting from working, resulting in a silent failure instead of an explanatory message or logging. In our case we had simply hit our limit of 20 cores in the Azure subscription, but the portal wasn't letting on.
As soon as we deleted a service we didn't need any more, the deployment worked as normal.
The cause was discovered by pure chance, when someone else tried to create a new cloud service just at the time this problem was occurring. A UI message informed them the new service could not be created due to hitting the limit.
The lack of an equivalent message when updating an existing service is is a jaw-dropping defect in the "new portal". Very sadly we are well used to MS error messages being unhelpful, and often even very misleading, but with this silent failure MS seem to have excelled even themselves as far as standards of error reporting go.
<URL>
Unfortunately that doesn't seem to work on the new portal.
<URL>
...which leads to:
<URL>
So the moral of the tale seems to be: if you have an unexplained deployment problem, (<URL>. You will probably then find the cause straight away, as the old portal actually reports the failure reason instead of just failing silently as the "new portal" does. | |
19,398,151 | 1 | 19,398,206 | I have this <URL> html markup:
'''
<form id="form" action="lalala">
<input type="text" id="action"/> //a reserved property name id
<input type="submit" id="submit"/> //same here
</form>
'''
However -- running :
'alert(document.getElementById('form').action);'
alerts
<IMAGE>
and not "lalala" like it should.
It seems that'getElementById''s props is not accessed directly
Why is that ? ..... it can actually mean that I have to know all the form element's props (in order not to provide reserved prop ID to a descendant element) ? | This has nothing to do with 'getElementById' and everything to do with the properties of an HTML Form Element object.
> a reserved property name id
It isn't "reserved", it just has a value defined by default
If you have a form control in a form, and that control has an id (or name) that matches a property that form elements have, then a reference to that form control will overwrite the normal value of that property.
> When a form element is indexed for indexed property retrieval, the user agent must return the value returned by the item method on the elements collection, when invoked with the given index as its argument.
-- <URL>
This sucks, but is how the DOM for forms has worked since there was such a thing.
Since that particular property maps on to an attribute value, you can use 'getAttribute' and 'setAttribute' to manipulate it instead. (This won't work in old IE (which has a broken implementation of those methods that operate on properties) and won't work for some other properties (like the submit method)).
> it can actually mean that I have to know all the form element's props (in order not to provide reserved prop ID to a descendant element)
Yes. | |
28,247,955 | 1 | 28,751,361 | An android application have two modules and one depend on the other, and the common used jars and native libraries are defined in 'parent-project', while the 'child-project' add it as a dependency in the build.gradle:
<IMAGE>
However after I build the 'child-project' I found that the 'jars' put insiede the 'parent-project' are copied to the apk, while the native libraries are not. Only the native libraries inside the 'child-project' are packaged to the apk.
What's going on?
With Android studio 1.0.2. | I had the same issue. The problem was, in my parent (library) project's build.config's sourceSets I've added the following:
'''
jniLibs.srcDirs = ['jniLibs']
jni.srcDirs = []
'''
This didn't work, .so files were missing from the child project's APK, so I've replaced it with:
'''
jni.srcDirs = []
jniLibs.srcDir 'src/main/jniLibs'
'''
With this method, everything is fine. | |
24,215,689 | 1 | 24,215,748 | There's a cool guitar tabbing application that I've used before where you can use the keyboard to move around a character grid. You can put any digit in any character cell. Here is an image:
<IMAGE>
In effect, where you have a cursor block and you can move around character by character.
I am using Qt as my GUI application. How would I go about adding this type of single-character editor control in my application? I have not run across this type of widget in any of my exposure to GUI programming; hence, I'm not even sure what to call it or how to describe it succinctly.
Thanks. | First of all, you would have to implement handlers for each key you would like to respond to when pressed/release/hold.
The widget implementation would be like implementing a Finite State Machine with states like 'Navigating' and 'Editing' and so on.
For each key pressed you would act accordingly to update your widget or perform another action, including change the state of the widget.
In a high level form, this would be like:
'''
void MyCrazyWidget::on_keyDown(QKeyEvent event) {
switch ( this->state() ) {
case State::Navigating:
this->navigatingStateHandleKeyDown(event);
break;
case State::Editing:
this->editingStateHandleKeyDown(event);
break;
default:
// waaaat???
}
}
void MyCrazyWidget::navigatingStateHandleKeyDown(QKeyEvent event) {
switch ( event.key() ) {
// handle each of the keys here (or simply ignore those without an action).
}
}
void MyCrazyWidget::editingStateHandleKeyDown(QKeyEvent event) {
switch ( event.key() ) {
// handle each of the keys here (or simply ignore those without an action).
}
}
'''
This is obviously very high level, but is pretty much these things are handled (afaik). It's a boring and hard job, but we really need our editors ;D | |
4,910,556 | 1 | 4,910,667 | I'm using heightForRowAtIndexPath and sizeWithFont to calculate the height for a cell. After 3 or 4 lines of text, the label containing the text grows past the top and bottom of the cell's view. Anything from 0-3 lines grows and shrinks properly.
I can't find where the cell would have a hard cap on height.
'''
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
NSArray *array = [sectionsArray objectAtIndex:indexPath.section];
NSDictionary *dictionary = [array objectAtIndex:indexPath.row];
id key = [[dictionary allKeys] objectAtIndex:0];
NSString *keyString = [NSString stringWithFormat:@"%@", key];
NSString *keyContents = [NSString stringWithFormat:@"%@", [dictionary objectForKey:key]];
CGFloat height = 44;
if ([keyString isEqualToString:@"Notes"]) {
if ([keyContents length] > 0) {
CGSize constraint = CGSizeMake(320.0f - (10.0f * 2), 20000.0f);
height = 20 + [keyContents sizeWithFont:[UIFont boldSystemFontOfSize:15] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap].height;
}
}
NSLog(@"Height of %@ with content %@ is %f", keyString, keyContents, height);
if (height <= 44) {
return 44;
}
else {
return height;
}
}
'''
Here's a screenshot of what a too large entry looks like.
<IMAGE> | Your constraint width is too large. You are assuming 320 minus the 10 padding to either side, when in fact the text label is smaller than that due to your choice of table view cell style. At a guess, try a constraint width of 200 or 180 (or a value derived from experimentation or printing out the label's bounds.) | |
29,837,888 | 1 | 29,837,982 | I am trying to make use of Apache-Poi for a program I am working on, but I recently ran into problems trying to actually implement it. I downloaded the files, and unzipped them, but my program won't recognize it. I have:
- - -
To describe my dependencies:<IMAGE>:
I am not sure how to add the apache poi library to my program. Thanks! | You can specify your 'apache-poi' jar as follow.
'''
C:/demo/myprogram>javac -cp C:/project/jars/apache-poi.jar Main.java
C:/demo/myprogram>java -cp C:/project/jars/apache-poi.jar. Main
'''
Here we specify the jar to classpath during the compilation and execution,in this way you will be able to access the 'apache-poi' classes.
If you want to add multiple jars you can use '*' for that,
'''
java -cp C:/project/jars/*. Main
''' | |
4,957,351 | 1 | 5,006,170 | If you look at the screenshot below, I managed to do 99% of it, except the ugly white border around the minimised side window.
Any idea how to remove that?
I am using Ubuntu 10.10 with a customised (colours and icons) theme based on ClearLookClassic.
<IMAGE> | It is seems to be a bug with eclipse.
I have <URL> with eclipse.org | |
29,466,683 | 1 | 29,466,739 | I am having issue while updating Facebook SDK 3 to 4
when I add the framework it was added successfully. but when i add header file it's having the error that . Don't know the reason.
<IMAGE> | In setting the setting to in Build settings solved the problem for me. but don't know if is there any problem or issue or any side effects of it.
Its Facebook Bug you can check the solution they are providing in this <URL>.
Facebook said that they have fixed and will apply solution in next update see this <URL>
FaceBook Fixed It in Version Latest version (i.e. 4.1.0) see this link <URL>. | |
11,373,146 | 1 | 11,374,732 | So I want to draw a simple cubic lattice in Python using visual package.
I have a simple way of making a lattice with small spheres which all have the same color, but I want the colors to alternate: to make NaCl lattice I need to have a sphere of one color surrounded by 6 spheres of other color.
So I did this:
'''
from __future__ import division
from visual import sphere,color
L = 5
R = 0.3
even = []
odd = []
for i in range(-L,L+1):
if i%2==0:
even.append(i)
else:
odd.append(i)
for i in even:
for j in even:
for k in even:
sphere(pos=[i,j+1,k+1],radius=R,color=color.green)
for i in odd:
for j in odd:
for k in odd:
sphere(pos=[i,j,k],radius=R,color=color.yellow)
'''
And I get spheres of one color next to speres of different color, but they are in rows:
<IMAGE>
But I need them to alternate :\ The correct placement is only in the i direction. How do I correct the others to make a simple cubic lattice? I tried fiddling with the positions of the spheres (i,j,k+-number), but that way I got bcc lattice (one green sphere in the middle, others around it).
I'm stuck... | What you would need is this:
'''
from visual import sphere,color
count = 3
R=0.3
for x in range(-count,count+1):
for y in range(-count,count+1):
for z in range(-count,count+1):
if ((x+y+z+3*count)%2) == 0:
sphere(pos=[x,y,z],radius=R,color=color.green)
else:
sphere(pos=[x,y,z],radius=R,color=color.yellow)
'''
The point is, you should switch colors depending on whether the sum of the (integral, in this case) coordinates is divisible by 2 or not. | |
54,275,923 | 1 | 54,281,433 | How can i make the text expand to it's content? I Tried this
'''
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
items: _currentCitySelected.area
.map((String dropDownStringItem) {
return DropdownMenuItem<String>(
value: dropDownStringItem,
child: Container(
child: Text(
dropDownStringItem,
maxLines: 2,
// overflow: TextOverflow.clip,
)),
);
}).toList(),
onChanged: (String newValueSelected) {
setState(() {
this._currentAreaSelected =
newValueSelected;
});
},
value: _currentAreaSelected,
))
'''
[<IMAGE>
Text expands to content in drop down dialog content, but it does'nt works the same way in the main view.
<URL> | Set 'isExpanded' property of 'DropdownButton' to 'true'
'''
isExpanded: true
'''
Like that:
'''
DropdownButtonHideUnderline(
child: DropdownButton<String>(
isExpanded: true,
items: [...]
''' | |
6,370,986 | 1 | 6,371,108 | I am using Pajinate - A jQuery Pagination Plugin for pagination in my page
Following are my codes
'''
$(document).ready(function(){
$('#paging_container6').pajinate({
start_page : 2,
items_per_page : 5
});
});
'''
HTML Code:
'''
<div id="paging_container6" class="container">
<h2>Custom Start Page</h2>
<div class="page_navigation"></div>
<ul class="content">
<li><p>One</p></li>
<li><p>Two</p></li>
<li><p>Three</p></li>
<li><p>Four</p></li>
<li><p>Five</p></li>
<li><p>Six</p></li>
<li><p>Seven</p></li>
<li><p>Eight</p></li>
<li><p>Nine</p></li>
<li><p>Ten</p></li>
<li><p>Eleven</p></li>
<li><p>Twelve</p></li>
<li><p>Thirteen</p></li>
<li><p>Fourteen</p></li>
<li><p>Fifteen</p></li>
<li><p>Sixteen</p></li>
</ul>
</div>
'''
Pagination would be like this:
<IMAGE>
When i reach first page I need to hide out 'prev' button. similarly when i reach last page i need to hide out 'last' button.
Is there is any option with this plugin or I need a solution for this pagination problem. | As stated on <URL> I don't really see if there is an inbuilt parameter or feature to solve your problem. | |
24,303,656 | 1 | 24,303,979 | I am using following code to show vertical bar on 'JTable'. Despite of it is active. I can't scroll down:
'''
scrollPane = new javax.swing.JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
table = new javax.swing.JTable(dtm);
table.setName("table"); // NOI18N
sorter = new TableRowSorter<DefaultTableModel>(dtm);
table.setRowSorter(sorter);
table.setPreferredSize(new java.awt.Dimension(300, 190));
scrollPane.setViewportView(table);
'''
Picture Added:
<IMAGE> | Don't use 'setPreferredSize', the 'JViewport' is using to information to decide how much space is required it needs, which the 'JScrollPane' is then using to decide if it needs to show the scroll bars or not
If you really, absolutely have to modify the viewable size of the table, can try using 'setPreferredScrollableViewportSize' | |
27,755,499 | 1 | 27,775,424 | As can be seen below, the 'completion list' is on the left when I want it to be on the right. How can I do that?
here is
<URL> <IMAGE> | you have to override bootstrap's'.dropdown-menu' class in your style file as follow :
'''
.dropdown-menu{
float:right !important;
position:inherit !important;
}
'''
<URL> | |
42,595,343 | 1 | 42,595,975 | I don't know how to make this algorithm in JavaScript/Node.js that converts bitmaps into svg paths pixel by pixel:
<IMAGE>
'''
// input
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 1 1 1 0 0
0 0 1 1 1 1 1 1 0 0
0 1 1 1 0 0 1 1 1 0
0 1 1 1 0 0 1 1 1 0
0 0 1 1 1 1 1 1 0 0
0 0 1 1 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
// output
<path d="M2 2 h6 v2 h1 v2 h-1 v2 h-6 v-2 h-1 v-2 h1 v-2 M4 4 v2 h2 v-2 z">
'''
Does anyone know how the algorithm should work?
Any pseudocode would help.
Tools does the similar approach:
- <URL> | You can converts pixels to SVG path string like this.
<URL>
Using this algorithm, I made script coverts pixel art to SVG.
<URL>
(Sorry this page is written in Japanese.) | |
28,110,358 | 1 | 28,110,526 | My Project is using 'zurb foundations' but i don't know much about it.
I need to design the layout like this . This is rough drawing
The Header needs to be in center and the text inside small boxes also should be in center.
This is what i have tried
<URL>
The box should be around '300 width , 400height'
<IMAGE> | <URL>
here's a quick model for you.
'''
.container {
width:100%;
border:1px solid black;
}
.box {
width:100px;
margin:auto;
border:1px solid black;
margin-top:10px;
}
.header {
text-align:center;
background-color:grey;
}
'''
<URL> | |
4,040,739 | 1 | 4,212,332 | I added
'''
<key>UIInterfaceOrientation~ipad</key>
<string>UIInterfaceOrientationLandscapeRight</string>
'''
in Info.plist
When I run the app, app can't show full.
<IMAGE>
Why and how to make full to rightbar in UISplitview ? | Are you sure that the Detail View isn't setup as a Master view?
Thats what it looks like from your screenshot.
and you might want to change (which could also be an issue):
'''
<key>UIInterfaceOrientation~ipad</key>
'''
to:
'''
<key>UIInterfaceOrientation-ipad</key>
''' | |
58,134,585 | 1 | 58,134,724 | I want to see the content of a php file on which I have direct access from browser
<IMAGE>
I didn't have any luck finding informations regarding this. Is it possible? | You cant see the PHP code of a PHP file directly from a Web browser.
You must code or use a code editor JS library like: <URL> | |
26,488,414 | 1 | 26,490,149 | I'm trying to create an object for <URL> using the following code,
'''
try
{
var sql = ConfigurationManager.ConnectionStrings["sql"];
DbProviderFactory sqlfactory = DbProviderFactories.GetFactory ( sql.ProviderName ); // This one works fine
var sqlCE = ConfigurationManager.ConnectionStrings["sqlCE"];
DbProviderFactory sqlCEfactory = DbProviderFactories.GetFactory ( sqlCE.ProviderName ); // This doesnt
}
catch ( Exception ex )
{
Console.WriteLine ( ex.Message );
}
'''
and 'app.config':
'''
<connectionStrings>
<clear/>
<add name="sql"
providerName="System.Data.SqlClient"
connectionString="Server=.\SQLExpress;Database=TestResults;Trusted_Connection=Yes;"/>
<add name="sqlCE"
providerName="System.Data.SqlServerCe"
connectionString="DATA SOURCE=DataBase\dbTestResults.sdf"/>
</connectionStrings>
'''
The first one ('sqlFactory') creates successfully, but the second object ('sqlCEfactory') throws an exception:
<IMAGE>
Am I missing something?
Thanks! | You have the wrong provider names specified in your config file.
The SQL Server CE invariant provider names are
'''
System.Data.SqlServerCe.4.0
'''
(for version 4.0 runtime)
'''
System.Data.SqlServerCe.3.5
'''
(for version 3.5 runtime) | |
25,266,970 | 1 | 25,274,618 | I've used <URL>. I need showing "used number" of each options/tags at dropdown box like this way:
<IMAGE>
I've created a class for that number in my CSS ('.used-number'). But, I don't understand how can I add that number for each options at my HTML file. Is there a way to add those something like this(or any other way):
'''
$(".tag").select2({
data:[{tag: 'red',text:'3',className: 'used-number'},{tag: 'green',text:'12',className: 'used-number'},{tag: 'blue',text:'5', className: 'used-number'},{tag: 'black',text:'7'}]
});
'''
}); | The 'tags' array must contain objects with the keys 'id' and 'text'. You can add more keys if you need (for your case, I've added the key 'qt' that represents the number).
To add HTML to the option you need to change the default 'formatResult' function. With the following code, the numbers appear to the tags that exist (that is, the tags passed to the select2). For the options created on the fly, the number will not appear.
'''
$(".tag").select2({
tags:[
{id: "red", text: "red", qt: 3},
{id: "green", text: "green", qt: 12},
{id: "blue", text: "blue", qt: 5},
{id: "black", text: "black", qt: 7}
],
formatResult: function(result) {
if (result.qt === undefined) {
return result.text;
}
return result.text
+ "<span class='used-number'>"
+ result.qt
+ "</span>";
}
});
'''
See the <URL>. | |
18,066,193 | 1 | 18,066,912 | <IMAGE>
I know how to create a list with 'View' like the ones shown above. I am attempting to create a downloader and there will be multiple threads downloading at the same time.
These 'Thread's needs to use the 'setProgress(..)' of the 'ProgressBar'. However, I do not know how I can refer to these progress bars once they have been created using an adapter. And, by extension, the cancel buttons so that I can add listeners to it.
Please help me with this | I would suggest you to create 'Task' class, which would implement 'Runnable' and have a method 'getCurrentProgress()', which would return progress of current task and a method 'cancel()' to cancel itself (canceling can be done in any desired way, by raising a flag or any other way). Then you can start a task using ordinary thread (or use AsyncTask, or one of 'Executors') and add your 'Task's to adapter as an item, and then you can display appropriate Views by using
'''
Task task = getItem(position);
progressBar.setProgress(task.getCurrentProgress());
'''
in your 'getView()' method of adapter.
Then when you need to update progress you just need to update progress inside 'Task' and call 'adapter.notifyDataSetChange()' on the UI thread. What you also need to do is to ensure that your new progress in 'Task' instance would be visible from other threads, for this I would suggest you using 'AtomicInteger' as progress indicator (because every 'AtomicInteger.get()' returns the latest value). | |
60,980,788 | 1 | 60,980,915 | So essentially I want to accomplish this block I designed in Adobe XD.
Adobe XD card design
<IMAGE>
Here is my code to implement the following:
'''
const useStyles = makeStyles({
root: {
minWidth: 275,
maxWidth: 300
},
title: {
fontSize: 14
},
pos: {
marginBottom: 5
}
});
export default function SimpleCard() {
const classes = useStyles();
const bull = <span className={classes.bullet}>*</span>;
return (
<Card className={classes.root}>
<CardContent>
<Typography
className={classes.title}
color="textSecondary"
display="inline"
>
Physics
</Typography>
<Typography display="inline" align="right" style={{ marginLeft: 110 }}>
benevolent
</Typography>
<Typography variant="body2" component="p" align="left">
10/25/2001
</Typography>
</CardContent>
</Card>
);
}
'''
Here is the codepen link:
<URL>
The problem with this is that in the first line I have to manually set the distance between the two typography tags. So basically the distance between Physics and Benevolence is set manually. How can I automatically determine that distance? Also How can I get closer to my design? | Flex box can accomplish what you want easily, with the following class:
'''
const useStyles = makeStyles({
header: {
display: "flex",
justifyContent: "space-between"
}
});
'''
And if you use a div to wrap the typography:
'''
<div className={classes.header}>
<Typography
className={classes.title}
color="textSecondary"
display="inline"
>
Physics
</Typography>
<Typography display="inline" align="right">
benevolent
</Typography>
</div>
...
'''
Then it accomplishes what you want. | |
23,818,508 | 1 | 26,702,332 | I am following this <URL> and trying to add provisioning profiles and signing identities for a new apple-id. The problem is that when I add a new apple-id in Xcode -> Settings -> Accounts I am getting "Error Fetching Developer Info".
<IMAGE>
<URL> is about all I have found searching around on google. I've restarted Xcode multiple times to no avail. Has anyone encountered this error? | This is what worked for me.
XCode > Preferences > Accounts
Retype password, then click the General tab.
Then, go back to the Accounts tab. The error disappeared.
I'm guessing there are a number of situations that can cause this issue, just wanted to post what worked for me. | |
20,238,353 | 1 | 20,239,260 | Which control in Win32 support wrap text like bellow and support mouse down event like Run in C# (as in picture below)? If there isn's have built in control, which libray I can use? Thank!
<IMAGE>
'''
<TextBlock TextWrapping="Wrap" FontSize="20" Margin="10">
<Run>A text run.</Run>
<Run Background="Yellow" MouseDown="Run_MouseDown">
<!-- Support mouse down event -->
This is long Run that auto wrap to begin of the below line.
</Run>
</TextBlock>
''' | One candidate would be the <URL> control.
Use the 'SS_LEFT' style:
> A simple rectangle and left-aligns the text in the rectangle. The text is formatted before it is displayed. Words that extend past the end of a line are automatically wrapped to the beginning of the next left-aligned line. Words that are longer than the width of the control are truncated.
The parent control is sent <URL> notifications when the control is clicked.
What you cannot do with a 'STATIC' control is highlight some part of the text as shown in your screenshot. To achieve that you would likely need to use <URL>. | |
10,246,246 | 1 | 12,100,054 | I Need to shift an ImageView, which is a direct child of a LinearLayout, a bit to the left.
What happens: The View is shifted (can see the "bounding box" is shifted, with android layout manager) but the drawable keeps in the same place.
Also the drawable is cut on the right side, if I set margin low enough.
<IMAGE>
Why is this? Any advice?
- | It seems elements are always clipped when they get outside of parent's bounds (also with clipChildren=false).
A solution is to create an additional container-layout for everything besides of the item to be shifted. And then shift the container-layout in the opposite direction.
For example, to shift -10dip:
'''
<Original container ...>
<Item to be shifted/>
<New container with margin 10dip>
<Previous content of Original container ... />
</New container with margin 10dip>
</Original container>
''' | |
14,556,718 | 1 | 14,620,733 | I am running Visual Studio 2012 (administrator) in Windows 8. I am unable to add an existing folder using Solution Explorer. I also can't drag the folder from File Explorer into the Solution Explorer. I get the invalid target drop icon.
The only way I know is to add the folders by Add - "New Folder" and creating the folders manually.
Why am I am having these issues?
<IMAGE> | "Include in Project" shows up for files only not folders. When files are includes, their folders get included. | |
56,289,076 | 1 | 56,329,777 | When default sorting is enabled on PrimeNG's TurboTable sort icon is not visible with initial load, column header is styled as it's used and data is sorted properly. Sort icon appears when i manually click on header to sort again.
<IMAGE>
html:
'''
<p-table [columns]="columns" [value]="users" sortField="name" sortOrder="1">
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field">
{{col.header}}
<p-sortIcon [field]="col.field"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-user let-columns="columns">
// body ...
</ng-template>
</p-table>
'''
component:
'''
this.columns = [
{field: 'name', header: 'Name'},
{field: 'email', header: 'email'}
]
'''
Is there any way to show sort icon on default sorted column? | If you bind the sortOrder property like this...
'''
[sortOrder]="1"
'''
...the value will be treated as a number rather than a string. Sometimes it's difficult to know if the string will be coerced back into a number within the PrimeNG code.
I recommend using the '[brackets]' for all Angular template property bindings. Otherwise, the type will be treated as a string, which may lead to bugs.
This is especially problematic with booleans, so I always recommend this syntax:
'''
[doSomething]="false"
'''
And if a string is actually needed, this syntax will do the trick:
'''
[myProp]="'myString'"
''' | |
4,273,509 | 1 | 4,273,585 | I just recently found out how to add an icon to a win32 project after I tried it out the base icon on my application worked fine but when I open the application the actual 16x16 icon in the top left corner is a question mark in a bubble
the odd thing is when I accidently forgot to put -mwindows in my compile code the cmd window had the icon I intentenally wanted for my window
does this make sense
heres a bit of code
'''
wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(THEICON));
'''
and
'''
wc.hIconSm = LoadIcon(NULL, MAKEINTRESOURCE(THEICON));
'''
maybe a visual aid will help<IMAGE>
P.S. If any one is felling generous I don't have the privilege to create new tags but can someone add 'icon' | Windows uses the "first" icon resource as . This icon is displayed by Windows Explorer and e.g. a console window, but is not used automatically for windows that you create. Note: as I recall the definition of "first" has varied or was never well-defined in the first place, but typically icon with lowest id (check it out if that turns out to be wrong).
You provide very little code but it seems as if you're providing the correct icon to an API-level window class. However, using 'NULL' as the module handle means load a . Replace that 'NULL' with 'GetModuleHandle( 0 )' (if I recall correctly, check).
Much more can't be said without seeing more complete code.
Cheers & hth., | |
57,872,898 | 1 | 62,378,112 | I'm having trouble trying to make a bar graph in Python but with the "bars" being stacks of images instead of rectangles. I was using matplotlib, but I couldn't find a feature similar to this one. Is there a method to do it? Even using another library?
Here's an example of what I want to generate:
<IMAGE> | Here's how I ended up doing it, based on this <URL>:
'''
fruits = {"Green": ["Grapes"],
"Orange": ["Apricot", "Orange"],
"Red": ["Strawberry", "Apple", "Cherry"],
"Yellow": ["Banana"]}
for i, color in enumerate(fruits):
for j, fruit_name in enumerate(fruits[color]):
image = mpimg.imread(fruit_name)
plt.imshow(image, extent=[i - 0.5, i + 0.5, j, j + 1])
''' | |
29,338,479 | 1 | 29,357,921 | <URL> You can reproduce it in IE11. So far I have not found the cause of the issue. Any ideas why this is being caused?
<IMAGE>
> CSS3114: @font-face failed OpenType embedding permission check.
Permission must be Installable. File:
53d9eae5-63b4-48d7-a5b8-3419455028bb.ttf
The web site is running on Azure Websites platform and is using ASP.NET MVC 5. | Fixed by adding
'''
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/octet-stream" />
</staticContent>
'''
under
'''
<system.webServer>
'''
in web.config.
Edit:
to prevent any problems with consequent releases I recommend doing this:
'''
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/octet-stream" />
</staticContent>
''' | |
25,704,955 | 1 | 25,706,374 | i have an issue with Android Studio Beta 0.8.6
every time i compile my project it deletes all my classes leaving only - or regenerate - 'R.java'
Did anyone have this issue before? i already removed the IDE and installed it
<IMAGE> | You're looking at the 'generated' folder which only contains classes generated by the Android tools (in most apps case, only the 'R.java'). Therefore there's nothing unexpected in what you've shown.
Your classes should be under a 'src' folder at the same level as the 'build' and 'libs' folder we can see in your directory:
'''
module_name
build
libs
src
main
com.your.package.name
YourClass.java
''' | |
31,104,242 | 1 | 31,555,296 | I have a Windows Server 2008 R2 with MySQL 5.5.44 and I want to upgrade to 5.6.25.
So I downloaded the <URL> from mysql.com.
When I run the installer, the installer finds my current installation but I cannot upgrade or install 5.6 next to 5.5.
Why isn't it possible to upgrade MySQL server?
<IMAGE> | I've had the same problem. The installer upgraded me from 5.5.2 to 5.5.43 but it won't ever give me the option to upgrade to 5.6, even though I've downloaded and ran both the 5.6.25 and 5.7.7 installers.
: You need to click on "Catalog..." button in the lower right-hand side of the MySQL Installer dialog. Once you've done that, you can update your catalog and the new versions of the server will show up and you can then update. | |
28,786,702 | 1 | 28,787,950 | I need to get a specific section of text from the listpicker results. So far I can get the item I select to appear in an alert box. I need to set a specific part of that listpicker selection for mysql delete.
example: '24 - <PHONE> - DTV - 25-02-2015'
I need to use the '24' as this is a row id from my sql db. I can then insert this into my blocks and add to php script to delete that row.
Block Code so far for listpicker:
<IMAGE>
<URL> | One possibility is to create 2 lists in your 'Web.GotText' event: list 'cpetypelistpicker' to display in the listpicker as you already have and a second list with only the rowids, let's call that list 'listRowIds'.
In the 'for each in list' loop of the 'Web.GotText' event add additionally:
<IMAGE>
Then in the 'Listpicker.AfterPicking' event just select the corresponding item from the second list using the 'Listpicker.SelectionIndex' like this
<IMAGE> | |
12,766,758 | 1 | 12,766,782 | This would be my query:
'SELECT * FROM Bans ORDER BY Date DESC LIMIT 10'
Here's how the timestamp(Date) looks: 'September 01, 2012 - 10:33:13' | 'May 31, 2012 - 19:28:25', etc.. Now, my problem is, is that I have records from June, but they aren't showing.
<IMAGE>
How can I fix this?
Edit: This table should show the "Latest" 10 bans. | I may supose that dates are sorted in the alphabetical order, maybe you should try
'''
SELECT * FROM Bans ORDER BY TO_SECONDS(Date) DESC LIMIT 10
''' | |
4,191,905 | 1 | 4,191,916 | I'm using selenium-rc with php. I want to show in my test the value of CLASSNAME. How can i present the var? I tried to do '$this['drivers']['CLASSNAME']' but this is not working for me.
<IMAGE>
(This is from the debug)
Thank you! | Looks like it should be:
'$this->drivers[0]->CLASSNAME' | |
24,732,103 | 1 | 24,785,274 | When I click 'Build -> Rebuild Project' I get this error.
<IMAGE>
Everyrithing is fine with the map. I successfully sync build.gradle and clean project without errors. And I can run on my device the map.
build.gradle
'''
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.0'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:5.0.77'
}
android {
compileSdkVersion 20
buildToolsVersion '20'
defaultConfig {
minSdkVersion 10
targetSdkVersion 20
}
}
'''
Manifest.xml
'''
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
''' | You have a reference to 'google-play-services_lib' in your file. Unless you have a module in a directory called "google-play-services_lib" off of your project root, which I assume you don't, then remove this bit from your settings file. The correct way to add a dependency on Play Services is not by adding this to your settings file, but by a 'compile' statement in your 'dependencies' block of your file, as you have already done:
'''
compile 'com.google.android.gms:play-services:5.0.77'
''' | |
22,400,546 | 1 | 22,400,667 | '''
'use strict';
var foodMeApp = angular.module('foodMeApp', ['ngResource', 'breeze.angular.q']);
foodMeApp.directive('angularReleases', function(){
return {
restrict :'EA',
link : function($scope, $http){
$http.get('http://api.github.com/repos/angular/angular.js/commits')
.success(function(commits) {
$scope.commits = commits
})
},
template : '<ul>'+
'<li ng-repeat="commit in commits">'+
'{{ commit.commit.committer.date | date }}'+
'<a ng-href="https://github.com/angular/angular.js/commit/{{commit.sha}}">{{ commit.sha }}</a>'+
'{{ commit.commit.message }}'+
'</li>'+
'</ul>'
}
});
'''
'''
<angular-releases />
'''
And the , It worked for the first time, after that , it is showing the error:
<IMAGE>
Can any body also suggest me some tricks/tips on how to analyze/backtrace the error, like in this error i can only understand '$http.get(...) is undefined'. rest others i do not know. | You should inject $http into the directive
'''
foodMeApp.directive('angularReleases',['$http', function($http){
return {
link : function($scope){
},
}]);
'''
You main problem is that second parameter of link function is 'element', which doesn't have 'get' method.
link takes a function with the following signature, 'function link(scope, element, attrs) { ... }' where:
- 'scope'- 'element'- 'attrs' | |
55,897,800 | 1 | 55,897,921 | I do a number sign replacement according to the rule: invert bit by bit, and add 1, but I work with an integer data type not sbyte. How does the compiler understand that I am changing the sign,
<IMAGE>
and not returning the value 255?
'''
int operand1 = 0, operand2 = 0;
int result;
operand1 = 0x01; // [<PHONE>]
result = ~operand1; // [<PHONE>]
result++; // [<PHONE>]
Console.WriteLine(" ~ {0} + 1 = {1} ", operand1, result);
'''
output:
" ~ 1 + 1 = -1 " | There are signed and unsigned integers. The signed integers can hold negative values and as such the "upper" portion of the range counts from (0- (int.max / 2)) and down.
See this article :
<URL>
if you use an Unsigned int, it behaves as I think you'd expect.
In signed ints the highest bit determines if its a negative value. | |
8,005,362 | 1 | 8,005,429 | Okay, so my gui program depends on another third-party console program to display info on pdfs. The console program takes the filename of the pdf as an argument and displays the info. I store the displayed info in a textfile. My gui program then reads the text file and displays it in an edit window. For storing the displayed info in a text file , right now I am using the system call:
'''
infodisplayer filename.pdf >> info.txt
'''
Which stores the output into "info.txt" which my gui program then reads. Now this displays an irritating console window because it needs a command processor. I want to not display the console window. So is there some way using the WinApi , Glib , Gtk+ or the C Standard Library that stores the output of a console program in a text file so that I won't have to resort to a system call? Thanks.
Sorry I know the I didn't describe my problem well, but what I am doing is this:
<IMAGE> | Follwing program should do the trick. BTW, this program uses Windows API.
'''
HWND hWnd = FindWindow(null, "Console Window title here");
if (hWnd != NULL)
{
ShowWindow(hWnd, 0); // 0 = SW_HIDE
}
'''
You can put this code block in a Timer event to check the existence of Console Window frequently. or even better you can use this:
'''
char MyCommand[]="cmd.exe /c infodisplayer filename.pdf >> info.txt";
int res = CreateProcess(NULL, MyCommand , NULL, NULL, FALSE, CREATE_NO_WINDOW ,
NULL, NULL, &StartInfo, &ProcInfo);
if (res)
{
WaitForSingleObject(ProcInfo.hThread, INFINITE);
}
''' | |
7,263,832 | 1 | 7,264,124 | I'm new to CSS and I wonder how I could make two columns and also two rows inside wrapper. The first row contains title images. Here's my code: <URL>
What I want to achieve: <IMAGE>
Edit: Here's the whole html <URL> | You don't need all that HTML. It could be as simple as this:
'''
<div id="main-wrapper">
<div class="left-box">
<h2>Oyunlar</h2>
<ul>
<li>...</li>
</ul>
</div>
<div class="right-box">
<h2>Sunumlar</h2>
<ul>
<li>...</li>
</ul>
</div>
...
</div>
'''
with the following CSS:
'''
.left-box, .right-box {
width: 15em;
float: left;
}
.right-box {
border-left:1px solid #999;
}
.right-box h2 {
margin-left: -1px; /* hide box border */
}
.box h2 {
background-color: #D8E9E6;
border-top: thin solid #97b4e0;
border-bottom: thin solid #97b4e0;
}
''' | |
38,630,369 | 1 | 38,630,997 | How do you hide the ruler in Visual Studio 2013?
I tried to disable the Productivity Power tools (Column guides option) but it's still there.
<IMAGE>
Thank you. | It was a Visual Assist option.
so i just uncheck it on :
VASSISTX > Visual Assist X Options > Advanced > Display indicator after column.
<URL> | |
30,984,564 | 1 | 30,984,760 | I have the following 2 entitys in my db.
'''
public class Article
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
// Some code removed for brevity
public virtual ICollection<Tag> Tags { get; set; }
}
public class Tag
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
// Some code removed for brevity
public virtual ICollection<Article> Articles { get; set; }
}
'''
I need to filter these articles based on the tag IDs that are passed into my action.
'''
public ActionResult FindAll(List<int> tags)
{
//
// I need to return all articles which have ALL the tags passed into this method
//
var query = ApplicationDbContext.Articles...
}
'''
For example, if I passed in 1, 2, 3 into the action, only articles which had these 3 tags or more would be returned.
How can I achieve this?
All your answers produced the correct result so I did some quick, basic profiling in sql and this was the results based on your queries.
<IMAGE> | Use <URL> like
'''
ApplicationDbContext
.Articles
.Where(a => tags.Except( a.Tags.Select( t => t.Id ).ToList() ).Any() == false)
'''
'Except()' will give you the items from the first list which exist in the second list
> The Except operator produces the set difference between two sequences.
It will only return elements in the sequence that don't appear
in the second. | |
68,457,496 | 1 | 68,457,497 | With a table that has automatic margins and cells that have a predetermined width, how can I make the widths of other cells to be a percentage of the remaining width?
<IMAGE>
'''
div {
padding: 10px;
background: purple;
}
section {
background: white;
width: calc(50% - 60px);
display: inline;
}
section:first-child {
width: 60px;
}
'''
'''
<div>
<section>cell 1</section>
<section>cell 2</section>
<section>cell 3</section>
</div>
'''
<URL> | This is a perfect job for 'grid'. Use 'display: grid;' and 'grid-template-column: 60px 1fr 1fr;' (1fr means that the column of the 2th and 3th has 1 fraction of the remaining size of the table).
Bonus: use grid gap to handle the margin between elements.
'''
div {
display: grid;
grid-template-columns: 60px 1fr 1fr;
gap: 10px;
padding: 10px;
background: purple;
}
section {
background: white;
display: grid;
place-items: center;
}
'''
'''
<div>
<section>cell 1</section>
<section>cell 2</section>
<section>cell 3</section>
</div>
'''
<URL> | |
47,525,588 | 1 | 47,542,955 | I've a Kivy app that has browse functionality. When browsing files with number names, it shows it in a weird way, it kind of sorts it by "most significant bit" style. Adding a screenshot.
Anyone knows how to fix it to show it in a proper order? (1,2,3... instead of 1,10,100...)
<IMAGE>
Thanks a lot! | You want a natural ordering. To do this, you need to replace the function that orders the files using the <URL> property of the class 'kivy.uix.filechooser.FileChooserController'.
An example based on the algorithm shown by @Darius Bacon in his answer to <URL>:
:
'''
import re
from kivy.app import App
from kivy.properties import ObjectProperty
def natural_key(path):
return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', path)]
def natural_sort(files, filesystem):
return (sorted((f for f in files if filesystem.is_dir(f)), key = natural_key) +
sorted((f for f in files if not filesystem.is_dir(f))))
class RootWidget(FloatLayout):
sort_func = ObjectProperty(natural_sort)
class MainApp(App):
def build(self):
return RootWidget()
if __name__ == '__main__':
MainApp().run()
'''
'''
<RootWidget>:
TabbedPanel:
do_default_tab: False
TabbedPanelItem:
text: 'List View'
BoxLayout:
orientation: 'vertical'
FileChooserListView:
sort_func: root.sort_func
TabbedPanelItem:
text: 'Icon View'
BoxLayout:
orientation: 'vertical'
FileChooserIconView:
sort_func: root.sort_func
'''
Some screenshots as an example:
<URL>
<URL> | |
22,882,764 | 1 | 22,884,544 | The code I use to create textures looks like this:
'''
GImage ballTexture = createTexture("ballTexture.png", (int) BALL_SIZE,
(int) BALL_SIZE);
'''
method:
'''
private GImage createTexture(String importedImage, int width, int height) {
Image importResult = getImage(getCodeBase(), importedImage);
GImage textureResult = new GImage(importResult);
textureResult.setSize(width, height);
return textureResult;
'''
My project file structure is this (Java is general folder for all projects):
<IMAGE>
I put 5 texture files inside 'bin' folder after I found that they were not imported otherwise (from different locations). I had a copy of 3 inside 'PongGame', and another copy inside 'src' but those I did not update, and after i chose to rename my project with File -> Rename... and my 'bin' folder was lost, 2 files were lost and 3 were replaced with outdated versions (i dont know which copy was used to replace those)
So my question would be: how should i properly store textures and then import them into my game? | I believe if you add it to your src folder it will be copied to the bin folder for you. Generally I make a res folder inside src to keep things more organized. Might not be best but it works. | |
15,036,417 | 1 | 15,044,870 | I've got a VoIP video application that works fine on MAC, Windows and iOS using the VP8 codec. When I place a call between any of these platforms and Android both sides of the call have a black and white image with red, green and blue squares. The same happens when Android calls Android.
I'm compiling VP8 with:
'''
./libvpx/configure --target=armv7-android-gcc --sdk-path=/Applications/adt/ndk --disable-examples --enable-runtime-cpu-detect --enable-realtime-only --enable-neon
'''
My question is why does the Android platform yield this result and how can I go about debugging it?
Here is a screenshot of the problem:
<IMAGE>
Additional information:
The camera frame format is ImageFormat.NV21. The encoder image format is VPX_IMG_FMT_I420. | Because libvpx is configured to take image format VPX_IMG_FMT_I420 the NV21 frames must first be converted to I420. | |
29,834,454 | 1 | 29,837,348 | <IMAGE>
Is it possible the change the Icon for btnEdit in my C# code? For example, when you click on btnEdit, the Icon will switch from "Edit" to "Cancel"?
This app is for Windows Phone 8.1, and I want to use the icons that have already been provided.
I have so far been able to switch the label (btnEdit.Label = "Cancel") and this works, but I can't seem to get it working for Icon.
Any suggestions? | You need to set the icon to a Symbol Icon object and not a string
'''
btnEdit.Icon = new SymbolIcon(Symbol.Cancel);
''' | |
23,465,637 | 1 | 23,466,604 | I have included all necessary jar filex in my folder but it raises run time error saying 'java.lang.NoClassDefFoundError: org/hibernate/Session'. Here is screenshot of my project hierarchy
<IMAGE>
One thing if run this by making a main function and run it as java application then it works fine and give correct output but on tomcat as a web application it raise error.
Anyone here please guide me | Do like this go to 'Properties' of the 'Project',then select the 'Deployment Assembly',then Click on 'Add' and select 'Java Build Path Entries' and Add your 'Hibernate' and then Click on 'Finish'.Then check your problem is resolved or not. | |
22,046,082 | 1 | 22,046,167 | I am trying to add up the characters in a String. But that doesn't seem to work. I am using this code:
'''
public String createDeciOfOct (String number) {
int result = 0;
String[] numberArray = number.split("");
for (String numb : numberArray) {
if(numb != null || numb != "") {
result += Integer.parseInt(numb);
}
}
return Integer.toString(result);
}
'''
How I am executing it is like this:
'''
frmOctToDeci.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText edtTxt = (EditText) findViewById(R.id.octalValue);
String value = edtTxt.getText().toString();
String result = createDeciOfOct(value);
TextView txtView = (TextView) findViewById(R.id.fromOctRes);
txtView.setText(result);
}
});
'''
It gives me an error as:
> 'java.lang.NumberFormatException: Invalid int: ""'
Which means that there is some sort of empty string. How can I prevent this?
The logcat errors are as:
<IMAGE> | Always use 'equals()' for testing (in)equality between 'String's:
'''
!numb.equals("")
'''
Also it might be easier to process the input as a 'char[]', but that's just an idea:
'''
char[] numberArray = number.toCharArray()
'''
Then it's easy to convert a 'char' to a digit, simply use 'Character.getNumericValue()' on each 'char' you wish to convert. | |
8,268,712 | 1 | 8,268,879 | <IMAGE>
I've tried disabled text-decoration, outlines, borders, and everything else I can think of. Using the inspect tool I cannot find anything that would cause these blue lines.
This issue does not affect Firefox.
The text with the blue underline is a 'span' inside of an anchor tag. | You seem to have this problem:
<URL>
When you press F12 and inspect the elements affected, you should notice this:
'''
a:-webkit-any-link{
...
text-decoration: underline;
}
'''
So maybe adding a stylesheet like this:
'''
a:-webkit-any-link{
text-decoration:none !important;
}
'''
UPDATE : I reproduced it and the above stylesheet, added to your main.css file worked.
No need of two ":", it was a typo probably.
Anyway it solved the problem on my PC, try to add it to your main.css and it should work.
Thanks! | |
26,655,605 | 1 | 26,658,148 | I am using the extjs (xtype).
When I add this to my panel it looks very ordinary :
<IMAGE>
The text field should stretch out to the end of the 'File : ' label, and ideally I would want the browse button more to the right. This is how i use it :
'''
layout: {
type: 'anchor'
},
items: [
{
flex: 1,
xtype: 'label',
text: 'Upload',
style: 'font-weight: bold',
height: 22
},
{
flex: 1,
xtype: 'radio',
boxLabel: 'Client [Pfad / Dateiname]',
name: 'radioradio',
itemId:'RadioClientUploadWindow',
checked: 'true'
}, {
flex: 1,
xtype: 'fileuploadfield',
id: 'filedata',
emptyText: 'Select a document to upload...',
fieldLabel: 'File ',
buttonText: 'Browse '
},
'''
Is there some way of making this component look reasonably OK ? | Oliver,
When designing forms, Sencha had in mind that you would have many fields in your form, so all the labels have the same width to make a consistent look on your screen.
Your form looks weird because you only have one form field there. To adjust your width, just set your 'labelWidth' to whatever is proper to your form (I believe 40 would be right for you), also, I don't think the setting 'flex' works with the 'anchor' layout, try replacing it with 'anchor: 100%'.
This should make your field looks better:
'''
{
xtype: 'fileuploadfield',
anchor: '100%',
labelWidth: 40,
id: 'filedata',
emptyText: 'Select a document to upload...',
fieldLabel: 'File ',
buttonText: 'Browse '
}
''' | |
19,113,537 | 1 | 19,113,656 | Since '$.Deferred();' object can be resolved and many can subscribe the 'done/always/fail' methods-
I thought to myself : "well I can use it as publisher / subscriber ..."
So I made a simple test (<URL> :
I have 3 checkboxes :
<IMAGE>
And I want to display alert when all 3 are checked :
'''
var t = $.Deferred();
$(":checkbox").on('click',function (){
t.resolve("blabla");
});
t.done(function (val)
{
if($(":checkbox:checked").length==3) alert('ok');
});
'''
But the 'done' callback is only resolved once.
Is there anything I can do so this code will function as subscriber/publisher ?
'deferred''deferred' | When Deferred object is resolved, its state is considered finalized. But you're right, there's a pubsub mechanism, called Deferred.progress. It's usually employed when Deferred object's state changes gradually, so these gradual changes should be tracked as well.
You can use <URL> for publishing. Your code, in particular, might be written like this:
'''
var t = $.Deferred();
t.progress(function(val) {
if($(":checkbox:checked").length == 3) alert(val);
});
$(":checkbox").on('click',function (){
t.notify("blabla");
});
'''
<URL>. | |
9,338,101 | 1 | 9,338,367 | I was wondering if anyone would like to share with me how do you do a sum of column B after looking for a particular name in column A? Say for example, I want to sum test1 to test4. Then the total will be place into the "B1" where the 'In' is beside it by the way, "In" does not necessary be at "B1". I have added in a picture to ease the confusion.
<IMAGE>
I have tried doing some coding:
'''
Sub Macro1()
Dim lcell As Range, lrow As Long, rowToSum As Long
lrow = 1
Do
set lcell = Sheets("Sheet1").cells(lrow,1)
If lcell = "Test1" or "Test2" Or "Test3" Or "Test4" Then
'I'm not sure how to i sum different columns, my guess was to do a rowToSum = lcell
lrow = lrow + 1
Exit Do
End If
Loop
End Sub
'''
I would appreciate it if you can clear my problem! Thank you so much! | > > > > Hi, I think you misunderstood my question. I want to add the values of test1 - test4 together, which means, I want to add the values at Col B, i should have 10 at B1. The code you have provided actually sum up test1-test4 in Col A, not the value on column B. - user1204868
That makes it 2 of us LOL.
Try this
'''
=SUMPRODUCT((A1:A10={"Test1","Test2","Test3","Test4"})*(B1:B10))
'''
Put this formula in C1
If you want to use this in B1 then change it to
'''
=SUMPRODUCT((A2:A10={"Test1","Test2","Test3","Test4"})*(B2:B10))
'''
'''
Sub Sample()
Sheets(1).[b1] = Evaluate("SUMPRODUCT((A2:A10={""Test1"",""Test2"",""Test3"",""Test4""})*(B2:B10))")
End Sub
''' | |
9,140,030 | 1 | 9,140,108 | I'm looking out for some solution regarding the custom progress view.
Basically, i would like to fill the image below to represent the loading progress,just like the one's we have in games.
<IMAGE>
Any ideas how to achieve it?? | Masking using CoreGraphics:
'''
UIImage *img = [UIImage imageNamed:@"imagetomask.png"];
CGImageRef maskRef = [UIImage imageNamed:@"mask.png"].CGImage;
CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
CGImageGetHeight(maskRef),
CGImageGetBitsPerComponent(maskRef),
CGImageGetBitsPerPixel(maskRef),
CGImageGetBytesPerRow(maskRef),
CGImageGetDataProvider(maskRef), NULL, false);
CGImageRef maskedImage = CGImageCreateWithMask([img CGImage], mask);
[imageView setImage:maskedImage];
'''
Your 'mask.png' should be non-transparent image filled like inverted alpha - black for visible parts, white for transparent. | |
26,775,089 | 1 | 26,777,332 | I have a div with absolute position floating on the right side (green).
It is correct that protrudes half
The problem is when the window to the minimum size of 985px page is reduced. Although the div is floating generates side-scrolling, is it possible to avoid this by reducing the window scroll?
<IMAGE>
'''
<body style="width:100%; min-width: 985px; padding:0px; margin:0px; color:#FFFFFF; background:#160E30; border:2px solid yellow;">
<div style="position:relative; width:985px; margin:0 auto; height:70px; border:2px solid #FFFFFF">
<div style="color:#FFFFFF">TITLE</div>
<div style="position:absolute; top:-10px; right:-15px; width:100px; height:30px; border:2px solid green;">FLOAT</div>
</div>
'''
<URL>
<URL>
It's a small picture by simply design. Half of the image is within the page and the rest outside. When the window is reduced to the minimum width of the body, half of the image is not hidden, shown full generating a small scroll. | - - -
<URL> | |
9,499,836 | 1 | 9,665,324 | Am working on <URL>. I just redirect my app to 'PayPal' But, i got like this -
<IMAGE>
What can i do for this now? I didn't pass any payment details to 'PayPal' How do pass it and how do i finished it. Anyone help me to do this? | I've passed the payment details using this <URL> which is generated by Sandbox. Now, am getting a new problem with payment process. Check my updated question. | |
22,619,944 | 1 | 22,645,701 | I am working on an image stitching app, which takes input from camera, estimates image transformation and warped input image by the estimated transformation. As shown in the following figure, image from camera are input into 2 branch of chains. However, the processing of image warping is dependent on the result of transformation estimation. My question is how I can make branch 1 wait for the results of branch 2?
<IMAGE> | If you make your image warping filter a subclass of GPUImageTwoInputFilter, this synchronization is taken care of for you.
Target the GPUImageVideoCamera instance to your feature matching / transformation estimation filter and the image warping filter, then target your feature matching / transformation estimation filter to the image warping filter. This will cause your video input to come in via the first input image and the results of your feature matching and transformation estimation filter to be in the second image. GPUImageTwoInputFilter subclasses only process and output a frame once input frames have been provided to both their inputs.
This should give you the synchronization you want, and be pretty straightforward to set up. | |
53,354,401 | 1 | 53,354,459 | I am making websites where I need roles such as admin, Doctor , patient ,Receptionist.
I want to store UserId and roleid in AspNetUserRoles table.It is working longest I dont add duplicate data . But once I add duplicate data it gives me error.
I want different users can have one roles within Admin, Doctor, Patient ,or Receptionist. But I cannot add role more than one time in table.
Please can anyone give me suggestion and help with this issue ?
This is AspNetUserRoles table and error
<IMAGE> | You have RoleId as a Primary Key(PK). You cannot have duplicate values that are a primary key. RoleId needs to be a Foreign key(FK) that relates to a table that contains your roles. | |
9,392,851 | 1 | 9,392,950 | How can I recreate this layout for my site? (frame-over-frame)
Does it use a standard JavaScript library?
I'm looking for JavaScript/CSS (or tutorial)...
<IMAGE>
Thanks | These are not frames.
The most relevant techniques for Chrome's settings / Webstore page are:
- <URL>
The full CSS and HTML code can be viewed by using 'Inspect element' at 'chrome://settings'. | |
27,459,434 | 1 | 27,459,491 | I have pulled my project from github and since then I got the issue "R cannot be resolved to a variable" . Also my folder inside res folder started appearing grey. Below is the screen shots. can anybody help me to solve this issue?<IMAGE> | There will an error in your res folder that is hindering the formation of R.java. See if there is any error in res and then clean the project. | |
12,439,698 | 1 | 12,442,945 | Can someonse show me how to calculate the following in matlab:
<IMAGE>
where
'''
g = 9.91
As = 1000
z = 10
zv = 30
zD = 10
pz = 999
Az = 500
''' | Well, there are a couple of ways to go about this:
### Analytical approach
Like Rudy commented, this is a trivial integral to do analytically because it's the <URL>. Its indefinite integral would be:
> 'F(z) = (g/As)(z2/2 - zvz)pzAz'
According to the <URL>', that is:
> 'ST = F(zd) - F(0) = (g/As)(zD2/2 - zvzD)pzAz'
In MATLAB, that would be:
'''
ST = g / As * zD * (zD / 2 - zv) * pz * Az
ST =
-1.2375e+06
'''
### Numerical approach
If, for some reason, you want to calculate that numerically by approximating the integral, you can use the <URL> function for this:
'''
dz = 0.001; z = 0:dz:zD;
y = g / As * (z - zv) * pz * Az;
ST = trapz(z, y)
ST =
-1.2375e+06
'''
or make an even cruder approximation with a simple sum:
'''
ST = sum(y * dz)
ST =
-1.2387e+06
''' | |
7,737,313 | 1 | 7,737,531 | Ha ii everybody,i am doing a bible app ,my requirement is to highlight the verse when the user tap the corresponding verse number eg: if the user tap the verse 1.1 it highlight that verse in yellow or blue color.If the verse no: is gives as link means 1.1 is a link ,the user can tap that link to perform a action by using javascript.I also want a popup menu or alert-view or action<IMAGE>-sheet when the user tap the verse no:.I hope you understand my question.
Thanks in advance. | You can call <URL> on your UIWebView with script, which change backgroud color of element with the verse. | |
21,589,179 | 1 | 21,589,362 | '''
<!DOCTYPE HTML><HTML><HEAD><style>
body {
font-family: "HelveticaNeue";
font-size: 12pt;
}
</style>
</HEAD><BODY> Osobenno chasto takie situatsii voznikaiut pri popytkakh realizovat' programmno polet mysli dizainera s uchetom tekhnicheskikh osobennostei takikh sistem.
</br>
O tom, kak my reshaem takie zadachi pri rabote nad mobil'nym prilozheniem xxx, my rasskazhem v etoi stat'e.</BODY></HTML>
'''
Could anyone tell me what's wrong with the spaces in the second sentence (please look at jsfiddle <URL>?
Here is what the browser shows me:
<IMAGE>
How can I fix the problem? | I inspected that code block (with Chrome's inspector) and saw this:
<IMAGE>
You used thin spaces (' ' or ' ') instead of normal spaces (''). I have no idea where you got them, but apparently the font you're using doesn't support thin spaces, so they don't show up.
Simply change all the ' 's (thin spaces) into normal spaces, and it will work fine. (Or use a find/replace tool.) | |
8,101,403 | 1 | 8,102,057 | I wanted to make a simple R plot with y-axis labels centered above the y-axis tick labels. I created something I liked with the code below. But it required some fumbling with the 'at' graphical parameter.
Q: Is there a less hacky way of doing this? Is there a way to query the y-axis tick labels for their width so that I could use that information to center the y-axis label above them?
'''
set.seed(1)
n.obs <- 390
vol.min <- .20/sqrt(252 * 390)
eps <- rnorm(n = n.obs, sd = vol.min)
windows(width = 5.05, height = 3.8)
plot(eps, main = "Hello World!", las=1, ylab="")
mtext(text="eps", side=3, at=-60)
'''
<IMAGE> | You can get the extent of the user coordinates with 'par("usr") and then convert the units of margins. You have added an extra wringle by making the plot area non-standard. On a standard 7 x 7 device this works:
'''
mtext(text="eps", side=3, at=usrcoord.x.left-0.075*diff(range(par("usr")[1:2]) ))
'''
But on your smaller plot window, you need to use:
'''
mtext(text="eps", side=3, at=usrcoord.x.left-0.1*diff(range(par("usr")[1:2]) ))
''' | |
20,770,701 | 1 | 20,770,950 | i have binded itemsource to Datatable for Datagrid . it shows extra columns how to remove it
My code :
'''
<DataGrid Name="dataGrid" IsReadOnly="True" VerticalAlignment="Top"
ItemsSource="{Binding Cus}" AutoGenerateColumns="True"/>
'''
it show extra columns How to remove it ?
Screen shot :
<IMAGE> | Set 'AutoGenerateColumns="False"' and 'Width="*"' for all Columns
'''
<DataGrid x:Name="dataGrid" IsReadOnly="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding OrderId}" Header="OrderId" Width="*"/>
<DataGridTextColumn Binding="{Binding ProductId}" Width="*" Header="ProductId"/>
<DataGridTextColumn Binding="{Binding UnitPrice}" Width="*" Header="UnitPrice"/>
<DataGridTextColumn Binding="{Binding Quantity}" Width="*" Header="Quantity"/>
<DataGridTextColumn Binding="{Binding Discount}" Header="Discount"
Width="*"/>
</DataGrid.Columns>
</DataGrid>
'''
You can set like this to achieve your requirement
'''
<DataGrid HorizontalAlignment="Left" Margin="50,0,0,0" Width="500"
Name="dataGrid" IsReadOnly="True" VerticalAlignment="Top"
ItemsSource="{Binding Cus}" AutoGenerateColumns="True"/>
this.dataGrid.AutoGeneratingColumn += dataGrid_AutoGeneratingColumn;
void dataGrid_AutoGeneratingColumn(object sender,
DataGridAutoGeneratingColumnEventArgs e)
{
e.Column.Width = new DataGridLength(1, DataGridLengthUnitType.Star);
}
''' | |
15,614,179 | 1 | 17,400,780 | I recently moved my magento site from my localhost to the live server - everything had been working perfectly on the localhost but when I moved it across quite a few errors turned up. I've managed to get rid of most of these but I've just come across this:
<IMAGE>
The Checkout page is only partially loading and I really have no idea why this is happening and how to go about fixing it :(
I'm guessing that the Billing Information section is the stumbling block but why would this be? Could there be a problem retrieving information from the DB? - and how could I go about testing that. "#checkout-step-billing" is loading but it is defaulting to display none and nothing after that point has loaded.
Would greatly appreciate any help and advice on this. | Fixed this problem by increasing the memory_limit in the php.ini file.
Instructions on how to do this here: <URL> | |
7,508,558 | 1 | 7,508,592 | I am working from Programming Game AI by Example book. Look at this image, the result on the left is the author's, the one on the right is mine. Green is source and red is target. Dijkstra is applied, and you can see the shortest path but also the other paths that were searched. How come my image is different, what could this mean?
<IMAGE> | At a very quick glance it looks like they weight diagonal walks heavier then vertical or horizontal ones. Yours looks like it weighs going n,s,w,e,ne,nw,se,sw all the same. Hence you go diagonal when they went horizontal or vertical. | |
30,532,889 | 1 | 30,533,474 | Is it possible to overlay two plots with gridExtra (or other package)?
I want to rescale one plot and overlay it to a second one (specifying rescaling and coordinates)
'''
require(ggplot2)
require(gridExtra)
df <- data.frame(value=rnorm(10), date=1:10)
p1 <- ggplot(data.frame(df), aes(value,date)) + geom_line()
p2 <- ggplot(data.frame(df), aes(value,date)) + geom_point()
'''
to obtain something like this
<IMAGE> | Look at 'gtable' package in combination with 'gridExtra'. You can specify size and coordinates of plot as you like.
'''
require(gtable)
p1 <- ggplotGrob(p1)
p2 <- ggplotGrob(p2)
gt <- gtable(widths = unit(c(1, 2), "null"), heights = unit(c(.2, 1, 1), "null"))
gt <- gtable_add_grob(gt, p2, t = 1, b = 3, l = 1, r = 2)
gt <- gtable_add_grob(gt, p1, t = 2, l = 2)
grid.draw(gt)
'''
<IMAGE> | |
26,868,113 | 1 | 26,887,528 | I have a problem in my app and can t find a solution.
I have a with custom cells. My cells have a UITextField inside.
When textfield is in editMode (with the keyboard active), if i reload the collectionView i have a error. This error happen because the call of the method of the .
The problem is the cell probably don't exist anymore inside the collectionView, since it was dealloced.
This is my stack on the error:
<IMAGE>
Any idea how to avoid this problem?
Thanks in advance | Add a reference in the model to the textfield, weak reference.
When the model will be dealloc, resign the responder of the textfield.
Code:
'''
-(void)dealloc{
if (self.refrenceTextField) {
[self.refrenceTextField resignFirstResponder];
self.refrenceTextField = nil;
}
}
''' | |
24,488,958 | 1 | 24,565,296 | I have project supported till iOS7, i run it in using . I found problem in order of cancel button in .
'''
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"Title"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Button1",@"Button2",@"Button3",nil];
[alert show];
'''
<IMAGE>
---
1. Why Cancel button location is different in both OS?
2. Is it a new UI changes in iOS8 ? If yes please give me a reference link. | . In iOS 8 UIAlertView and UIActionSheet are deprecated. Instead use UIAlertController. Following is the reference to it:
<URL>
The order in which you add UIAction in UIAlertController is the order in which buttons appear in alert.
Ordering of buttons is fixed in iOS 8 Beta 3. Position of 'Cancel' button is always last now. | |
31,531,064 | 1 | 31,531,114 | I need to run 'SDK Manager' but get me bellow error :
<IMAGE>
And when I run the project get me this error 'Failure [INSTALL_FAILED_UID_CHANGED]' . | Under Android Studio, 'select File -> Project Structure -> JDK location'.
Specify the 'JAVA SDK folder'. .
This error cause there's not any folder or 'SDK manager' found in this directory.you just need to do like above and Specify the 'PATH' of 'SDK Manager'.
'PATH''sdk manager''SDK manager'
<IMAGE> | |
27,422,868 | 1 | 27,423,089 | I need to display two div elements inside a parent div , something which looks like this
<IMAGE>
And I tried something for this like
'''
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div >
<div style="background-color:red;display:inline-flex;">inner div 1</div>
<div style="background-color:yellow;display:inline-flex;">inner div 2
<div style="background-color:yellow;">innermost div 1</div>
<div style="background-color:yellow;">innermost div 2 </div>
</div>
</div>
</body>
</html>
'''
And also some combinations , but nothing works for me , anyone please suggest on this.
Thanks. | Did you try with display:inline-block?
'''
<div style="background-color:green; padding:5px;" >
<div style="background-color:red;padding:5px; display:inline-block;">inner div 1</div>
<div style="background-color:yellow;padding:5px; display:inline-block;">inner div 2
<div style="background-color:blue;padding:5px;">innermost div 1</div>
<div style="background-color:brown;padding:5px;">innermost div 2 </div>
</div>
</div>
''' | |
23,356,098 | 1 | 23,356,483 | I would like to convert the below query from nvarchar to int
'''
SELECT 'A' + RIGHT('000' + CAST((MAX(UserID) + 1) as nvarchar(50)), 3) FROM users
'''
How do I do that?
This is my table:
<IMAGE>
And this is my data:
'''
ID | UserID | Name
1 A001 XYZ
''' | now try this one.
'''
Select 'A' + RIGHT('000' +
CAST((MAX(Convert(Int,SUBSTRING(USERID,2,LEN(USERID))))+ 1) as nvarchar(50)), 3)
From users
''' | |
12,046,704 | 1 | 12,046,749 | Screenshot:
<IMAGE>
I populated the above menu in screenshot using below code, but silly me I can't figure out how can I create click event on each subitem since they don't have property name? :S My intention is to click, let say, "Do and Do", then the file will be opened using 'Process.Start(filename);'. Please bear with me as I am very new to programming. :| Thank you so much!
'''
private void loadViewTemplates(string path)
{
foreach (string file in Directory.GetFiles(path, "*.txt"))
{
ToolStripItem subItem = new ToolStripMenuItem();
subItem.Text = Path.GetFileNameWithoutExtension(file);
viewTemplatesToolStripMenuItem.DropDownItems.Add(subItem);
}
}
''' | Try stubbing out the click procedure. The sender would be the menu item that was clicked:
'''
private void MenuClicked(object sender, EventArgs e) {
MessageBox.Show("Clicked on " + ((ToolStripMenuItem)sender).Text);
}
'''
Then wire up the click event for each menu:
'''
ToolStripItem subItem = new ToolStripMenuItem();
subItem.Click += MenuClicked;
subItem.Text = Path.GetFileNameWithoutExtension(file);
viewTemplatesToolStripMenuItem.DropDownItems.Add(subItem);
''' | |
7,832,880 | 1 | 7,833,426 | I want to set 'TBitBtn''s anchor property dynamically.
First I have set the button's anchor as top right in design time. In that button click event I set form's 'BorderStyle' as 'bsDialog'. Then there should be a gap as shown in image. I want the button should be beside close button.
So I need to set button's left and its anchor as top right after assigning border style as 'bsDialog'. Is it correct?
I don't know the way to change anchor property dynamically <IMAGE>
Thanks, Rakesh | I don't know if I can see your problem. If it's about syntax then here you go:
'''
BitBtn1.Left:= 666;
BitBtn1.Anchors := [akTop, akRight];
'''
This is the way to modify position and anchor in code. | |
16,287,432 | 1 | 22,098,588 | I'm interacting with OneNote's COM interop using Python on Win32.
Here's the most basic code to pull out notebook hierarchy:
'''
import win32com.client
onObj = win32com.client.gencache.EnsureDispatch('OneNote.Application.12')
result = onObj.GetHierarchy("",win32com.client.constants.hsNotebooks)
print(result)
'''
Note the 'OneNote.Application.12', this works as I'd expect.
The thing is that when I run Makepy I'm actually selecting the v15 type library:
<IMAGE>
If I change the code to be either 'OneNote.Application.15' or just 'OneNote.Application' then I get an error:
'''
TypeError: This COM object can not automate the makepy process - please run makepy manually for this object
'''
Why is this please? I'm running:
- - - - | Check your registry record, in particular key {0EA692EE-BB50-4E3C-AEF0-356D91732725} in TypeLib section:
> HKEY_CLASSES_ROOT\TypeLib\{0EA692EE-BB50-4E3C-AEF0-356D91732725}
This strange bevahior is probably caused by existence of invalid subkeys. This class key have to contain only a single subkey "1.1" and nothing else.
The correct registry record for this class should look as follows:
'''
|- {0EA692EE-BB50-4E3C-AEF0-356D91732725}
| |- 1.1
| |-0
| | |- win32
| |- FLAGDS
| |- HELPDIR
'''
The key "win32" have to point to OneNote executable, e.g. C:\PROGRA~1\MICROS~1\Office15\ONENOTE.EXE | |
27,438,687 | 1 | 27,562,056 | I'm using ajaxfilebrowser on my webapp to browse a webdav folder for each user.
When i use the online update fonctionality, ItHit lunch an applet like this:
<IMAGE>
I want to remove the name and the editor of the applet and set my custom parameters.
Is this possible? | This dialog provides information about the Java applet, so the user can clearly identify the vendor, name of the applet and where it comes from. It is displayed by the Java machine, you can not modify it freely.
However you can change the applet name and the publisher. To do this you will need to resign the applet with your own Java code signing certificate. | |
27,791,613 | 1 | 27,791,774 | I'm a beginner in web design
and I was trying this API
<URL>
and it mention that auto-tagging need to use get request
and it give this:
<IMAGE> -> it's a screen shot picture
but I have no idea how to send request
(after I saw the below answer given by Barmar)
I have tried to type this code:
'''
$(document).ready(function(){
jQuery.ajax({
url: 'http://api.imagga.com/v1/tagging',
type: "GET",
data: { url: 'http://upload.wikimedia.org/wikipedia/commons/9/95/Mountain-bike-racing.jpg'} ,
beforeSend: function(xhr) {
xhr.setRequestHeader ("Authorization", " Basic my key");
},
success: function(response) {
alert(response);
}
}); });
'''
but it comes to show that
- <URL>
thanks for your help | It should be something like this:
'''
$(document).ready(function(){
$.ajax({
url: 'http://api.imagga.com/v1/tagging',
type: "GET",
data: { url: 'http://upload.wikimedia.org/wikipedia/commons/9/95/Mountain-bike-racing.jpg',
beforeSend: function(xhr) {
xhr.setRequestHeader ("Authorization", "Basic YourAPIKey");
},
success: function(response) {
alert(response);
}
});
});
'''
You use the 'data:' parameter to set URL parameters in 'GET' requests. To implement authentication, you have to add an 'Authorization' header, this is done using the Javascript 'setRequestHeader' method on the XHR object. | |
3,914,329 | 1 | 3,914,662 | I want to create a circular button having a plus and minus sign on to this and exactly used in Android
Contacts application like shown in the image as below:
<IMAGE> | You may see implementation of this button in android <URL>
It's just ImageButton with circular png as background. Here is definition of their styles:
'''
<style name="MinusButton">
<item name="android:background">@drawable/btn_circle</item>
<item name="android:src">@drawable/ic_btn_round_minus</item>
<item name="android:contentDescription">@string/description_minus_button</item>
</style>
<style name="PlusButton">
<item name="android:background">@drawable/btn_circle</item>
<item name="android:src">@drawable/ic_btn_round_plus</item>
<item name="android:contentDescription">@string/description_plus_button</item>
</style>
''' | |
22,409,212 | 1 | 22,409,309 | Sometimes you'll see a "clock wipe" animation in use. Something like this:
<IMAGE>
How would you achieve that effect in iOS?
(Note: This question is a "ringer." I wanted to share a technique for creating a clock wipe animation, but SO does not have a format for sharing tutorials, so the closest I can come is asking a question and then providing the answer. This is deliberate, and an attempt to share information that others might find useful.) | Answer:
You'd create CAShapeLayer and install it as a mask on your view's layer.
You'd then install an arc into the shape layer that spanned a full 360 degrees, and had a radius that was half the center-to-corner distance of your image. You'd give it a line width that was the same as the radius.
Finally, you'd create a CABasicAnimation that animates the strokeEnd property of the shape layer from 0 to 1.0. This would cause the shape to start out empty (image fully masked) and animate the mask as a "pie slice" that got bigger and bigger, until it was the full size of the image.
You can download a sample project on github that I wrote that shows working code for this animation, among other Core Animation techniques:
<URL>
---
## EDIT Update for Swift 5:
Ok, this thread is REALLY old. I tried to get the sample project to build and gave up fighting with Xcode after about 45 minutes. Too many settings are out of date with current project formats.
The clock wipe demo needed to be rewritten in Swift, so I just started over.
The new project can be found at this link: <URL> | |
6,415,344 | 1 | 6,415,782 | I use Chrome 12 on Mac OS X and I've included jQuery 1.6.1 within the document.
I try to read the contents of a file as text and save it in a data-object with the following function:
'''
this.upload = function(file) {
console.log('FileHandler.upload called with ' + file.name + '.');
console.log(file);
console.log(this.reader);
data = {
content: this.reader.readAsText(file)
}
console.log('Content: ' + data.content);
}
'''
"file" seams to be a valid file-object and "this.reader" is a fresh instance of type FileReader. This code creates the following console output:
<URL>
<IMAGE> | That's not the way it works according to the <URL>' function, and when it's completed the result is stored in '.result'. | |
26,411,231 | 1 | 26,414,858 | I'm trying to figure out if the following picture is possible in GWT with a custom Data Grid. I have each row that contains customer information and then a second Data Grid to the right that shows orderline information. I'm basing it loosely off the <URL>, but that only shows "friends" with the same attributes under each person, and doesn't show a nest Data Grid. So is this possible? any tips on where to start? I've done a normal Data Grid but this is a little more complex so advice or examples would be helpful. Smart GWT is not an option.
<IMAGE> | Not the optimal solution but you can have nested html table code in the Cell
Example
'''
...
userColumn = new Column<User, SafeHtml>(new SafeHtmlCell()) {
@Override
public SafeHtml getValue(User user) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendHtmlConstant("<table style="width:100%">");
for (Product product : user.getProducts()) {
sb.appendHtmlConstant("<tr>");
sb.appendHtmlConstant("<td>" +product.getProductNumber()+"</td>");
sb.appendHtmlConstant("<td>" +product.getName()+"</td>");
sb.appendHtmlConstant("<td>" +product.getQuality()+"</td>");
sb.appendHtmlConstant("<tr>");
}
sb.appendHtmlConstant("</table>");
return sb.toSafeHtml();
}
};
''' | |
14,728,082 | 1 | 14,728,205 | I want to develop listview with multiple child like below image, I Google but not got any similar solution.
'''
Job 1
Floor 1
Floor 2
Floor 3
Room 1
Room 2
Room 3
Job 2
Floor 2
Room 2
Job 3
Job 4
'''
<IMAGE>
Can someone suggest me? how to achieve something like, any hint or link? | Have you seen and tried this one :
<URL> |