Narrator5000/llavanext-finetuned-stackoverflow-vqa
Updated
•
4
•
1
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
|
---|---|---|---|---|---|
72,017,601 | 1 | 72,020,290 | I can't seem to figure out this one.
I have a csv file, 2 columns. ColumnsA contains the path to a file and ColumnB the destination of said file. Total rows 1,000.
I will like terminal to loop and move each file located in columnA to the destination in columnB
<IMAGE>
In terminal, I tried using this:
'''
for file in $(cat ~/downloads/Mover.csv); do mv ...
'''
I can't figure out the next piece of the command. Can you please help?
Raw file Format: csv (comma delimiter)
The raw file is as shown in the screenshot. ColumnA contains the path of each pdf that needs to be inserted inside the folder in ColumnB
- -
I'm very new to the world of terminal. Please let me know what I can provide | The CSV format isn't very friendly for UNIX standard tools, but as long as you don't have commas, double-quotes or newlines in your content then you can use this:
'''
#!/bin/bash
while IFS=',' read -r location new
do
mv -i "$location" "$new/"
done < <(sed $'s/
$//' file.csv)
'''
'new' | |
20,223,992 | 1 | 20,224,516 | I am new to wireshark and trying to solve simple examples. I captured a simple html file and the question i am trying to answer is: "How many bytes of content are being returned to your browser?".
I am confused here. Let me first show the screenshot here:
<IMAGE>
I see two things when i click on the "OK" message received from the server. First it says 540 bytes captured, and second it also says that content length is 232. Which one is the answer to my question and what is the difference between these two numbers? Can anyone explain?
Thanks | The two numbers are measuring different things. The 'Content-Length' is the actual size of the HTTP response body in bytes (only the body, so not including the headers), whereas the 540 is the total size of the network frame including the IP and TCP protocol overhead and the HTTP headers. | |
12,616,125 | 1 | 12,616,303 | I have a background image for example
<IMAGE>
What I want to do is make the length longer but keep the rounded corners where they are. I know there is a CSS trick out there that does this (they use it for iPhone web apps) but I can't find it.
How can I do this? | ..........................<URL>
Hi now it's very simple
'''
<div></div>
'''
used to this
'''
div{
width:100px;
height:100px;
background:red;
border-radius:20px;
border:solid 10px blue;
box-shadow:20px 20px 0 0 rgba(0,0,0,0.4) inset;
-webkit-box-shadow:20px 20px 0 0 rgba(0,0,0,0.4) inset;
-moz-box-shadow:20px 20px 0 0 rgba(0,0,0,0.4) inset;
}
'''
<URL>
---
Same as u want this
<URL> | |
70,843,585 | 1 | 70,843,766 | For this example I've got a list of names with a variety of categories they can belong to.
I'd like to generate a sublist of names based on which category they're in which would appear in the cell the formula's in, using the cells below for additional names.
<IMAGE>
E.g. (poorly laid out text version because my org won't let me share publicly)
Name.....| Cat 1 | Cat 2 | Cat 3
Fred.....|...1...|.......|...1
Geoff....|.......|...1...|
Gertrude.|...1...|...1...|...1
Abigail..|.......|.......|...1 | try in F2:
'''
=FILTER(A2:A; FILTER(B2:D, B1:D1=F1)=1)
''' | |
11,274,116 | 1 | 11,274,137 | I'm reading through the apple developer library and would like to use a submenu like apple shows in a picture:
<IMAGE>
First question: Is that a modal view? And if yes, how to create something like that? Does this submenu has its own controller and view or is all that declared in the view above? I'm using storyboard. | Nope this is an 'UIActionSheet', it does not have a nib file or a class file, you use it like this
'''
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Title"
delegate:self
cancelButtonTitle:@"cancel"
destructiveButtonTitle:nil
otherButtonTitles: nil];
[sheet showInView:self.view];
//Function gets called when user taps on a button
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
}
''' | |
20,168,756 | 1 | 20,192,171 | I create a closed region on a picture by 'impoly('Closed', true)' and lastly after marking the area for the mask 'BW = createMask(h)' in Matlab commandline.
Initial commands before marking points for the mask in the figure
'''
imshow('contour.png');
h = impoly('Closed',true);
'''
Here, I used answer below.
The picture to be filtered by the function
<IMAGE>
Then, I run
'''
image = imread('contour.png');
areaLazyRemoval = BW;
image = conditional_removal(image, areaLazyRemoval);
'''
I now have the <URL> and the picture.
I should apply the function to them.
My function 's pseudocode is
'''
function [ image ] = conditional_removal( image, areaLazyRemoval )
% dim image 794 x 1001 x 3 uint
% dim areaLazyRemoval 794 x 1001 logical
image(:,:,1) .* areaLazyRemoval; % TODO wrong operator here!
% all pixels marked by logical ones in areaLazyRemoval should get lazyRemoval applied
% else greedyRemoval so zero
%
end
%%%%%%%%%%%%%%%%%%%%%%%
% lazy removal function
% so remove by 50% chance the thing
function pixel = lazyRemoval(pixel)
if randn > 0
pixel = 0;
end
% TODO how to apply pixel-wise removal to the logical matrix and image?
''' | By this:
> impoly > Generate Data > function createfigure1
Do you mean after calling impoly, you go into the figure window and select "Generate Code"? Which will create a function 'createfigure' - but this has nothing to do with 'impoly'.
There are a couple of ways you can extract the ROI.
After choosing the area with 'impoly', before closing the figure:
'BW = createMask(h);'
Or you can extract the position with 'getPosition' and then use 'roipoly'. | |
23,617,129 | 1 | 23,617,505 | I've spent some time searching the interwebs for an answer for this, and I have tried looking all over SO for an answer too, but I think I do not have the correct terminology down... Please excuse me if this is a duplicate of some known problem, I'd happily delete my post and refer to that post instead!
In any case, I am trying to plot two histograms on the same figure in Matplotlib. My two data sources are lists of 500 elements long. To provide an illustration of the problem I am facing, please see the following image:
<IMAGE>
As you can see, the histogram has uneven bin sizes under default parameters, even though the number of bins is the same. I would like to guarantee that the bin widths for both histograms are the same. Is there any way I can do this?
Thanks in advance! | I think a consistent way that will easily work for most cases, without having to worry about what is the distribution range for each of your datasets, will be to put the datasets together into a big one, determine the bins edges and then plot:
'''
a=np.random.random(100)*0.5 #a uniform distribution
b=1-np.random.normal(size=100)*0.1 #a normal distribution
bins=np.histogram(np.hstack((a,b)), bins=40)[1] #get the bin edges
plt.hist(a, bins)
plt.hist(b, bins)
'''
<IMAGE> | |
6,096,370 | 1 | 7,159,182 | I am facing an abnormal problem when using as shown in the below diagram:
<IMAGE>
Code is as follow :
'''
require_once 'Zend/Loader/Autoloader.php';
// register auto-loader
$loader = Zend_Loader_Autoloader::getInstance();
try
{
// create PDF
$pdf = new Zend_Pdf();
// create A4 page
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$page->setFillColor(new Zend_Pdf_Color_Rgb(133,185,13));
$page->drawRectangle(40, 500, 560, 475);
...........................
...........................
}
catch (Exception $e)
{
die('Application error: ' . $e->getMessage());
}
'''
---
. Also I tried to change some color code. And I found that
What may be the possible reason? Or I made any mistake?
Please help.!
Thanks In Advance | You are not using in the proper way Zend_Pdf_Color_Rgb
It get float for each of $r, $g, $b.
But will be a pain to figure it out the proper color using RGB anyway.
You can swich to HTML colors using this:
'''
$page->setFillColor(new Zend_Pdf_Color_Html('#cc0033'));
$page->drawRectangle(40, 500, 560, 475);
'''
If you really want to go with Rgb check <URL>
and <URL> | |
18,735,230 | 1 | 18,735,413 | I want to know if exist any method in 'RegEx' class to check if an expression have valid syntax.
I'm not meaning if the regex matches a string or something similar, then the "IsMatch" or "Success" methods does not help me.
To understand me, for example when using the 'RegEx.Match' method with this expression it throws an exception because the expression have invalid syntax:
'''
"\"
'''
(without the double quotes)
I've checked the regex class methods but I can't find any like a "tryparser".
Then to check if an expression have valid syntax I'm doing this:
'''
Try
Regex.Match(String.Empty, "")
Return True
Catch
Return False
End Try
'''
Just I want to know if I can simplify the code more than that by directly returning a value from a method from 'regex' class or converting to boolean the result of a 'regex' class method.
> UPDATE:
I create the RegEx in execution time, does not help me external tools.
<IMAGE> | Technically you can use the constructor of Regex...
'''
Private Shared Function IsRegexValid(str As String) As Boolean
Dim result As Boolean
Try
Dim rx as Regex = New Regex(str)
result = True
Catch ex As ArgumentException
result = False
End Try
Return result
End Function
'''
or a method that builds a 'Regex' object or returns 'Nothing'...
'''
Private Shared Function TryBuildRegex(str As String) As Regex
Dim result As Regex
Try
result = New Regex(str)
Catch ex As ArgumentException
result = Nothing
End Try
Return result
End Function
'''
Then
'''
Dim isvalid As Boolean = IsRegexValid("")
'''
or
'''
Dim rx As Regex = TryBuildRegex("")
If rx IsNot Nothing Then
End If
''' | |
29,007,807 | 1 | 30,497,389 | Basically I want to delete row on click event of a button which is a part of that row.
I can not use commit editing style because i want to perform unsubscribe and delete with same button.
<IMAGE>
On click on subscribe button i want to delete that particular row.
so any idea, how can i do it. | It works with following code
On button click event
'''
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.table];
NSIndexPath *indexPath = [self.table indexPathForRowAtPoint:buttonPosition];
[self.arraylist removeObjectAtIndex:indexPath.row];
[self.table deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
''' | |
26,276,625 | 1 | 34,032,571 | Since upgrading to the latest xcode, I'm having issues with certain pods where if I install them and go to import them in my code, the actual pod itself is getting labelled with "Parse Issue, Expected a Type"
I'm hoping someone can help me and tell me if they have either experienced this problem themselves, or if it's a known issues etc. I have attach images of the import in my viewcontrollers, and the error messages from xcode. For this particular example, I create a brand new UIViewControllerClass, and import the classes listed, and then set 2 extra protocols. There is nothing changed in the .m file.
'''
#import <UIKit/UIKit.h>
#import "ABPadLockScreenViewController.h"
#import "ABPadLockScreenSetupViewController.h"
@interface ChangePinViewController : UIViewController <ABPadLockScreenViewControllerDelegate, ABPadLockScreenSetupViewControllerDelegate>
@end
'''
<IMAGE> | This turned out to be an issue with xcode. Updating to a later version resolved the issue. | |
72,620,804 | 1 | 72,622,311 | Here is the link to my google sheet:
<URL>
I am trying to create conditional formatting based on a range of dates which does not seem to be working.
This is my formula:
'''
=isnumber(vlookup(C12,$K$60:$K$71,1,0))
'''
I used '=isnumber' because of the date issue. The problem is that only the first cell of the cells selected to be conditionally formatted is changing color which I know is incorrect because the first cell does not even have a date number.
What am I doing wrong?
<IMAGE> | try like this:
'''
=VLOOKUP(C11, FILTER($K$60:$K$71, $K$60:$K$71<>""), 1, )*(ISNUMBER(C11))
'''
or even:
'''
=VLOOKUP(C11, $K$60:$K$71, 1, )*(ISNUMBER(C11))
''' | |
23,584,272 | 1 | 23,596,613 | imagefield for django 1.6.2
i have a code that can uploat any file by it and work currectly:
'''
from django.db import models
class Document(models.Model):
docfile = models.FileField(upload_to='documents/%Y/%m/%d')
'''
but when i changed filefield to imagefield :
'''
class Document(models.Model):
docfile = models.ImageField(upload_to='documents/%Y/%m/%d')
'''
<IMAGE>
what is the problem ? | this program do that django1.6.2 imagefield :<URL> | |
41,699,959 | 1 | 41,700,006 | I have no idea what's happening. All these errors coming up, here's the pic.
<IMAGE>
I imported a project from github and all these errors are here, not sure why. | Goto Build->Clear Project and make sure you have appropriate dependency in your gradle file | |
60,763,948 | 1 | 60,764,083 | These are my two models, when I try to open City page on Django I get an error: "column city.country_id_id does not exist". I don't know why python adds extra '_id' there.
'''
class Country(models.Model):
country_id = models.CharField(primary_key=True,max_length=3)
country_name = models.CharField(max_length=30, blank=True, null=True)
class Meta:
managed = False
db_table = 'country'
class City(models.Model):
city_id=models.CharField(primary_key=True,max_length=3)
city_name=models.CharField(max_length=30, blank=True, null=True)
country_id = models.ForeignKey(Country, on_delete=models.CASCADE)
class Meta:
managed = False
db_table = 'city'
'''
<IMAGE> | Because if you construct a foreign key, Django will construct a "twin field" that stores the primary key of the object. The foreign key itself is thus more a "proxy" field that fetches the object.
Therefore you normally do add an '_id' suffix to the 'ForeignKey':
'''
class City(models.Model):
city_id = models.CharField(primary_key=True,max_length=3)
city_name = models.CharField(max_length=30, blank=True, null=True)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
class Meta:
managed = False
db_table = 'city'
'''
It however might be better for tables, to specify a <URL> in the 'ForeignKey':
'''
class City(models.Model):
city_id = models.CharField(primary_key=True,max_length=3)
city_name = models.CharField(max_length=30, blank=True, null=True)
country = models.ForeignKey(Country, db_column='country_id', on_delete=models.CASCADE)
class Meta:
managed = False
db_table = 'city'
'''
With this parameter you make it explicit how the column is named at the database side. | |
21,815,270 | 1 | 21,815,947 | I've created a properties file to externalize my JSF pages. Its location is a source package in the web application:
<IMAGE>
I've included it in the faces-config.xml file with the full path:
'''
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<resource-bundle>
<base-name>com.daslernen.bundles.messages</base-name>
<var>bundle</var>
</resource-bundle>
</application>
'''
But if I explore the contents of the war file inside the ear file as suggested in <URL> I don't find not the package neither the properties file.
How can I make Maven to include it in the build?
PS: If it helps I'm using Netbeans and a Maven project created with the wizard. | Despite the properties files being in the source directory, Maven was building it a different one called main.java.the_path_where_the_file_really_is. For the moment and while I try to figure out how to make Maven place the file in the correct place I have modified the faces-config.xml file to include the path Maven left the file:
'''
main.java.com.daslernen.bundles.messages
'''
And now works like a charm :) | |
10,499,885 | 1 | 10,500,375 | While I can hack together code to draw an XY plot, I want some additional stuff:
- - -
<IMAGE>
How do I make such a graph in mathplotlib? | You can do it like this:
'''
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
data = (0, 2, 3, 5, 5, 5, 9, 7, 8, 6, 6)
ax.plot(data, 'r-', linewidth=4)
plt.axvline(x=5, ymin=0, ymax=4.0 / max(data), linewidth=4)
plt.text(5, 4, 'your text here')
plt.show()
'''
Note, that somewhat strangely the 'ymin' and 'ymax' values run from '0 to 1', so require normalising to the axis
<IMAGE>
---
The OP has modified the code to make it more OO:
'''
fig = plt.figure()
data = (0, 2, 3, 5, 5, 5, 9, 7, 8, 6, 6)
ax = fig.add_subplot(1, 1, 1)
ax.plot(data, 'r-', linewidth=4)
ax.axvline(x=5, ymin=0, ymax=4.0 / max(data), linewidth=4)
ax.text(5, 4, 'your text here')
fig.show()
''' | |
20,650,945 | 1 | 20,651,984 | I am trying to write an AIDL file required for my service. It looks like below:
// --------------------------------------- ISomeIface.aidl
'''
package com.vinay.mm.aidl;
import android.net.NetworkInfo;
interface ISomeIface
{
int someFunction( int arg0, int arg1);
}
'''
It is ok without import android.net.NetworkInfo; in aidl file. The error i am getting is
So I copied the NewtorkInfo file in my project (had to fix some errors), as shown
<IMAGE>
and then changed the import android.net.NetworkInfo; to import com.vinay.mm.net.NetworkInfo;
as shown below.
'''
package com.vinay.mm.aidl;
import com.vinay.mm.net.NetworkInfo;
interface ISomeIface
{
int someFunction( int arg0, int arg1);
}
'''
Now it works without any problem. Can you please suggest me What am I doing wrong?
Thanks. | All the files appearing in aidl imports should be same in package and should be parcelable in both ends, this is small point to note while dealing with aidl else you end up with error.
Thats why for first it didnt work, but when you moved it to same package it worked. | |
15,592,781 | 1 | 15,592,819 | I wrote myself a small Python script that I want to use to automatically do things with certain types of files; as such, I want to create an '.app' out of it so that I can set certain files to be opened with it automatically.
So I looked around and found Platypus which seems to do what I need.
However, weirdly it doesn't work. Specifically, it does not seem to be finding the right python interpreter. I set it up as follows:
<IMAGE>
I.e., the script type is 'env' so it should just read the top line of the file like the shell does.
In 'magic.py', the top line is '#!/usr/bin/env python2.7'.
Now, when I run the shell script on the command line (that is, '~/devel/magic.py whatever'), everything works fine. But when I run the app, it errors with:
'''
Traceback (most recent call last):
File "/Users/jan/Dropbox/devel/Magic.app/Contents/Resources/script", line 8, in <module>
from bencode import *
ImportError: No module named bencode
'''
The same import works just fine when running it from the command line, so I'm thinking it's using the wrong interpreter somehow. How can I fix or debug this? | You are trying to import from 'bencode' module but you didn't add it in the application's bundled resources. Either drag it to the list of included files and export again or just copy it to the resources folder in the package's contents. | |
9,590,365 | 1 | 9,590,519 | I've been using Mercurial for more than a year. Now, I added a new .Net project to it. I chose to ignore all the BIN / OBJ folders in the Solution folder and everything went well. I used masks to ignore entire folders or the right click -> Ignore command to ignore particular files.
Now, all of the sudden, I can't see the Ignore command any more! Normally, it should appear upon right-clicking a file. It doesn't. I also tried ignoring the file manually by adding this line in the .hgignore file:
'''
Client/eTimeKeepLoading.png
'''
But all that did was to (as you can see in the image below) mark my .hgignore file for commit, but the damn PNG file is still in the list. What's wrong with this guy? ::- D.
<IMAGE> | It's an already-added file. Ignoring only hides files that aren't yet tracked by Mercurial (and you can explicitly 'hg add' ignored files if you want). Just revert it, and it'll be hidden. | |
27,973,065 | 1 | 27,973,290 | I'm developing a program, I know how to de-serialize a JSON. But I don't know how to de-serialize it when it's just one string in quotes.
When I request the JSON, and put it into a string, then write it to the console.
I get this:
<IMAGE>
How do I remove those quotes so it's just a normal string?
The <URL> has this:
> ResponseReturns 201 Created if succeeds, 401 Unauthorized otherwise.Returns user's authentication token as a JSON string (i.e. in double quotes). This token must be used as the auth_token parameter for methods that require authentication.
For the auth_token to work I need to remove the double quotes from that string.
Now, this may not have anything to do with JSon as I see now.
How do I remove those double quotes? | > How do I remove those double quotes?
You don't want to. You want to parse it. You do that like you do with any JSON, using NewtonSoft.Json:
'''
var token = JsonConvert.DeserializeObject<string>(""foo"");
'''
Yields the string 'foo'. | |
18,172,515 | 1 | 18,172,633 | According to the picture I can place divs beside each other using 'float' but how can I make them fill the free space?
<IMAGE> | You need to use containers for each div e.g:
'''
<div class="container">
<div class="box"></div>
<div class="box"></div>
</div>
<div class="container">
<div class="box"></div>
<div class="box"></div>
</div>
<div class="container">
<div class="box" id="big"></div>
<div class="box"></div>
</div>
'''
Demo: <URL> | |
72,005,086 | 1 | 72,005,148 | I have a dataframe that looks like this:
<IMAGE>
What I would love to do, is to turn the 'PTS' and 'REB' value into respective columns with each value underneath, like
'''
PTS | REB
----------
14.29 | 5.71
'''
Is this possible? I have intermediate experience with pandas, but through googling and the docs, it doesn't appear to be the easiest find.
Thanks! | You could use the transpose functionality.
'''
df_transpose = df.T
'''
or
'''
df_transpose = df.transpose()
'''
Here is the link to the doc:
<URL> | |
9,453,795 | 1 | 9,454,043 | I'm going to store some words inside db 'my_table (id,word)' as follow
<IMAGE>
Now i've input post
'''
$comment = $_POST[comment]; // "blab blah shit blah" have banned word (shit)
'''
i want to do the following
if the comment contains any of the stored words inside 'my_table' then it gives 'echo "banned"; exit;' and if not then go on 'echo "passed";'
how then to compare it ?
is this could be right
'''
SELECT 1
FROM my_table
WHERE $comment LIKE CONCAT('%', my_table.word , '%')
LIMIT 1
'''
then if gives results then echo '"banned";' and if not then 'echo "passed"'; ! | I just quickly wrote this. Not really tested but it can give you an idea on how to go about yours in a more optimized way.
'''
//database connection done here
$sql = "SELECT * FROM my_table";
$result = mysql_query($sql);
$comment = $_POST[comment];
$commentArray = explode(" ", $comment);
$counter = count($commentArray);
$check = 0;
while($row = mysql_fetch_assoc($result))
{
for($i==0; $i<$counter;$i++)
{
if(strcasecmp($commentArray[$i],$row['word'])==0) {
$check = 1;
}
}
}
if($check == 1)
{
echo "banned"; exit;
} else echo "passed";
''' | |
75,028,100 | 1 | 75,028,203 | I have used the below program to get the maximum and minimum value in a dictionary. But, there is an type error.
I am running the below code on Jupyter notebook and getting the type error as the 'dict.keys' object is not callable. same code runs successfully on the pycharm.
Please advise me what changes should I make so that the code runs successfully on the jupyter notebook?
what is wrong in my code? Code run on JupyterNBcode run on Pycharm successfully<IMAGE> | I have tested your program in Jupyter Notebook and the code is working just fine. Maybe you check for any typos. Hope this help
<URL> | |
67,685,283 | 1 | 67,686,713 | I want to send a local image file to Azure cognitive service with Analyze Image API for image recognition in node-red. This is my nodes:
<IMAGE>
The code in is :
'''
msg.payload = {"data" : "D:\TEMP2 saie.jpg"};
msg.headers = {
"Ocp-Apim-Subscription-Key" : "439aa9b420e34cXXXXXXXXXXXX",
"Content-Type" : "multipart/form-data"
}
return msg;
'''
The HTTP-request node is POST and :
'''
https://comvisonapi.cognitiveservices.azure.com/vision/v3.2/analyze?visualFeatures=Description,Faces
'''
After I sent this request, I got errors:
'''
msg.payload : string[168]
"{"error":{"code":"InvalidRequest","innererror":{"code":"InvalidImageFormat","message":"Input data is not a valid image."},"message":"Input data is not a valid image."}}"
'''
Can you help me and what correct code should be in function node? Thank you very much!! | You can't just pass the filename as the 'data' field. The HTTP-request node will just send that string, it will not load the content of the file from disk.
You will need to use a file node to load the content of the image then build a properly formatted payload object. Here is an example:
'''
var fileData = msg.payload;
msg.headers = {
"Ocp-Apim-Subscription-Key" : "439aa9b420e34cXXXXXXXXXXXX",
'Content-Type': 'multipart/form-data'
};
msg.payload = {
'image' : {
'value': fileData,
'options': {
'filename': 'image.png'
}
}
};
return msg;
'''
<URL> | |
3,622,000 | 1 | 3,622,066 | Simulating Ocean Water:
<URL>
I'm trying to simulate ocean and I need your help.
Please be patient, I'm newbie to computer graphics but I know basics of physics and mathematics. As you can see I need to compute the formula:
<IMAGE>
is a vector, is a coordinate (so I suggest that it could be equal to vector?).
So, first question:
how to compute to the power of such strange thing?
Second, it says that h(,t) is height and also that to get the value it's needed to do FFT. I can't understand it. | e to the power of something imaginary can be computed with sin and cos waves
<IMAGE>
<URL>
and vector exponentiation has it's own page as well
<IMAGE>
<URL> | |
8,514,332 | 1 | 8,514,392 | I have a PHP background. I would like to learn another language to build programs that can be run on Windows. I have my eye on C#.
What I really would like to accomplish is to be able to make programs on Windows that have a better UI then the traditional Windows program generally has. For example, I really like the way Apple/Mac programs look. Apple has iTunes that runs on Windows and looks nothing like a traditional Windows program so I assume it is possible.
So my question, what languages(s) or technologies would you point me towards to accomplish a Windows program that could have a nice UI like the image below instead of the way most Windows programs look?
<IMAGE>
What languages and technologies would you recommend for building an app that looks like this that can run on Windows? | There are a variety of 3rd part components you can use to spruce up the look and feel of your application. In no order of importance, a few of the big players are:
- - - - -
For which ones people like the best, search SO for opinions. Be forewarned, everyone tends to get a bit religious/devoted to the ones they like. | |
18,915,496 | 1 | 18,916,253 | <IMAGE>
'''
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillDisappear:animated];
}
'''
It's a screen shot when up corner it's slightly display.
I used this code for hide the navigation bar in view.but when view will start then it's give me effect like navigation bar are present.
But, I want to remove this effect or remove the navigation bar only this view. | In Case if you are using storyboard Make sure green arrow highlighted fields are unchecked
<IMAGE>
Put below lines of code in 'didFinishLaunchingWithOptions'
'''
[self.navigationController setNavigationBarHidden:YES]; -
''' | |
26,639,024 | 1 | 26,639,742 | I have added a control to my form. When I change its type to a Pie Chart, the 'BackColor' remains white. How can I change this color to transparent or at least a color that I want?
<IMAGE> | This is so hard because is it so simple:
The 'Chart' itself:
'''
chart1.BackColor = Color.Transparent;
'''
The 'ChartArea' of your Pie:
'''
chart1.ChartAreas[0].BackColor = Color.Transparent;
'''
Assuming you have only one, otherwise adapt the index..!
To make it complete here is the (not exactly surprising) code for the 'Legend':
'''
chart1.Legends[0].BackColor = Color.Transparent;
'''
And of course you could choose any other color.
I'm not sure how the Pie Chart type would make a difference. It certainly doesn't make it here.. | |
26,994,570 | 1 | 26,995,480 | I have an RGB image 'm' in MATLAB
<URL>
I normalized it using the formula
'''
im = mean(m,3);
im = (im-min(im(:))) / (max(im(:))-min(im(:)));
'''
I read that the normalized module stretches the image pixel values to cover the entire pixel value range (0-1) but I still have some steps between 0 and 1 in the histogram of my normalized image.
<IMAGE>
Can anyone help me out here by explaining the reason of these grey values.
Thank You | I assume you use the mean of the three components instead of the function 'rgb2gray' because it has some advantages in your case. ('rgb2gray' does something similar: it uses a weighted sum).
Subtracting the minimum and dividing by the maximum doesn't convert your image to binary. It will only scale all values to the range (0,1), which is the case in your example. This only means that all values are 0 and 1, not exactly 0 or 1. If you want a binary image, i.e. only 0 and 1, you will need to use a threshold to convert the grayscale image to binary.
A method which is often used, is to calculate a threshold using Otsu's method:
'''
threshold = graythresh(im); % calculate threshold
binaryImage = im2bw(im,threshold); % convert image to binary
'''
If your image is saved as 'uint8' then normalizing the image should convert your image to binary, as 'uint8' only can handle integer numbers and any numbers between are rounded. That means you assume the optimal threshold to be at 0.5. | |
10,308,111 | 1 | 10,308,308 | I have a button that when clicked it opens a dialog with information from my SQLite database. I have figured out how to change the background color and the color of the text but I am having trouble getting the title text color set. Also I was wondering if at all possible is there a way to put a button in one of the corners of the title of a Dialog? I would like to have the close button positioned there.
Here is the code from my onClickHelp button which sets the dialog
'''
public void onClickHelp(View v) {
final Dialog duDialog = new Dialog(this);
duDialog.setContentView(R.layout.data_usage);
duDialog.getWindow().setBackgroundDrawableResource(R.color.title_text);
duDialog.setTitle("Data Usage"); // I would like to set the color and add button here
ListView data = (ListView) duDialog.findViewById(R.id.DataUsage);
duCursor = Data.getAll(db);
startManagingCursor(duCursor);
duAdapter = new DataAdapter(duCursor);
data.setAdapter(duAdapter);
duDialog.show();
}
'''
<IMAGE> | You must design your own custom alert dailog with with your relevent design.
Refer this links
<URL> document for dialog
<URL> sample for customizing alert dialogs | |
70,549,940 | 1 | 70,550,327 | Hay, I have two buttons (image 1), and i would like to link this buttons by line. I thought about drawing line by Class Graphics and Pen, but I tried this and it doesn't work.
<IMAGE>
'''
private void Form1_Paint(object sender, PaintEventArgs e)
{
var lineBegin = new Point(button1.Left + button1.Width - 1, button1.Top + button1.Height / 2);
var lineEnd = new Point(button2.Left, button2.Top + button2.Height / 2);
e.Graphics.DrawLine(Pens.Maroon, lineBegin, lineEnd);
}
''' | This works
<IMAGE>
'''
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawLine(
Pens.Blue,
button1.Right + 2,
button1.Top + button1.Height / 2,
button2.Left - 2,
button2.Top + button2.Height / 2);
}
}
''' | |
23,952,410 | 1 | 23,952,641 | <IMAGE>I'm parsing a JSON string from url. From this URL I want to map only a certain array of Items so I parse it using .
'''
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> map = mapper.readValue(new URL(urls.get(i)), Map.class);
'''
... and now my 'Hashmap' contains this key set:
'''
[status,count,pages,category,posts]
'''
'posts' is an 'array' of 'Object's that I have already defined a mapping 'class'.
So When I try to parse them like this:
'''
post[] posts= mapper.readValue(map.get("posts").toString(),post[].class);
'''
I get this 'Exception':
'''
Unexpected character ('i' (code 105)): was expecting double-quote to start field name
'''
From what I understand when I perform the first mapping it takes away the '"' that the field of a JSON string should have.
What can I do to overcome this ? | You have a design problem, and are addressing it the wrong way.
1. You should de-serialize your JSON as a custom Object instead of a Maps<String, Object>. This would allow to leverage the OO features of your instance instead of accessing the properties through casting (which you are not doing, see point 2).
2. To solve your immediate problem, you cannot de-serialize from a non-JSON Object, which is what you're trying to do when you assign posts a value. Instead, try something in the lines of: Post[] posts = (Post[])map.get("posts"); | |
26,214,997 | 1 | 26,215,108 | is there a built in class in BOOTSTRAP that can produce a simple blue round box as a place holder for my Copyright, or sidebar title just like from the attached picture? Thank you!
<IMAGE> | You could use a 'list-group' with a single 'active' 'list-group-item'..
'''
<ul class="list-group">
<li class="list-group-item active text-center">Text here...</li>
</ul>
'''
Demo: <URL> | |
24,679,844 | 1 | 24,683,017 | There is a default menu in GXT for column config which holds sorting options etc:
<IMAGE>
I'm digging the interwebz on how to override these labels. Not the menu stucture or the behavior, just the labels (there is a submenu called Filters -> Yes, No, where I have to replace Yes, No with Up, Down).
I found this post: <URL> but this is basically overriding and custom implementing the whole menu, which is overkill.
Thanks in advance!
Update: I'm prividing the accepted answer here:
'''
BooleanFilter<?> statusFilter = new BooleanFilter<?>(...);
statusFilter.setMessages(new BooleanFilter.BooleanFilterMessages() {
@Override
public String noText() {
return "Down";
}
@Override
public String yesText() {
return "Up";
}
});
filters.addFilter(statusFilter);
''' | The "Yes" and "No" text in the 'BooleanFilter' comes from 'BooleanFilterMessages', which by default reads from 'XMessages.booleanFilter_noText' and 'XMessages.booleanFilter_yesText'. You can pass a 'BooleanFilterMessages' instance to 'BooleanFilter.setMessages' with your custom text.
Or, if you want to override it everywhere, you can place a XMessages.properties file in the correct path, com/sencha/gxt/messages/client/, and change the keys listed above. | |
19,253,682 | 1 | 19,313,098 | I am creating an HTML table using WebSupergoo ABCpdf9 :
'''
string htmlSample = "<table border='1'><tr> <td>Current Address</td> <td>Optio distinctio Sed vel quasi <br /> 281<br /> Mollitia ea qui adipisci voluptas, IL, 66293<br /> </td> </tr> <tr> <td>email</td> <td>[email protected]</td> </tr> <tr> <td>dob</td> <td>8/18/2006 12:00:00 AM</td> </tr> </table>";
'''
then
'''
Doc doc = new Doc();
doc.AddHtml(htmlSample);
doc.HtmlOptions.Engine = EngineType.Gecko; //<-- also tried this as well
'''
<IMAGE>
The PDF has or boarder when generated.
Any help ? | AddHtml is for multi-styled text.
AddImageHtml is for true HTML/CSS web pages.
AddHtml is used for multistyled text. It's very fast. However it doesn't support HTML - it supports an HTML-like syntax - it supports HTML styled text. The key tags it doesn't currently support are img and table. It doesn't support CSS. It is designed principally for multi-styled text using an HTML-like syntax.
AddImageHtml is used for full HTML/CSS rendering. It's rather more sophisticated and complex but not as fast. It supports all tags including img and table. It supports CSS. It supports JavaScript. It supports everything you get in real-world web pages. You can use either the MSHTML engine for IE-like behavior and display or you can use our Gecko engine for Firefox-like behavior and display. | |
71,610,432 | 1 | 71,610,456 | I have checked the documentation but I am not sure how to apply that rule to my specific data structure, please check how my data is organized and provide me the rules as it is supposed to go.
I am using realtime Database, in my app code I write and read base on the user ID, but firebase keeps telling I should change my rules.
<IMAGE> | To apply the rules in the documentation on <URL> to your structure would take:
'''
{
"rules": {
"Expenses": {
"$uid": {
// Allow only authenticated content owners access to their data
".read": "auth != null && auth.uid == $uid"
".write": "auth != null && auth.uid == $uid"
}
},
"Users": {
"$uid": {
// Allow only authenticated content owners access to their data
".read": "auth != null && auth.uid == $uid"
".write": "auth != null && auth.uid == $uid"
}
}
}
}
''' | |
14,381,589 | 1 | 14,381,945 | I just add like button on my website but when I click to publish like that :
<IMAGE>
the post does not appear on my Wall. Why ?
Here the html code of my button :
'''
<div class="fb-like" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
'''
Thanks for your help | '''
<div class="fb-like" data-href="###URL | Permalink###" data-send="false" data-width="450" data-show-faces="true"></div>
'''
I think you missed out 'data-href="http://www.example.com"'
<URL> | |
29,036,622 | 1 | 29,036,761 | <IMAGE>
I'm trying to put three google pie charts in a row. I have the set the css inline for now. For some reason the third chart goes to the next line. What am I doing wrong? | '''
.column-left{ float: left; width: 33%; }
.column-right{ float: right; width: 33%; }
.column-center{ display: inline-block; width: 33%; }
'''
This worked for me | |
22,408,832 | 1 | 22,992,772 | How can I check the status of the Notifications checkmark that is on the App Info screen of my application programatically ?
This screen can be accessed by: Settings > Application Manager > [application entry]
<IMAGE> | It looks like this is not available, there is a similar post that was responded to on this front. I have also looked and cannot find anything regarding this.
<URL> | |
23,834,429 | 1 | 23,835,728 | I am having a problem with the following page in <URL>. I also have tested it outside of plunker and I get the same result. My problem is that the following CSS get lost somehow. When I look at the computed CSS in chrome the width and height are different even when I can see that it recognized that rule. I am using bootstrap CSS.
'''
table.scroll {
width: 40px;
height: 40px;
overflow: scroll;
}
'''
EDIT:
The intention was to make the table scroll-able. But there no scroll bar appears. The CSS looks correct but apparently it does not work on tables. And the browser just ignores the CSS.
<IMAGE> | <URL> Chrome cannot possibly fit all of that data in a 40x40 table, so it scales it up to fit.
<URL> | |
9,723,281 | 1 | 9,726,114 | After spending yesterday afternoon looking through SO and online, and not quite finding what I think I need, I wanted to ask the community for suggestions. I have a specific interaction I'm trying to prototype and am guessing there is a plugin I can use instead of start from scratch, but can't quite find it.
The interaction is a long horizontal reveal and slide. The app opens with one div visible. The user swipes or clicks to the right, and the first div slides left (but not entirely off screen) and the second div both fades in and moves into the space where the first div was. Interaction continues for as many panes as there are (for this prototype we have five levels deep). user can back in and out at will--I planned to show this by clicking the left and right sides of the visible div, as the design shows a big grey bar with an arrow fading in on each side. Moving back 'up' is reverse of going 'down'--divs fade off and the previous div slides into place.
Touch is required for this demo/prototype.
As requested, here is a sketch:
<IMAGE> | Thought I would take a stab at a prototype. The dimensions are tiny because it's in jsfiddle, but you can expand the results window and change the dimensions if you wish. I only tested this in Chrome and it uses a lot of CSS3:
<URL>
And here's a screenshot. Why not? I think it lines up nicely with the sketch. I'm a little bit confused about whether you actually wanted the previous div to get squished instead of just overlapped. That seems inadvisable, since the content in the div would get mangled, but it's doable.
<IMAGE> | |
42,445,917 | 1 | 42,446,559 | Studying for an exam and stumbled upon this exercise. I'm having trouble solving it with all three methods. Here's the text:
> Suppose we are maintaining a data structure under a series of n operations.
Let f(k) denote the actual running time of the kth
operation. For each of the following functions f, determine the
resulting amortized cost of a single operation. (For practice, try all
of the methods described in this note.)(a) f(k) is the largest integer i such that 2^i divides k.
source: <URL>
I made a small table to try to get an overview
'''
k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...
f(k) 0 1 1 2 2 2 2 3 3 3 3 3 3 3 3 4 ...
'''
I don't see where the potential method could help here as the operations just get more expensive over time. Banker's Method also doesn't seem to be applicable here for the same reason. So I thought aggregate method would be most suitable.
<IMAGE>
is what I came up with for a sequence of n operations, however I can't seem to transform it, which makes me question whether or not it's the right approach.
EDIT: so it looks like I misunderstood the question I think the correct table would look like this:
'''
k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...
f(k) 0 1 0 2 0 1 0 3 0 1 0 1 0 1 0 4 ...
''' | quick answer in case anybody googles this
using the banker's method you can 'save' a constant amount of credits (in this case 2 per operation would work) and easily cover the costs of the more expensive ones down the line.
'''
k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...
f(k) 0 1 0 2 0 1 0 3 0 1 0 1 0 1 0 4 ...
cr 2 3 5 5 7 8 10 9 11 12 14 15 17 18 20 18 ...
''' | |
50,350,147 | 1 | 50,350,258 | This is the code I wrote in View and I want to display the total number of calories at the end of each day, depending on the existing aliments. How can I do that? Here, I've got the calorie values directly from my data base.
'''
@model Database.MealPlanner
@{
ViewBag.Title = "Details";
}
<div>
<h4>Aliments</h4>
<hr />
<ul>
@foreach (var weekDay in @Model.MealPlannerAliments.GroupBy(q => q.WeekDay).ToList())
{
<li class="custom-list-heading list-unstyled"><b>@weekDay.Key</b></li>
foreach (var item in weekDay)
{
<li id="alimentsByDay">
<div>
<p>@item.Aliment.Name (Calories: @item.Aliment.NutritionalValue.Calories )</p>
</div>
</li>
}
}
</ul>
</div>
'''
Here is an ex. I want to display at the end of the day, let's say: : 618
<IMAGE> | You could look at using <URL> extension method. Something like
'''
weekDay.Sum(x => x.Aliment.NutritionalValue.Calories)
''' | |
11,154,124 | 1 | 11,172,192 | All tutorials I can find always tackle with toy uml use cases like the one here <URL>
I can't see how you can model this in UML Use Case:
a customer can be either a Physical Person or a Company and that a Company has employees that are themselves physical persons. Company has also some persons who work for them as contractors who are physical persons but are not customers.
Could someone has any good idea and writes this model in yuml use cases <URL> for example ?
Nobody seems to know UML Use Case so let's say even Class Diagram or even Java or C# Class Diagram or even database design :)
Problem I see in the model below is that Person is a Customer and so all employees would also be customers which is wrong:
<IMAGE> | The following class diagram fulfills your needs:
<IMAGE>
You are actually working with two domains: the first domain is the hierarchy of the company: a company has employees and contractors which are persons; the second domain is the domain of customers, which can be companies and customers. So in this diagram you have a 'Person' which can be a 'Contractor', an 'Employee' or a 'CustomerPerson', which can also be a 'Customer', and you have a 'CustomerCompany' which is both a 'Customer' and a 'Company'.
Note that I created 'CustomerCompany' which inherits from 'Company' instead of making 'Company' inherit from 'Customer' since I assume not all companies are customers.
I used inheritance for all relations, but if multiple inheritance is not wanted, this can be done using interface.
The <URL> code for this diagram is:
'''
[Company]++-0..*>[Employee]
[Company]++-0..*>[Contractor]
[Person]^-[Employee]
[Person]^-[Contractor]
[Customer]^-[CustomerCompany]
[Company]^-[CustomerCompany]
[Customer]^-[CustomerPerson]
[Person]^-[CustomerPerson]
''' | |
26,467,359 | 1 | 26,679,470 | I sometimes use the JavaDoc-view in Eclipse. By default it has a black background and a white font. I'd really like to change it to "black on white" (as in the rest of Eclipse).
I only found a way to manipulate the background-color and the font-type. But where can I change the font-color?
<IMAGE> | <IMAGE>
1. Go to ubuntu software center and install gnome-color-chooser.
2. Go to Specific Tab and tick foreground color and background color, change it to back and white respictively.
The color of javaDoc View is changed. | |
11,518,879 | 1 | 11,520,268 | I want to generate ID card for the students admitted in the college.
i have linked a photo in which i am sharing as to how the i want the id cards in pdf file through php and fdpf. and i am fetching the date from mysql.
<IMAGE>
Suppose i have 13 students available for a particular course. Now, i want the data to first actually work multicolumn wise and then as the page is filled, it should create the back side of the page in next page and move on to other page. On one A4 page, i can have only six ID cards and on the next page, six backside of those id card and again this step should repeat. I am confused. | - <URL> | |
1,520,411 | 1 | 1,520,723 | I've want to know what is the best practice or approach in dealing with multiple and complex columns with a form inside.
here's an example of the form I'm dealing with
<IMAGE>
How to properly write a HTML markup for this? If I wrap every form element with a 'DIV' for every column it would take a lot 'DIVs' and styles; and the width for every column that is not repeating.
So what I did is, I put all form element in the table. And I think that is not the standard way to do it.
If your in my shoes,
How would you deal with the columns with non-repeating width? | There is no standard for complex forms, but there are plenty of blog posts claiming to have figured out the perfect way to approach this problem. Most of them are well thought out, but ultimately you have to pick the one you're most comfortable with. I have some suggestions though:
- Check out the US postal service change of address form. It's surprisingly well done- If you have of forms, using a grid system like 960.gs, blueprint.css, or YUI grids (shudder) is an easy way to implement a form. grid systems are definitely considered bloat if that's the only place you'll use them.- | |
21,504,484 | 1 | 21,504,676 | I am creating a website for college and I was wondering how hard it would be to make an expanding tab on the side of the website? So when the user hovers the mouse the tab, it expands and more information can be viewed.
A bit like this:
<IMAGE>
Thanks in advance! | another user had this same question with a very good answer. The FULL sample code that came from that answer is provided here:
<URL>
but the crux of what you wanted to know is that this is the essential CSS code you need (copied from the jsfiddle):
'''
transition: height 2s;
-moz-transition: height 2s; /* Firefox 4 */
-webkit-transition: height 2s; /* Safari and Chrome */
-o-transition: height 2s; /* Opera */
'''
SOURCE (other user's question):
<URL> | |
54,420,677 | 1 | 54,421,128 | I have tennis dataset and this is the head:
<IMAGE>
Now I want to average FS_1 for a given ID1. In other words, I want to get all players average first serve percentage from the data in this dataset. And all players occur several times.
I know I can do this to get the average value of a field;
'''
def mean(arr):
return sum(arr) / len(arr)
mean(dataset['FS_1'])
'''
but how do I get a specific players average? | Pandas <URL> method should do the trick:
'''
df.groupby(['ID1']).mean()['FS_1']
''' | |
9,079,760 | 1 | 9,080,047 | I'm now developing a website, I have a header as usual. But there is a problem in search textBox input with IE7. When I look at there with IE developer tools I see strange LEFT offset this is what the problem is actually. Any helps appreciated.
<IMAGE>
<URL>
<URL> | add display:inline; to #searchBox
and addjust 1 or 2 px width of your button, problem will be solved
this problem arise in IE6 & 7, its called double float margin bug, when you apply margin to the first floating element, its margen get doubled in IE6 & 7. | |
51,332,961 | 1 | 51,335,268 | So, I got this multi-input model with 6 identical inputs of same shape. Right now If I have to use this model, I have to multiply my input data with total numbers of input layer, i.e. 6. I was wondering if I can add another layer on top of this and can pass single input that will connect with all these 6 inputs. I'm not sure how to accomplish this! Any thoughts?
<IMAGE> | Issue was something like this: I have a multi-input model, where all inputs are identical, as this model was just a combination of multiple models which happens to share identical type input! Now, when using this model for classification, I had to provide for each input layer, which is something I don't wanted to do, say when classifying millions of sentences!
So, the ideal solution was to just have a single input which is connected with all model inputs!!
Alrighty, so here is how it's done:
1. Create a new top_model which will take single input and generate multiple identical outputs. This can be done with Lambda layer. single_input = layers.Input(input_shape)
multi_output = layers.Lambda(lambda x: [x] * total_numbers_of_base_inputs)(single_input)
top_model = Model(inputs=single_input, outputs=multi_output)
2. Use the top_model input and your multi_input_base_model like below to create new single_input model. new_model = Model(inputs=top_model.input, outputs=multi_input_base_model(top_model.output)) | |
10,518,121 | 1 | 10,519,178 | For my new typo3 page I want to add several pages and links. Unfortunately on my fresh 4.5 (I tried 4.7 as well) installation the icons in the page module for the different page types ar missing.
<IMAGE>
How can I get this icons? | They are 'hidden' under the icon with green plus (left top corner at your screenshot), click it first. | |
33,185,114 | 1 | 33,185,478 | After 14.1.4->14.1.5 update on I had been faced with an annoying UI feature. When I press quick-doc shortcut (Ctrl+Q for my keymap) a platform specific window appears instead of lightweight popup window. In other worlds I have just floating (a right panel button had been activated).
<IMAGE>
My question is how to return plain old popup with no window title bar. | Just click the red cross button and the window should be restored back to a pop-up.
Or just hit (OS X) or + (Windows, Linux).
<URL> | |
24,217,020 | 1 | 24,217,215 | Well, I have been doing some experiment with QT lately, I have a touchscreen Linux PC and I connect it to the WiFi network. Instead of pinging a network old fashioned way I thought of making an app for it.
The interface is like, I would enter an IP address and the application will ping the network and let me know if the IP is ping-able or not. When the IP is getting pinged Green Check will be shown, if not getting pinged then Red Check will be shown.
My progress is, I am able to take the IP in a script file and ping it. But the problem is how to interface the ping reply with the application. i.e. the two labels (Green and Red Check) ???
Thanks in advance. My GUI looks like this.
<IMAGE> | There isn't a good cross platform way for doing this. But you can use platform specific ways :
On Linux you can :
'''
int returnedCode = QProcess::execute("ping", QStringList() << "-c 1" << ui->ipEdit->text());
if (returnedCode == 0)
{
// It's active, Show Green Check
} else
{
// It's dead, Show Red Check
}
'''
On Windows it is like :
'''
int returnedCode = QProcess::execute("ping", QStringList() << "-n" << "1" << ui->ipEdit->text());
if (returnedCode == 0)
{
// It's active, Show Green Check
} else
{
// It's dead, Show Red Check
}
''' | |
51,617,781 | 1 | 51,618,261 | I would like to plot a mosaic-plot with statsmodels.graphics.mosaicplot.mosaic, but without the "spines" or boundaries drawn. The following is what I thought should work - e.g. for omitting the left spine -, but it doesn't.
'''
from statsmodels.graphics.mosaicplot import mosaic
import matplotlib.pyplot as plt
data = {'a': 10, 'b': 15, 'c': 16}
fig = plt.figure()
ax = fig.add_subplot(111)
props = lambda key: {'color': 'w' }
fig, rects = mosaic(data, title='basic dictionary',
properties=props, ax=ax)
ax.spines['left'].set_visible('False')
print(ax.spines['left'].get_visible())
'''
I end up with the same result as if I'd omitted the ax.spines().
<IMAGE>
I'd appreciate somebody pointing me to what's wrong with the above. | There is of course a difference between 'False' and '"False"'. I.e. 'print(False == "False")' prints False. And 'if "False": print(True)' prints 'True' indeed.
In that sense you need to use
'''
ax.spines['left'].set_visible(False)
'''
Second. The mosaic consists of 3 axes. So you need to do the above for each of them.
'''
for axi in fig.axes:
axi.spines['left'].set_visible(False)
'''
Result:
<URL> | |
26,580,730 | 1 | 26,580,876 | I got an error like these below when I trigger 'destroyRecord()' on file 'app/controllers/transactions.js'.
<IMAGE>
Below are my files.
'''
div
format-datetime model.created_at
bs-button clicked='destroyRecord' clickedParamBinding='model' size='xs' icon='glyphicon glyphicon-remove' type='danger' title='Delete'
'''
'''
import Ember from 'ember';
export function formatDatetime(input) {
if ( input ) {
return '%@/%@/%@'.fmt(input.getDate(), input.getMonth()+1, input.getFullYear());
} else {
return '';
}
}
export default Ember.Handlebars.makeBoundHelper(formatDatetime);
'''
'''
....
actions: {
destroyRecord: function() {
if ( confirm('Are you sure to delete?') ) {
this.get('model').destroyRecord();
this.transitionToRoute('index');
}
}
....
'''
But when I change file 'app/helpers/format-datetime.js' to:
'''
import Ember from 'ember';
export function formatDatetime(input) {
if ( input ) {
return input; // look this
} else {
return '';
}
}
export default Ember.Handlebars.makeBoundHelper(formatDatetime);
'''
No error occured. So I guess my mistake is on my helper file. Any solution? | Either 'getDate', 'getMonth' or 'getFullYear' isn't defined on input, toss a debugger there and find out what input is.
'''
export function formatDatetime(input) {
if ( input ) {
console.log(input);
debugger;
return '%@/%@/%@'.fmt(input.getDate(), input.getMonth()+1, input.getFullYear());
} else {
return '';
}
}
''' | |
19,551,760 | 1 | 19,557,761 | I am having a huge problem with cross-browser letter spacing which is causing box/input boxes to be off in different browsers, particularly safari and chrome.
As the picture shows, one is scrunched up while other looks normal. Does anyone have any fixes for this?
<IMAGE>
'''
font-family: 'Arial Narrow', Arial, sans-serif;
font-size:13px;
''' | The reason I was asking this question is because I had a site that had:
'''
<div style="width:300px">Text: <input width="260px" /></div>
'''
So what was happening is, the text would end up being a few pixels longer in different browsers, throwing off the ending of how long the input box was.
It has come to my attention that different browsers inevitably will render some font's slightly differently and there really is no work around for letter-spacing.
So, instead of changing the letter spacing so that the input box's matched - I made the input boxes fill the remaining space of the div that it was inside with a percent rather than a pixel length. This way, each input box ended at the same point in all the browsers and ended up matching.
Thanks for your help everyone.
# How I did it:
'''
<div style="width:300px">
<label>Text:</label>
<span><input /></span>
</div>
'''
'''
label { float: left; }
span { display: block; overflow: hidden; }
input { width: 100%; }
''' | |
11,226,553 | 1 | 11,424,558 | When I have a long line and want to type text at the end, the cursor constantly jumping back to the middle of the text, for example:
from here: <IMAGE>.
Is it a bug or a feature ? How can I turn it off ? My PHPstorm version is 4.0.2 (#PS-117.501) | The cause of this is the ideaVIM plugin. When you disable it, it works just fine !
Here is he issue: <URL> | |
10,354,600 | 1 | 10,354,674 | Goal:
Output a list of IW standard week dates for a given time range based off of the current date.
Desired output: with Current date = 4/27/2012, list of past 7 IW week dates
<IMAGE> | Try this:
'''
SELECT TRUNC(SYSDATE - (LEVEL * 7), 'IW') TheDate
FROM dual
CONNECT BY LEVEL <= 7
''' | |
19,733,984 | 1 | 19,735,099 | I'm learning my new hp 50g and am seeing an odd line several pixels wide only above the stack soft menu. If I hit NXT to see the next page of menu options, the line goes away. If I am viewing a menu other than the default TOOL menu, there is no line. Any ideas what this is?
<IMAGE> | I found the meaning of the bar above the soft menu, it's telling the user that that option will take you to a 'sub-menu' of sorts. It's somewhat like a folder, where the options that do not have the bar above are simply commands. | |
42,441,250 | 1 | 42,455,486 | I am very new in Zend Fw 3.
I followed <URL>
I added the controller config in module.php
'''
public function getControllerConfig(){
return[
'factories' = >[
Controller\DocumentController::class = > function($container) {
return new Controller\DocumentController(
$container->get(Model\DocumentTable::class)
);
},
],
];
}
'''
By running this, I faced this error:
<IMAGE> | '''
<?php
namespace Document;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
class Module implements ConfigProviderInterface
{
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
public function getServiceConfig()
{
return [
'factories' => [
Model\DocumentTable::class => function($container) {
$tableGateway = $container->get(Model\DocumentTableGateway::class);
return new Model\DocumentTable($tableGateway);
},
Model\DocumentTableGateway::class => function ($container) {
$dbAdapter = $container->get(AdapterInterface::class);
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Model\Document());
return new TableGateway('document', $dbAdapter, null, $resultSetPrototype);
},
],
];
}
public function getControllerConfig()
{
return [
'factories' => [
Controller\DocumentController::class => function($container) {
return new Controller\DocumentController(
$container->get(Model\DocumentTable::class)
);
},
],
];
}
}
''' | |
12,781,852 | 1 | 12,782,235 | <IMAGE>
I have the 'Android' code for storing pictures in database. How can I compare a stored picture with a picture that is taken? | There could be several right answers, depending on what you're looking for.
If you're talking about comparing a new photo made with the on-device camera, there's virtually no chance it will be a byte-for-byte match with any existing file.
If you want to detect an exact match from a source where a copy is likely, look at the file size and dimensions of the two images. If they are exactly the same, then you can look at the bytes. To save time, store a digital signature (e.g., an MD5 or SHA1) hash of the contents in the database along with the image.
If you want to find whether the images are similar in appearance, then you'll have to find some way to characterize the image. I'm no expert at this, but in my naive approach, I'd do something like divide the image into a fixed number of regions and measure the amount of red, green and blue in each region. You could even do this recursively on ever-smaller regions as approximate matches are found. Comparing whole images will be a lot easier than finding a partial match. | |
9,036,437 | 1 | 9,260,278 | <IMAGE>
I don't understand why is this rule not working? If I change "total quantity equals or greater than" from 1 (visible as TRUE) to 0 (visible as FALSE), the rule applies to every single product in the shop instead of just chosen categories. This rule used to work before until expiry date. After it expired I've moved the expiry date into future, but the rule wouldn't work. I've tried creating a new rule with same conditions, no luck. Any suggestions? | Apparently, categories I've selected were nesting other categories and it doesn't work that way. You have to select all categories with products in them. | |
10,903,987 | 1 | 10,904,049 | <IMAGE>
Quick question-
I know this is probably really easy, but my excel skills have gotten a bit rusty. You can see from my picture below what my situation is. I have a table as a reference that shows something's priority based on its importance and how much work it takes. I will have hundreds of things I need to compare to this table. How can I fill out the question marks under the orange priority label quickly and easily? I could do an IF statement, but that would be like 300 lines long. I know a VLOOKUP won't work because there are too many variables.
Any help would be great! | '''
=INDEX($the_data_part_of_the_reference_table,
MATCH(current_importance_value, $importance_column_header_in_the_table, 0),
MATCH(current_AoW_value, $AoW_header_row_in_the_table, 0)
)
''' | |
18,536,773 | 1 | 18,537,953 | I have a div element with some text in it. I need to be able to select:
1. div itself, and
2. only text within that div
'''
<div class="myDiv">some text</div>
'''
So I am able to select div, by class name
'''
$(".myDiv").hover(...);
'''
But I'm having difficulty with the text. Tried the following
'''
$(".myDiv").contents().eq(0).text().hover(...);
'''
but no luck. Also, when I hover over text I need to select that text only, and not the parent div.
<IMAGE> | <URL>
Try this
I guess this is what you need
'''
(function findTextNodes(current, callback) {
for(var i = current.childNodes.length; i--;){
var child = current.childNodes[i];
if(3 === child.nodeType)
callback(child);
findTextNodes(child, callback);
}
})(document.getElementById('myDiv'), function(textNode){
$(textNode).replaceWith('<span class="textNode">' + textNode.nodeValue + '</span>');
});
$('.textNode').hover(function(){
$(this).css('color', 'white');
},function(){
$(this).css('color', 'black');
});
''' | |
14,977,626 | 1 | 14,977,840 | I'm working on improving my app's UI.
And in the design I'm using I have a TextView that will act as a progress bar at certain time.
The ruslt should look like this :
<IMAGE>
The thing is that parts of text will change their color while the progress is changing
I looked into spannablestring in android it would work if I can find the letters that are covered by the progress ( but I don't think this would be easy/accurate)
What I'm planning todo now is to use the following:
- - - -
Is there a better approach? | Much better approach would require you to override TextView class. You can use clipping, to split the TextView and draw two parts in different colors.
'''
TextView tv = new TextView(this){
@Override
public void draw(Canvas canvas) {
int color1 = Color.WHITE;
int color2 = Color.GREEN;
canvas.save();
setTextColor(color1);
setBackgroundColor(color2);
canvas.clipRect(new Rect(0, 0, (int)(getWidth() * percent), getHeight()));
super.draw(canvas);
canvas.restore();
canvas.save();
setTextColor(color2);
setBackgroundColor(color1);
canvas.clipRect(new Rect((int)(getWidth() * percent), 0, getWidth(), getHeight()));
super.draw(canvas);
canvas.restore();
}
};
'''
I hope you get the point | |
21,760,839 | 1 | 21,760,938 | I am using following query:
'''
SELECT *
FROM
(SELECT DECODE(om.value, 'NAN', '0', om.value) value,
om.date_time,
om.name,
om.measurement_id
FROM ems.Observation o,
ems.Observation_Measurement om
WHERE o.Observation_Id = om.Observation_Id
AND o.co_mod_asset_id =1240
AND om.measurement_id IN (2109,2110)
ORDER BY om.DATE_TIME DESC
)
WHERE rownum <= 8
'''
and the output is attached in the image.<IMAGE>.
I need to change the order of the WIND_DIR and WIND_SPD so that WIND_SPD comes first and then WIND_DIR. The expected output result will be:
'''
WIND_SPD
WIND_DIR
WIND_SPD
WIND_DIR
WIND_SPD
WIND_DIR
WIND_SPD
WIND_DIR
''' | Add the following 'order by' to your query:
'''
order by date_time desc, measurement_id
'''
This assumes that the 'date_time' value for both measurements is the same, as they appear to be in the output provided.
Actually, you could probably just add ', measurement_id' to the 'order by' in the inner query too. | |
16,248,930 | 1 | 16,248,984 | I would like to put a div on the bottom of a subcontent which is itself in a container,
sub-contents are dynamically generated.
Here is my html code
'''
<div id="Content">
<div class="subcontent"></div>
<div class="subcontent"></div>
<div class="subcontent"></div>
<div class="pagenumber"></div>
</div>
'''
My css code:
'''
#content {
float: left;
margin: 0 auto;
min-height: 450px;
overflow: auto;
padding: 10px;
width: 978px;
}
.subcontent {
float: right;
height: 70px;
margin-bottom: 15px;
width: 700px;
}
DIV.pagenumber {
text-align: right;
???
}
'''
<IMAGE> | try 'clear:both', this will clear any floats. <URL>
'''
DIV.pagenumber {
text-align: right;
clear:both;
}
''' | |
5,268,663 | 1 | 5,268,718 | I want to get this bold part from this string:
'''
some other code src='/pages/captcha?t=c&s=**51afb384edfc&h=513cc6f5349b**' '</td><td><input type=text name=captchaenter id=captchaenter size=3'
'''
This is my regex that is not working:
'''
Regex("src=\'/pages/captcha\?t=c&s=([\d\w&=]+)\'", RegexOptions.IgnoreCase)
'''
In tool for regex testing it's working.
How can this be fixed?
<IMAGE> | Your string-based regex is different from the regex you tested in the tool. In your regex, you have [\d\w\W]+ which matches any character and is aggressive (i.e. no ? after + to make it non-aggressive). So it may match a very long string, which may be all the way up to the end quote.
In your tool you have [\d\w&=] which only matches digits, letters, & and =, so obviously it will stop when hitting the end quote. | |
14,255,679 | 1 | 14,256,369 | I've got a question in regards to styling the appearance of devexpress elements (and comboboxes in particular). I've looked through demos and also looked for tutorials but didn't find anything that seemed to work so far (I know it must work somehow though).
Below is an example of how I create a combobox. The problem I have is that it looks like shown on the image at the end of this post. With settings.Properties.Native=true it looks like a normal combobox, but if set to false it looks completely different (and sadly is way too big).
So my question is: How can I format it to look at least somewhat similar to a normal combobox (sizewise)? (with other words, what is a common way to do that in such cases?
and if done via CSS, what keywords would I have to use there,...?)
Tnx
'''
Kategorie @Html.DevExpress().ComboBox(
settings => {
settings.Name = "ProductCategory";
settings.Width = 300;
settings.SelectedIndex = 0;
settings.Properties.DropDownStyle = DevExpress.Web.ASPxEditors.DropDownStyle.DropDown;
settings.Properties.IncrementalFilteringMode = DevExpress.Web.ASPxEditors.IncrementalFilteringMode.Contains;
settings.Properties.TextField = "Name";
settings.Properties.DisplayFormatInEditMode = false;
settings.Properties.Native = false;
settings.Properties.TextFormatString = "{0}";
settings.Properties.DisplayFormatString = "{0}";
settings.Properties.ValueField = "Id";
settings.Properties.ValueType = typeof(int);
}
).BindList(Categories).GetHtml()
'''
---
<IMAGE> | Choose tool from the Start -> All Programs -> Developer Express xxx -> Components -> Tools -> ASPxThemeBuilder.
Related documentation:
- <URL> | |
8,222,356 | 1 | 8,290,846 | I am trying to generate a diagram similar to that presented by the recent Google Analytics "Visitor Flow". These are also known as <URL>.
I can use a web or non-web based solution, as long as I can run it myself.
The data I want to visualize is the following:
- - -
My data is currently represented with a DiGraph in <URL>, but this may be irrelevant, since I can output my data in any format required.
<IMAGE> | I thought this was an interesting question, so I made an example alluvial diagram using d3: <URL>
And, because d3 is so good at animation, and I thought it would look cool, I made an animated version as well: <URL>
It doesn't cover everything you might want, but hopefully it will provide some basis. The large block of code in the beginning is just making fake data - you can replace this with your real data, or load it using 'd3.json'. The expected format is similar to the DOM node structure d3 expects for network graphs:
'''
{
// list of time slots t1 through tn
times: [
// list of t1 nodes
[
{
nodeName: "Node 1",
id: 1,
nodeValue: 24332
},
// etc ...
],
// etc ...
],
// list of all links
links: [
{
source: 1, // id of source node
target: 5, // id of target node
value: 3243
},
// ... etc
]
}
'''
I hope that's helpful - this isn't a typical SO response, and it would likely require a certain amount of work to customize to your needs, but I thought it might be useful. | |
31,523,056 | 1 | 31,523,338 | again me.
I dont know what the hell isnt working right, but everytime im exporting my Teamspeak Bot wrote in Java, it seems like he dont export the mysql-connector.jar.
Everytime im trying to start my jar, he always tells me that he cant find the MySQL-Driver.
Heres my Code:
<IMAGE>
As you can see, the jar file is in the buildpath. When i try running it through Eclipse, everything works fine. Only when im exporting he throws me the Exception.
Hope someone of you can help me.
ndslr | The way you're exporting your jar, your library jar isn't automatically added to the output jar. You would have to specify the classpath when you run it:
'''
java -cp "C:\Users\Andy\Desktop\mysql-connector.jar;YourOutputJar.jar" TS3BotMySQL
'''
Instead, you have to add the mysql-connector.jar to your output jar. To do this, instead of going to export > jar, go to export > jar, and then select "Extract required libraries into generated JAR" or "Package required libraries into generated JAR" at the prompt.
See these related questions for more information:
<URL>
<URL>
<URL>
<URL> | |
21,262,960 | 1 | 21,278,024 | I have a simple TabUtil-Class that creates me a 'Tab' with an overgiven 'ImageView' as a title.
'''
public static Tab createIconTab(ImageView icon) {
Tab tab = new Tab();
tab.setGraphic(icon);
System.out.println("create tab: +");
icon.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
System.out.println("CLICKED");
}
});
return tab;
}
'''
With three other tabs it produces me the following UI. If I click on the tab with the "+"-icon nothing happens. CLICKED is not beeing printed out... I also tried to set the EventHandler on the graphic component. Again nothing happens...But why?
<IMAGE> | I've had a similar problem and resolved it by putting the ImageView into a Label first, like so:
'''
public static Tab createIconTab(ImageView icon)
{
Label iconLabel = new Label();
iconLabel.setGraphic( icon );
iconLabel.setContentDisplay( ContentDisplay.GRAPHIC_ONLY );
iconLabel.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
System.out.println("CLICKED");
}
});
Tab tab = new Tab();
tab.setGraphic( iconLabel );
return tab;
}
''' | |
14,927,288 | 1 | 14,929,591 | the command i ran:
'''
mvn liquibase:updateSQL -P MyProject -Dusername=MyUser -Dpassword=password
-Ddb_name=$(DB_NAME) -Duser_password=$(USERPASSWORD) -Dvarchar=nvarchar
-Dnumber=numeric -Dchar=nchar -Ddate=datetime -Dtimestamp=datetime
-Dclob=nvarchar(max) -Dlong=nvarchar(max) -Dblob=varbinary(max) -Draw=varbinary
-Dsysdate=GETDATE() -Dsubstring_function=substring -Dfrom_dual_clause=
-Dconcat=+ -Disnull=isnull
'''
this is my first time taking on a liquibase problem. here is the stack trace, how should I go about debugging this?
<IMAGE> | Try setting the -Xmx flag to a higher value. By default Java runs with a fixed amount of memory (64MB), which is too small for the program you are running (hence the OutOfMemoryError). | |
51,331,214 | 1 | 51,331,385 | I am learning MEVN by watching this video <URL>
And I imitated to add a function to const User like below:
'''
module.exports = (sequelize, Datatypes) =>{
const User = sequelize.define('User', {
email:{
type:Datatypes.STRING,
unique: true
},
password:Datatypes.STRING
}, {
hooks:{
beforeCreate: hashPassword,
beforeUpdate: hashPassword,
beforeSave: hashPassword
}
})
User.prototype.comparePassword = function(password) {
return bcrypt.compareAsync(password, this.password)
}
return User
}
'''
But it always shows that 'TypeError: Cannot set property 'comparePassword' of undefined'
(The tutorial video has no problem with it.)
<IMAGE>
I have tried to use "User.____proto____.comparePassword", and it was compiled successfully but cannot pass the function to its instance.
Hope someone can help me out, thanks! | You are using an older version of sequelize that doesn't yet support extending instances by using prototypes.
According to <URL> the older way would be to provide 'instanceMethods'
'''
const Model = sequelize.define('Model', {
...
}, {
classMethods: {
associate: function (model) {...}
},
instanceMethods: {
someMethod: function () { ...}
}
});
'''
The 4.X works like you tried to make it to work. | |
17,266,994 | 1 | 17,267,035 | I have three tables titled "Guest", "Guest_Address" and "Acutal_Address".
Guest_Address is a linking table between guest and acutal_address.
This is what I have so far.
'''
SELECT GUEST_ADDRESS.ADDRESS_CODE,(GUEST_FNAME+' '+GUEST_LNAME) AS GUEST_NAMES
FROM GUEST JOIN GUEST_ADDRESS
ON GUEST.ADDRESS_NUM = GUEST_ADDRESS.ADDRESS_NUM;
'''
This only joins the Guest and Guest_address table, but I need to join Guest and Acutal_Address.
Here is the ERD. <IMAGE> | What you want to do is do an additional join to the actual_address table like so :
'''
SELECT GUEST_ADDRESS.ADDRESS_CODE,(GUEST_FNAME+' '+GUEST_LNAME) AS GUEST_NAMES
FROM GUEST
JOIN GUEST_ADDRESS ON GUEST.ADDRESS_NUM = GUEST_ADDRESS.ADDRESS_NUM
JOIN ACTUAL_ADDRESS ON GUEST_ADDRESS.ADDRESS_CODE = ACTUAL_ADDRESS.ADDRESS_CODE
'''
Mind if I ask why you have that linking table? Can guests have multiple addresses? If that is the case I would change the join from 'GUEST_ADDRESS' to 'GUEST' based on 'GUEST_ID', rather than 'ADDRESS_NUM' as using 'ADDRESS_NUM' makes the relationship between the two tables a one-to-one relationship rather than one-to-many
Also worth noting that the query above will not return a record for the guest if there is no address in the 'ACTUAL_ADDRESS' table or link in the 'GUEST_ADDRESS' table due to the 'JOIN'. If you want it to return guest details regardless of address you can simply change the 'JOIN' to 'LEFT JOIN' | |
18,841,792 | 1 | 18,863,454 | This is turing into a bit of a brain buster, but I assume there is a very simple and efficient method to do this.
In my app I have views laid out in a grid. Views can be moved to any location via gesture. The problem is making the view sort to just the right location after the gesture event. Basically I am doing this. Works sort of but not correct yet.
: the tag of the views will always update to the current position of the view in the grid.
Below is the code I am using to sort, and here is <URL>.
'''
-(void)sortViews:(UIView*)myView {
__block int newIndex;
// myView is the view that was moved.
[viewsArray removeObject:myView];
[viewsArray enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop){
if (myView.center.x > view.center.x) {
if (myView.center.y > view.center.y) {
newIndex = view.tag -1;
*stop = YES;
} else {
newIndex = view.tag +1;
*stop = YES;
}
} else if (myView.center.x < view.center.x) {
if (myView.center.y > view.center.y) {
newIndex = view.tag -1;
*stop = YES;
} else {
newIndex = view.tag +1;
*stop = YES;
}
}
}];
if (newIndex < 0) {
newIndex = 0;
} else if (newIndex > 5) {
newIndex = 5;
}
[viewsArray insertObject:myView atIndex:newIndex];
[UIView animateWithDuration:.4 animations:^{
[self arrangeGrid];
}];
}
'''
<IMAGE> | Found an easier solution that seems to work just fine. I replace the code within the viewsArray enumeration with this:
'''
if (CGRectContainsPoint(view.frame, myView.center)) {
newIndex = view.tag;
*stop = YES;
}
''' | |
10,066,177 | 1 | 10,204,059 | I created a new project and set the compiler to LLVM GCC 4.2, iOS deployment target to 4.2 but I still can't launch it on an iPhone 3G with 4.2.1 on it. It works fine in the simulator and on an iPhone 4, but when I run it on an iPhone 3G with 4.2.1 it simple "finishes" right after I start it, without any console output.
Does anyone have a clue what's wrong?
These are the valid architectures:
<IMAGE> | finds the item require the plist and removes the restriction to only ARMv7 | |
18,243,014 | 1 | 18,243,153 | I am wondering specifically about the wrapper and how to structure the site. I have all content contained within 960 pixels, except for the header image (which is below the navigation). I've attached an image below.
If I'm understanding correctly, I've read in some places to place the header image outside the wrapper, others say within.
Any clarification would be greatly appreciated, I know there are so many ways to do this, but I'd like it to be really clean and adhere to recent standards. I'm using HTML5, not that it matters much.
<IMAGE> | You can create a wrapper class, and but use it only where you need it. So, in your case it would go like this...
- - - - -
That way, although it might seem chopped out, you'll get the desired behaviour, those elements in wrapper having the 'normal' width, while the other go the full width, by default.
See how that works <URL>.
This is essential (and also obligatory by SO):
'''
div {background: #eee; height: 50px;}
div.wrapper {background: #ccc; width: 200px; margin: auto;}
'''
EDIT
And since you want to keep your footer together, not in two separate parts (which makes perfect sense), you can do this, it works too:
'''
<div id="footer">
<div class="wrapper"></div>
</div>
'''
And if you don't want your wide elements to scale, you can define their width, too... Like having a bigger wrapper for those. You can also center the background and never worry about it (thanks @kennypu). Plenty of options once you tame your wrappers.
Note: I might've not used the proper terminology, as wrapper is wrapping only parts of the site and not the whole thing (maybe you can think of it as a limiter), but you get the point. | |
7,548,255 | 1 | 7,553,176 | It's better to see a bug for yourself in Firefox: <URL>
The picture, showing the bug:
<IMAGE>
And the bug <URL>.
The bug appears when you're adding '::first-letter' pseudo-element with 'display: inline-block', and then change the 'font-size' of this 'first-letter'.
More letters in a word after the first: more extra space added (or subtracted -- if the font-size is lesser than block's).
Adding 'float: left' to the 'first-letter' inverts the bug: with bigger font-size the width of 'inline-block' shrinks.
So, the question: is there any CSS-only workaround for this bug? It's somewhat killing me. | I've found that triggering reflow on the whole page (or any block with a problem) fixes the problem, so I've found a way to trigger it on every such block with one-time CSS animation: <URL>
Still, while this fix have no downsides in rendering, it have some other ones:
- -
So, it's not an ideal solution, but would somewhat help when Fx4- would be outdated. Of course, you can trigger such fix onload with JS, but it's not that nice. | |
17,503,853 | 1 | 17,503,885 | I'm developing an information application and I'd like to brighten it by using an interesting navigation just like Ice Cream Sandwitch unlock screen you can see below:
<IMAGE>
Swiping an object to one of four predefined locations starts an Activity. Nothing more :)
So maybe you have any sources or just an advice what to start from to create such menu?
Thank you! | Try <URL>, extracted from the Android open source project. | |
6,694,794 | 1 | 6,697,566 | I want to implement this in Mathematica:<IMAGE>
I realize I can use ParametricPlot to get the lines, and then use the Mesh option to fill in the colors. Can anyone tell me what a general formula for the equations of these lines are? Does it generalize to a regular n-gon? | I happen to have some code lying around that will do something close to what you want and you can view that code here: <URL>.
A couple of comments are in order. The ideas behind the code are all described in Saul Stahl's excellent book, The Poincare Half-Plane - specifically, the chapter on the Poincare disk. I wrote the code to illustrate some ideas for a geometry class that I was teaching in 1999 so it must have been for version 3 or 4. I have done nothing to try to optimize the code for any subsequent version. Regardless, if you define the function 'PTiling' on that page and then execute 'PTiling[5, 2*5 - 4, 3]', you should (after several minutes) get something like the following:
<IMAGE>
Obviously, we have just a black and white picture illustrating the boundaries of the pentagons that you want but, hopefully, this is a good start. I think that one could use portions of disks, rather than circles, to get closer to what you want. | |
24,055,610 | 1 | 24,076,139 | <IMAGE>
I want to implement search for the country/state/city or nearby places in my android map Application, I know this question has already been asked <URL> post but after reading some comments I lost hope.So if anyone has implemented places api in android?? | The straightforward way is to use the 'Google Geocoding API'. You can access it with
<URL>
That will return you a 'JSON' with the location data for that address including latitude and longitude. Here's some code snippets from what I've done:
'''
try{
JSONConnectorGet jget=new JSONConnectorGet(url);
returnval=jget.connectClient();
results=returnval.getJSONArray("results");
resultobj=results.getJSONObject(0);
System.out.println(resultobj.toString());
geometry=resultobj.getJSONObject("geometry");
location=geometry.getJSONObject("location");
lati=location.getDouble("lat");
longi=location.getDouble("lng");
}
catch(Exception e){
e.printStackTrace();
}
a=new LatLng(lati, longi);
'''
Here 'JSONConnectorGet' is a class I wrote that can be used to send a 'HttpGet' request and receive back a 'JSONObject'. 'returnval' is a 'JSONObject' I've declared. 'url' is the URL given above with address replaced with whatever is searched.
Then you have to extract the 'LatLng' from the 'JSONObject'. The 'JSONObjects' and 'JSONArrays' I've used are declared outside the try-catch block. Now I have the Latitude and Longitude of my search place in 'a'.
Now I simply move the camera to that location.
'''
eventmap.animateCamera(CameraUpdateFactory.newLatLngZoom(a, 3.0f));
'''
You can add a marker at that 'LatLng' as well if you want. | |
22,756,028 | 1 | 22,756,177 | <IMAGE>
iOS7 and iOS6 UITableView's style(UITableViewStyleGrouped) is different;iOS7 I set cell.layer.borderWidth, middle row too thick.I want iOS7 and iOS6 UITableView's style(UITableViewStyleGrouped)is same.How can I do? | By definition, iOS7 and iOS6 don't have the same design...
If you want the same design for both, you need to create a design which doesn't rely on the "iOS Design" itself.
If you just need to change the separator height, go here : <URL> | |
11,657,897 | 1 | 11,657,935 | I have the following PHP and JS:
'''
<?php
// Here's where the array of objects is built
$depthElements = array(
array('http://placehold.it/300x300',-150,100,0.8),
array('http://placehold.it/200x300',-270,458,0.7)
);
?>
<script>
var depthElems = <?php echo(json_encode($depthElements)); ?>;
</script>
'''
It builds a multi-dimensional PHP array, and then packages them for the JS:
'''
jQuery(document).ready(function($) {
// Create and position the elements on the page
for (element in window.depthElems) {
var a = window.depthElems[element];
$('body').append('<img src="' + a[0] +
'" style="margin-left: ' + a[1] +
'px; top: ' + a[2] +
'px;" data-velocity="' + a[3] +
'" class="depthElem" />');
}
$(document).scroll(function () {
var topDist = $(document).scrollTop();
$('.depthElem').each(function () {
$(this).css('margin-top', -topDist*($(this).attr('data-velocity')+'px'));
});
});
});
'''
This seems to make sense to me, but for some reason there a bunch of extra elements on the page that I didn't ask for:
<IMAGE>
Where are they coming from? | You are using 'for...in' to loop over an array, <URL>. As a result, you're probably picking up a bunch of properties you didn't mean to loop over and are getting garbage appends as a result.
Use a regular for loop ('for (var i = 0; i < array.length; i++)') instead and it should work as expected. | |
21,417,989 | 1 | 21,442,996 | I am currently trying to create the Mac App store version of my Firemonkey application. My problem is, that the created bundle and pkg file names are not those I want:
<IMAGE>
Instead of daform.app, I want something like "DA-FormMaker.app".
My question is, is there a setting where I can configure that in Delphi (I am using XE4)?
Currently its just using the Delphi project name and its get installed in applications with that name.
I tried to rename the bundle manually and created the pkg file via command line, but it still installs with the old name:
'''
macbook:da-Air da$ sudo installer -store -pkg DA-FormMaker.pkg -target /
installer: Note: running installer as an admin user (instead of root) gives better Mac App Store fidelity
installer: DA-FormMaker.pkg has valid signature for submission: 3rd Party Mac Developer Installer: ...
installer: Installation Check: Passed
installer: Volume Check: Passed
installer: Bundle de.dasoftware.daformmaker will be relocated to /Applications/daform.app
installer: Starting install
'''
Is there a way how this can be done? Maybe I am just blind and cannot find the setting in the IDE.
Thanks in advance.
AndyI | OK, thanks to the comments above from Ken White, which gave me a good hint I managed to come up with a solution.
I was not able to change that in Delphi-XE4 itself. I changed the bundle name as suggested above, but the output was still the same (daform.pkg).
So I renamed the daform.app to DA-FormMaker.app and build the pkg file on my own:
'''
productbuild --component DA-FormMaker.app /Applications --sign "3rd Party Mac Developer Installer" DA-FormMaker.pkg
'''
The test installation with the command
'''
installer -store -pkg DA-FormMaker.pkg -target /
'''
installed the application correctly into the /Applications/DA-FormMaker.app folder. | |
29,382,633 | 1 | 29,382,933 | I have a 'GridView' and some of the items in the list are created by the user, but they are pre-defined buy us, the developers.
<IMAGE>
In the image above, the row with the Store ID is the pre-defined item we created. Since it is pre-defined, it should not have the Action Icons "view", "update", and "delete".
How do we, at least, hide these action icons on our pre-defined items in the 'GridView'? | You may create new column and set callable '$content' property. See <URL>$content-detail
So, for example. Put this code in 'Grid' columns:
'''
[
'content' => function ($model, $key, $index, $column) {
if ($model->storeId == null) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['view', 'id' => $model->id])
. Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['update', 'id' => $model->id])
. Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'id' => $model->id], ['data-method'=> 'post']);
}
}
]
'''
This is work in my project like that <URL> | |
23,716,410 | 1 | 23,718,007 | I have a cell array it is 100x1, variable name is CellA. As you will see from the png file attached, the cell array contains various size matrices in each of the 100 different cells.
I want to extract that data. Actually, I am trying to find the number of unique elements in each cell and their frequency. Below is my code which gets dimensional errors:
'''
for i=1:length(CellA)
if isempty(CellA{i})
continue;% do nothing
else
unqmz(i,:) = unique(CellA{i})';
countmz(i,:) = histc(CellA{i}, unqmz(i))';
end
'''
Eventually, I want to plot count versus unique number for each different cell array where the total number of counts for that cell exceeds a pre-determined value. e.g.) 4
<IMAGE> | You can also do it this way:
'''
unqmz = cellfun(@unique, CellA, 'uni', 0);
countmz = arrayfun(@(n) histc(CellA{n},unqmz{n}), 1:numel(CellA), 'uni', 0).';
''' | |
31,222,191 | 1 | 31,223,862 | I'm starting up my first Play 2.4 project and I'm having an issue with IntelliJ recognizing and finding the JUnit and Play test classes. Here is a screenshot of what I see
<IMAGE>
So basically, the code intelligence isn't picking up the JUnit dependency. The test appears to run fine when I run activator test.
Questions: What can I do to get code intelligence to pick these up
Do I need to mark specific directories as sources?
I have restarted intellij, and rebuilt using sbt. | Take a look at this answer: <URL>
All you need (after valid project import) is step no. 4:
>
1. Click the red @Test annotation, hit Alt + Enter and choose Add junit.jar to the classpath | |
1,712,462 | 1 | 1,712,474 | I have this method:
'''
private void listView1_DoubleClick(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
ListViewItem selectedFile = listView1.SelectedItems[0];
label7.Text = selectedFile.ToString();
string selectedFileLocation = selectedFile.Tag.ToString();
PlaySoundFile(selectedFileLocation);
}
}
'''
The result is this:
<IMAGE>
How can I retrieve the text that is selected in the ListView? :D | '''
label7.Text = selectedFile.Text;
''' | |
8,871,253 | 1 | 8,871,325 | In my project I have a simple 'UIView' with a 'UIScrollView' subview. I am trying to calculate the height based on the content within the 'UIScrollView' with the following code:
<IMAGE>
file.h
'''
@interface ScrollViewController : UIViewController {
IBOutlet UILabel* topLabel;
IBOutlet UILabel* bottomLabel;
IBOutlet UIScrollView * scroller;
}
@property(nonatomic,retain) IBOutlet UIScrollView *scroller;
'''
file.m
'''
- (void)viewDidLoad {
[scroller setScrollEnabled:YES];
CGFloat scrollViewHeight = 0.0f;
for (UIView* view in scroller.subviews)
{
scrollViewHeight += view.frame.size.height;
}
// print value 88.000000
NSLog(@"%f", scrollViewHeight);
[scroller setContentSize:CGSizeMake(320, scrollViewHeight)];
[super viewDidLoad];
}
'''
I don't know why the code doesn't work. | Well, a couple things. First, set a breakpoint at the beginning of that method and walk through your code one line at a time to see what it's doing.
Second, Depending on how your views are laid out, especially if you have views next to each other, that code might not work. It'll also not work if there is vertical margin/space in between the subviews. Instead, you might try this code when looping through the subviews:
'''
for (UIView *view in scroller.subviews){
if (scrollViewHeight < view.frame.origin.y + view.frame.size.height) scrollViewHeight = view.frame.origin.y + view.frame.size.height;
}
'''
This should get you the correct height. | |
28,894,426 | 1 | 28,905,061 | Is there is any query to find the data sources used in the scheduled jobs. I need to find the user ID used for each source and destination pointing the SSIS package. I need to get the following information through query.
<IMAGE> | The short answer is: yes. The longer answer is: yes, but you will probably have to experiment to develop a solution for your particular circumstances.
If you want a query to get all the connection strings from all the SSIS packages stored on your system, there's one <URL>. I'm linking rather than copying the content because the source includes discussion of alternatives and some additional links.
If you also need to determine what packages are being run, you will need to look at some other system tables. Here's another article, by <URL>. | |
29,731,548 | 1 | 29,732,146 | First of all, I don't know Batch programming at all. I came across a FIND command in a tutorial I was reading about OpenCV
<URL>
'''
find ./positive_images -iname "*.jpg" > positives.txt
'''
It basically is supposed to copy all the relative paths of all the jpeg files inside to file. I ran this in CMD(as Administrator) and got the following:
<IMAGE>
What is the meaning of Access Denied? I don't want to learn Batch Programming for this as I am already busy in my project. Please give me a simple-to-understand solution. | The referred tutorial uses the bash find command.But you're executing the Windows find command.Download from somewhere the windows port for the unix command put it in your directory and call it like
'.
ind.exe .\positive_images -iname "*.jpg" > positives.txt'
mind also the windows path separator slashes.
you can use this port for example -> <URL>
(probably there's a newer port but this should do the work) | |
43,557,722 | 1 | 43,558,934 | If I add '-fx-border-radius' and '-fx-border-width' CSS to a simple GridPane, in its corner the background will not be "cut down".
The CSS:
'''
.payload {
-fx-hgap: 20px;
-fx-padding: 40px;
-fx-background-color: #2969c0;
-fx-border-radius: 50px;
-fx-border-width: 5px;
-fx-border-color: black;
-fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.8), 10, 0, 0, 0);
}
'''
The picture about the result:
<IMAGE>
How do I fix this ? | You need to add the radius property as well to define the background fill. Otherwise it will asume a zero value, as shown in your picture.
You can check the CSS specs <URL>.
You just need to add the '-fx-background-radius' property:
'''
.payload {
-fx-hgap: 20px;
-fx-padding: 40px;
-fx-background-color: #2969c0;
-fx-background-radius: 50px;
-fx-border-radius: 50px;
-fx-border-width: 5px;
-fx-border-color: black;
-fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.8), 10, 0, 0, 0);
}
'''
<URL> | |
16,507,839 | 1 | 16,508,118 | I import 2 external libraries (library A, and library B) into my project in Eclipse. These libraries both need "android-support-v4.jar" library. So when compiling, it caused error:
I've read all similar questions, and did try to delete the library "androi-support-v4.jar" from my project. Follow the instruction: Properties-> Java Build Path -> Libraries -> Select "android-support-v4.jar" -> all buttons are disable. I cannot delete it ???
<IMAGE>
Even, in the case I could delete "android-support-v4.jar" from my project, there is still a conflict between 2 libraries A and B. Because both A and B need "android-support-v4.jar". If I delete "android-support-v4.jar" from library A so library A cannot be compiled. | Thanks @SercanOzdemir for your answer. The solution is my project and all dependencies libraries must infer to only one "android-support-v4.jar". So what I do is
- -
So all infer to only one "android-support-v4.jar" from Library A | |
21,456,607 | 1 | 21,457,429 | I have a spinner and a textview with style like spinner. I want to align the text in both, but I do not know how much padding the text in the spinner has.
<IMAGE> | One thing that you could find in <URL> is,
'''
<style name="Widget.Holo.TextView.SpinnerItem" parent="Widget.TextView.SpinnerItem">
<item name="android:textAppearance">@style/TextAppearance.Holo.Widget.TextView.SpinnerItem</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">8dp</item>
</style>
'''
It shows padding is '8dp' each on 'start' and 'end'.
If 8dp look lesser to you, may be you should also look for padding on spinner itself. Like 'Padding of Spinner item + Padinng of text = What you want'.
Hope it works for you. | |
26,790,508 | 1 | 26,891,671 | I have a similar issue to <URL>
and
<URL>
My questions is Why are there multiple locations listed? Second location being "Launched from downloaded JNLP file".
I don't always see this, only sometimes, and I'm not sure what's special that makes "Launched from downloaded JNLP file" to show up as a location.
I know I can include the "Application-Library-Allowable-Codebase" attribute in my jar manifest to get the security prompt with the checkbox, but I don't understand why the "Location" section of the security prompt and how it's determined
Thanks!
<IMAGE> | I think the reason for that is because your jnlp probably includes a link to another jnlp. Am I right?
So the prompt that says "Launched from downloaded JNLP file" means the above location does not belong to the jar resources of the jnlp file that the user clicked, but it belongs to some jar resources of a 2nd jnlp that the original jnlp points to and was dynamically downloaded. | |
30,189,899 | 1 | 30,190,900 | I've been pounding and pounding on this.
I have a comment section on my site with an option to edit with a Twitter Bootstrap dropdown button, but I as you can see below, it's hidden by the following comments.
<IMAGE>
I know it's not an 'overflow' issue, as you can see the bottom of it under the last comment. So it can only be 'z-index' layering issue. But I put all the comments on 'z-index: 4' and the dropdown on 'z-index: 1000', so I have no idea what to do!
Here is a jsFiddle: <URL> | Try removing:
'''
.animated { -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-fill-mode: both; animation-fill-mode: both; }
''' |