title
stringlengths 15
150
| body
stringlengths 38
32.9k
| label
int64 0
3
|
---|---|---|
Make current tab active after postback bootstrap tabs
|
<p>I am using bootstrap tabs in my asp.net project, Tabs are working fine but when the user clicks on any of the button or any postback occurs,</p>
<p>First tab get selected.</p>
<p>I tried hidden field with jquery but it's not working.</p>
<p>What am I missing kindly elaborate please.</p>
<p>Here is my code :</p>
<pre><code> <script type="text/javascript">
$(document).ready(function () {
var selectedTab = $("#<%=hfTab.ClientID%>");
var tabId = selectedTab.val() != "" ? selectedTab.val() : "personal";
$('#dvTab a[href="#' + tabId + '"]').tab('show');
$("#dvTab a").click(function () {
selectedTab.val($(this).attr("href").substring(1));
});
});
</script>
<div id="dvTab">
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#personal" aria-controls="personal" role="tab" data-toggle="tab">Personal Information</a></li>
<li><a href="#pf" aria-controls="pf" role="tab" data-toggle="tab">PF Nominee</a></li>
<li><a href="#gf" aria-controls="gf" role="tab" data-toggle="tab">GF Nominee</a></li>
<li><a href="#edu" aria-controls="edu" role="tab" data-toggle="tab">Education Details</a></li>
<li><a href="#fam" aria-controls="fam" role="tab" data-toggle="tab">Family Details</a></li>
<li><a href="#emphist" aria-controls="emphist" role="tab" data-toggle="tab">Employment History</a></li>
</ul>
<div class="tab-content">
<div id="personal" role="tabpanel" class="tab-pane active">
...
</div>
<div id="pf" role="tabpanel" class="tab-pane">
..
</div>
<div id="gf" role="tabpanel" class="tab-pane">
..
</div>
<div id="edu" role="tabpanel" class="tab-pane">
<asp:Button runat="server" ID="btn_AddEdu" Text="Add Degree/Certificate" OnClick="btn_AddEdu_Click" /><br />
</div>
</div>
</div>
<asp:HiddenField ID="hfTab" runat="server" />
</code></pre>
<p>The button is placed in Education Details Tab,
On the click event of that button , I added :</p>
<pre><code>protected void btn_AddEdu_Click(object sender, EventArgs e)
{
hfTab.Value = "edu";
}
</code></pre>
| 0 |
How to find probability distribution and parameters for real data? (Python 3)
|
<p>I have a dataset from <code>sklearn</code> and I plotted the distribution of the <code>load_diabetes.target</code> data (i.e. the values of the regression that the <code>load_diabetes.data</code> are used to predict). </p>
<p><em>I used this because it has the fewest number of variables/attributes of the regression <code>sklearn.datasets</code>.</em></p>
<p>Using Python 3, <strong>How can I get the distribution-type and parameters of the distribution this most closely resembles?</strong> </p>
<p>All I know the <code>target</code> values are all positive and skewed (positve skew/right skew). . . Is there a way in Python to provide a few distributions and then get the best fit for the <code>target</code> data/vector? OR, to actually suggest a fit based on the data that's given? That would be realllllly useful for people who have theoretical statistical knowledge but little experience with applying it to "real data". </p>
<p><strong>Bonus</strong>
Would it make sense to use this type of approach to figure out what your posterior distribution would be with "real data" ? If no, why not?</p>
<pre><code>from sklearn.datasets import load_diabetes
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
import pandas as pd
#Get Data
data = load_diabetes()
X, y_ = data.data, data.target
#Organize Data
SR_y = pd.Series(y_, name="y_ (Target Vector Distribution)")
#Plot Data
fig, ax = plt.subplots()
sns.distplot(SR_y, bins=25, color="g", ax=ax)
plt.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/ol9gk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ol9gk.png" alt="enter image description here"></a></p>
| 0 |
How to simulate mouse click along with mouse move using javascript
|
<p>I am using simulation for mouse click operation using element.click() in js file, but mouse cursor is some where else and action is performing on correct element, i want to have mouse cursor on element while performing the simulate mouse click.Does anyone know using javascript code, how can i get this?</p>
| 0 |
Product Flavor: Duplicate class found
|
<p>I have a question, but I'm sitting here in front of my app since hours but I can't understand what the problem is.</p>
<p>I have an android app (written in kotlin) and I want to make two product flavors and override a class / file in the product flavor:</p>
<p>So my gradle script is that:</p>
<pre><code>apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
...
productFlavors {
foo {
applicationId "com.foo"
}
}
}
</code></pre>
<p>My files are structured as follows:</p>
<pre><code> - src
- androidTest
- foo
- java
- com
- example
- Bar.kt
- main
- java
- com
- example
- Bar.kt
- test
</code></pre>
<p>So basically I would like to override <code>Bar.kt</code> file in <code>foo</code> product flavor, but somehow it doesn't work: It says class Bar is duplicated.</p>
<p>Any hint?</p>
| 0 |
Export html table to Excel file using ASP.NET MVC
|
<p>I want to export my string html table to excel. When trying to export and when I click save I get the following exception </p>
<blockquote>
<p>The server can not add the header after sending the HTTP headers</p>
</blockquote>
<p>This is my html table :</p>
<pre><code>string tab = "<table cellpadding='5' style='border:1px solid black; border-collapse:collapse'>";
tab += "<tr><td style=' border-width:1px;border-style:solid;border-color:black;'>NumClient</td><td style=' border-width:1px;border-style:solid;border-color:black;'>Raison Sociale</td></tr>";
tab += "<tr><td style='border-width:1px;border-style:solid;border-color:black;'>" + NumClient + "</td><td style='border-width:1px;border-style:solid;border-color:black;'>"
+ Rs + "</td><td style='border-width:1px;border-style:solid;border-color:black;text-align:right;'> </td></tr>";
tab += "</table>";
</code></pre>
<p>This is Controller code : </p>
<pre><code> Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename=Reliquat.csv");
Response.ContentType = "text/csv";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
Response.Write(tab);
Response.End();
</code></pre>
<p>And when I click continue I get an excel file that contains html code: </p>
<pre><code><table cellpadding='5' style='border:1px solid black; border-collapse:collapse'>";
tab += "<tr><td style=' border-width:1px;border-style:solid;border-color:black;'>NumClient</td><td style=' border-width:1px;border-style:solid;border-color:black;'>Raison Sociale</td></tr>
</code></pre>
<p>Does anyone have a solution for this?</p>
| 0 |
How to show an informative real time progress data during long server process
|
<p>I have a so long process may take 1 hour .</p>
<p>This process consists of many steps run from year to year .My main problem is :</p>
<p>How to provide an informative real time progress to the end user during the process not just a dummy loading bar.</p>
<pre><code> int index = Convert.ToInt32(e.CommandArgument);
bool done = false;
int res = -1;
int fromVal = int.Parse(gv_balance.Rows[index].Cells[0].Text);
int toVal = int.Parse(gv_balance.Rows[index].Cells[1].Text);
int finMonth = 1;
int finYear = 0;
int EndServ = 0;
int calcYear = int.Parse(gv_balance.Rows[index].Cells[2].Text);
int total;
total = ((toVal - fromVal) + 1);
string msg = string.Empty;
int confirm = Balance.GetConfirmState(calcYear);
if (confirm == 0)
{
RadProgressContext progress = RadProgressContext.Current;
progress.Speed = "N/A";
finYear = fromVal;
for (int i = fromVal; i <= toVal; i++)
{
decimal ratio;
//Load New Employees
if (toVal - fromVal > 0)
{
ratio = ((decimal)toVal - i) / (toVal - fromVal) * 100;
}
else
{
ratio = ((decimal)toVal - i) / 1 * 100;
}
progress.PrimaryTotal = total;
progress.PrimaryValue = total;
progress.PrimaryPercent = 100;
progress.SecondaryTotal = 100; // total;
progress.SecondaryValue = ratio;//i ;
progress.SecondaryPercent = ratio; //i;
progress.CurrentOperationText = "Step " + i.ToString();
if (!Response.IsClientConnected)
{
//Cancel button was clicked or the browser was closed, so stop processing
break;
}
progress.TimeEstimated = (toVal - i) * 100;
//Stall the current thread for 0.1 seconds
System.Threading.Thread.Sleep(100);
EndServ = i + 1;
if (i == fromVal)
{
//--->STEP1
//Load intial data
int intial = Balance.PrepareIntialData(calcYear);
//--->STEP2
res = Balance.CalcEndServed(calcYear, EndServ - 1, 6, 30);
}
//--->STEP3
int newEmps = Balance.PrepareNewEmployees(calcYear, i);
for (int j = 0; j < 2; j++)
{
if (j == 0)
{
finMonth = 7;
finYear = i;
}
else
{
finMonth = 1;
finYear = i + 1;
}
//--->STEP4
int promotion1 = Balance.PreparePromotionFirst(finYear, finMonth, calcYear);
//--->STEP5
int promotion2 = Balance.PreparePromotionSecond(finYear, finMonth, calcYear);
//--->STEP6
int appointment1 = Balance.PrepareAppointmentFirst(finYear, finMonth, calcYear);
//--->STEP7
int appointment2 = Balance.PrepareAppointmentSecond(finYear, finMonth, calcYear);
//--->STEP8
int bonus = Balance.PrepareBonus(finMonth, finYear, 0, calcYear);
//--->STEP9
int salary = Balance.PrepareSalary(finYear, finMonth, calcYear);
(((CheckBox)gv_balance.Rows[index].Cells[3].FindControl("chk_redirect")).Checked == true)
{
//--->STEP9
int acco = Balance.PrepareFinanceAccount(finYear, finMonth, calcYear);
}
}
//--->STEP10
res = Balance.CalcEndServed(calcYear, EndServ, 6, 30);
Balance.CalcStudy(calcYear);
UpdateProgressContext();
if (res < 0)
{
success_lb.Visible = false;
error_lb.Visible = true;
error_lb.Text = "ERROR";
}
else
{
done = true;
success_lb.Visible = true;
error_lb.Visible = false;
success_lb.Text = "Success";
}
}
}
</code></pre>
<hr>
<p>I want to show the current step for example :
<code>(Promotion 1 ) in ---> 1-2018</code> and the percentage of the whole process beside the estimated time .</p>
| 0 |
error: flexible array member not at end of struct
|
<p>My Struct looks like this:</p>
<pre><code>typedef struct storage {
char ***data;
int lost_index[];
int lost_index_size;
int size;
int allowed_memory_key_size;
int allowed_memory_value_size;
int memory_size;
int allowed_memory_size;
} STORAGE;
</code></pre>
<p>The error im getting is "error: flexible array member not at end of struct". Im aware that this error can be solved by moving <code>int lost_index[]</code> at the end of struct. Why should flexible array member need to be at the end of struct? What is reason?</p>
<p>As this is assumed duplicate of another question, actually i didn't find answers that i actually needed, answers in similar question dont describe the <strong>reason</strong> which stands behind compiler to throw error i asked about.</p>
<p>Thanks</p>
| 0 |
How to .bashrc for root in Docker
|
<p>I want to give my root user in a (<code>centos:6</code>) Docker container a <code>.bashrc</code>. However, when I run my container, I find that the <code>.bashrc</code> has not been sourced. Can this be done?</p>
<p>My build command:</p>
<pre><code>...
RUN touch .bashrc
RUN echo "iptables -t nat -A OUTPUT -d hostA -p tcp --dport 3306 -j DNAT --to hostB" >> .bashrc
...
</code></pre>
<p>My run command:</p>
<pre><code>docker run -it --cap-add=NET_ADMIN myImage /bin/bash
</code></pre>
| 0 |
Shortening my prompt in Zsh
|
<p>I'm having a lot of trouble getting zsh to shorten my prompt. I'm currently using zsh with the agnoster theme and oh-my-zsh package manager.</p>
<p>My prompt currently gets annoyingly long during work, usually around 110 characters, taking up the entire length of my terminal, which is just not very aesthetically pleasing.</p>
<p>I've looked at a few other people's .zshrc's and attempts to modify their prompt, but nothing seems to work in mine. I've tried copying many, many things into my .zshrc and have seen no effects. </p>
<p>My most recent attempt was to try to copy the prompt block from <a href="https://stackoverflow.com/a/171564/2416097">https://stackoverflow.com/a/171564/2416097</a></p>
<p>Nothing. Even when I disabled my theme while having this block included, the prompt is still at full length. </p>
<p>Additionally, I can't seem to find any simple or straightforward guides on how to format my prompt in the first place. Most of the results I found while searching only yielded long format strings without explanation or instruction on use. </p>
<p>Any help appreciated!</p>
| 0 |
How to create Hexagon shape in .xml format
|
<p>I want to create Hexagon shape for my project so I want to create that shape in .xml format so how can i create.</p>
<p><a href="https://i.stack.imgur.com/e8gsg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e8gsg.png" alt="like this image"></a></p>
<p><a href="https://i.stack.imgur.com/McpDN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/McpDN.png" alt="like this image"></a></p>
| 0 |
Swift Open Facebook Profile by FacebookUID
|
<p>I'm trying to open a user's Facebook profile in Swift using their Facebook UID. In the Simulator, it works and opens up the web version of the profile and works fine, however on my actual device, it opens up the Facebook native app and gives me a "Page not Found" error.</p>
<pre><code>guard let facebookUID = self.user?.facebookUID else {
return
}
print(facebookUID)
let fbURLWeb: NSURL = NSURL(string: "https://www.facebook.com/\(facebookUID)")!
let fbURLID: NSURL = NSURL(string: "fb://profile/\(facebookUID)")!
if(UIApplication.sharedApplication().canOpenURL(fbURLID)){
// FB installed
UIApplication.sharedApplication().openURL(fbURLID)
} else {
// FB is not installed, open in safari
UIApplication.sharedApplication().openURL(fbURLWeb)
}
</code></pre>
<p><a href="https://i.stack.imgur.com/RcFJD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RcFJD.png" alt="enter image description here"></a></p>
<p>What am I doing wrong?</p>
<p>Thanks in advance!</p>
<p><strong>EDIT</strong></p>
<p>I've noticed that if a user deletes or doesn't have the Facebook app installed on their phone, it will open up the profile correctly through Safari, which is why it worked on the simulator, but didn't on my device. However, I've also noticed I can get it to work in the Facebook app if I try a public profile like <code>fb://profile/4</code> (which is Mark Zuckerburg's profile). </p>
<p><a href="https://i.stack.imgur.com/bSJpv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bSJpv.png" alt="enter image description here"></a></p>
| 0 |
Excel ISNUMBER Function with IF Statement
|
<p>I have an Excel file I'm working with. There is a column that contains numbers and text, sometimes it's just one or the other. I'm trying to write a function that scans the left most part of the cell to see if it starts with a number. I thought I had it but apparently not. This is what I had:</p>
<pre><code>=IF(ISNUMBER(LEFT(E8,1)), "True", "False")
</code></pre>
<p>This continues to throw me a "false" result even though that particular cell, E8, begins with a "3". What am I missing here?</p>
| 0 |
AngularJS - ng-repeat over array with string index
|
<p>How to <code>ng-repeat</code> over array with string index? Please see below snippet of the code-</p>
<p>Below code is in a controller.</p>
<pre><code>$scope.days = ["mon", "tue", "wed" .... "sun"];
$scope.arr = [];
$scope.arr["mon"] = ["apple","orange"];
$scope.arr["tue"] = ["blue","swish"];
.
.
.
$scope.arr["sun"] = ["pineapple","myfruit","carrot"];
</code></pre>
<p>Question - How to <code>ng-repeat</code> like something below, is it possible?</p>
<pre><code><div ng-repeat="day in days">{{day}}
<span ng-repeat="item in arr(day)">{{item}}</span>
<-- Something like "arr(day)", can it be done in angular -->
</div>
</code></pre>
| 0 |
Mac + Selenium + Chrome = cannot find Chrome binary
|
<p>Hi i m trying to setup selenium with eclipse on a Mac pc.
When I download the ChromeDriver and place it on the below folder :</p>
<pre><code>System.setProperty("webdriver.chrome.driver","/Users/george/Downloads/chromedriver");
WebDriver driver = new ChromeDriver();
</code></pre>
<p>I run the code.
Then I get the following exception :</p>
<blockquote>
<p>Starting ChromeDriver 2.21.371459
(36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 33424 Only local
connections are allowed. Exception in thread "main"
org.openqa.selenium.WebDriverException: unknown error: cannot find
Chrome binary (Driver info: chromedriver=2.21.371459
(36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.10.5
x86_64) (WARNING: The server did not provide any stacktrace
information) Command duration or timeout: 312 milliseconds Build info:
version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'Georges-Mac-mini.local', ip: '192.168.1.2',
os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5',
java.version: '1.7.0_25' Driver info:
org.openqa.selenium.chrome.ChromeDriver</p>
</blockquote>
<p>So I m assuming that some binary is missing? Note that I use regularly Chrome as my browser.. I dont know if this is related or not.
My pc is mac. I have read the ChromeDriver site but I dont understand what exactly to do. I have problems navigating to paths that are a bit strange like : "Google Drive" instead of "Google/Drive" or paths like
"cd Chrome\ Apps.localized/" or "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome". I mean , wt?? are those back and forth slashes ??? I just now a few things on linux but here.. i m stuck and confused
On Windows things where much easier.. you just downloaded an .exe file locally point the driver with options to that file and everything was smoothly. I cant find information on mac specific.</p>
<p>Can anyone help ?</p>
<p>Thanks</p>
| 0 |
o.s.boot.context.web.ErrorPage: Cannot forward to error page for request [/] as the response has already been committed
|
<p>I keep getting a blank page when I render this application in tomcat 8. The only error I see is: </p>
<pre><code>o.s.boot.context.web.ErrorPageFilter: Cannot forward to error page for
request [/] as the response has already been committed.
</code></pre>
<p>Therefore my issue is I am unable to render the index.html page.</p>
<p>I took a static page and added a spring-boot module in it. Ever since I made the change I have not been able to render the page again. I have the index.html file under <code>templates</code></p>
<p><a href="https://i.stack.imgur.com/173BZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/173BZ.png" alt="enter image description here"></a></p>
<p>I added comments in my controller to see if they are even being hit and they are not:</p>
<pre><code>@Controller
public class ApplicationController {
@Autowired
ContactService contactService;
@RequestMapping(value="/", method= RequestMethod.GET)
public String contactForm() throws IOException {
System.out.println("Inside GET in Application Controller");
//model.addAttribute("contact", new Contact());
return "index";
}
@RequestMapping(value="/contact", method= RequestMethod.POST)
public String contactSubmit() throws IOException {
System.out.println("Inside POST in Application Controller");
return "index";
}
}
</code></pre>
<p>I was using Thymeleaf but decided against it which is why the parameters in the methods are blank.</p>
<p>I have uploaded the project to GIT to make it easier for someone to poke around and download if so desired. </p>
<p><a href="https://github.com/drewjocham/stidham_financial.git" rel="noreferrer">Project on GIT</a></p>
<p>----------------Update 1----------------------</p>
<pre><code>@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
private static final Logger LOGGER = Logger.getLogger(WebConfig.class);
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
registry.addResourceHandler("/css/**").addResourceLocations("/resources/css/");
registry.addResourceHandler("/images/**").addResourceLocations("/resources/images/");
registry.addResourceHandler("/image/**").addResourceLocations("/resources/image/");
registry.addResourceHandler("/javascripts/**").addResourceLocations("/resources/javascripts/");
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
}
</code></pre>
<p>There is really nothing else to show that I can think of. You can look at it on GIT for the other files if you so choose too.</p>
| 0 |
Arduino millis() in stm32
|
<p>I am trying to port some Arduino library to stm32. In Arduino, <code>millis()</code> returns the number of milliseconds since boot. Is there an equivalent function in stm32? I am using stm32f0 MCU.</p>
| 0 |
How to split comma and semicolon separated string into a two dimensional array
|
<p>Let's say I have a variable <code>users</code> that contains the following string of text where each user is separated by a semicolon and each attribute of each users is separated by a comma:</p>
<pre><code>Bob,1234,[email protected];Mark,5678,[email protected]
</code></pre>
<p>How would I split this into a multidimensional array variable <code>userArray</code> that looks like this:</p>
<pre><code>[
[Bob,1234,[email protected]],
[Mark,5678,[email protected]]
]
</code></pre>
<p>using JavaScript? </p>
| 0 |
what is the difference between GET and POST method in rest API IOS?
|
<p>i have use this code but i don't know why we use <strong>POST</strong> and why we use <strong>GET</strong> in rest API?</p>
<pre><code>-(IBAction)ClickSignUP:(id)sender
{
NSString *urlLoc = @"YOUR URL";
NSLog(@"%@",urlLoc);
NSString * requestString = [NSString stringWithFormat:@"Name=%@&Email=%@&Password=%@&MobileNumber=%@&BloodGroup=%@&DeviceID=%@&City=%@&DeviceType=I",txtName.text,txtEmail.text,txtPassword.text,txtMobileno.text,strBlood,strDeviceID,txtCity.text];
NSData *postData = [requestString dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu",(unsigned long)[postData length]];
request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:urlLoc]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
PostConnectionSignUp = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}
</code></pre>
<p>how we can integrate kingfisher image loading in swift 3.0</p>
<pre><code>pod 'Kingfisher', '~> 4.6.1.0'
import Kingfisher
imgVUser.kf.setImage(with: URL(string: data.propertyImage), placeholder: UIImage.init(named: "placeholder"), options: [.transition(.fade(1))], progressBlock: nil, completionHandler: nil)
</code></pre>
<p>how we can integrate KRProgress Indicator in swift 3.0</p>
<pre><code>pod 'KRProgressHUD', '~> 3.1.1.0'
DispatchQueue.main.async {
KRProgressHUD.show()
}
DispatchQueue.main.async {
KRProgressHUD.dismiss()
}
</code></pre>
| 0 |
Linq Sum with group by
|
<p>I am having a table structure with columns </p>
<p>FeesNormal</p>
<p>FeesCustom</p>
<p>Currency </p>
<p>Now i am looking for a SUM function group by currency . </p>
<p>For example 20 USD + 30 EURO + 40 INR something like this from this table </p>
<p>I also have to consider the scenario if FeesCustom > 0 I have to ignore FeesNormal for the row </p>
<p>Sample date and expected result is like this </p>
<pre><code> FeesNormal FeesCustom Currency
10 0 USD
15 25 USD //in this case can ignore FeesNormal Since FeesCustom is more
5 10 EUR //same for this row ignore FeesNormal
10 0 EUR
Expected result 35 USD 20 EUR
</code></pre>
<p>I able to find sum using the linq</p>
<pre><code> int sum_custom=(int)fee_list.Where(p => p.FeesCustom > 0).Sum(p => p.FeesCustom);
int sum_normal = (int)fee_list.Where(p => p.FeesCustom ==0).Sum(p => p.FeesNormal);
</code></pre>
| 0 |
Saving into localStorage with nodejs
|
<p>I need to save jwt-token in local-storage through nodejs after the user has logged in (has been authorized ).</p>
<p>After I check if the user/password is correct in my controller - I save generated token in local storage. As it stands I can't reference window as it doesn't exists.</p>
<pre><code>ReferenceError: window is not defined
</code></pre>
<p>This is how I'm currently trying to do it.</p>
<pre><code>...
payload = {
sub: user.email,
role: user.role
};
token = jwt.sign(payload, jwtSecretKey, {expiresIn: '60m'});
window.localStorage.setItem('token', token);
res.status(200).render('index' , {
user: user,
token: token
});
...
</code></pre>
| 0 |
Recycler View Inside Recycler View not Scrolling
|
<p>There is a Recycler View inside the other Recycler View.Both needs to scroll vertically. Outer Recycler view is scrolling properly but inner recycler view is not. </p>
<p>Here is the code:</p>
<pre><code>LinearLayoutManager mLayoutManager = new LinearLayoutManager(ViewActivity.this);
outerRecyclerView.setLayoutManager(mLayoutManager);
ViewAdapter adapter = new ViewAdapter(ViewActivity.this);
outerRecyclerView.setAdapter(adapter);
</code></pre>
<p>ViewAdapter is as follows:</p>
<pre><code>public void onBindViewHolder(ViewAdapter.ViewViewHolder holder, int position)
{
//RECYCLER VIEW
//TODO: Inner Recycler view scroll movement
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
holder.protocolRecyclerView.setLayoutManager(mLayoutManager);
ViewProtocolAdapter adapter = new ViewProtocolAdapter(context);
holder.protocolRecyclerView.setAdapter(adapter);
}
</code></pre>
<p>I have tried the following on both recycler views but could not solve the problem</p>
<pre><code>recyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
if(rv.getChildCount() > 0) {
View childView = rv.findChildViewUnder(e.getX(), e.getY());
if(childView ==listView) {
int action = e.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
rv.requestDisallowInterceptTouchEvent(true);
}
}
}
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
</code></pre>
<p>Also tried this one:</p>
<pre><code>outerRecyclerView.setNestedScrollingEnabled(true);//Does not make any difference
innerRecyclerView.setNestedScrollingEnabled(true);//Recycler View start scrolling but very slowly and sometimes scrolls the outer one.
</code></pre>
| 0 |
Angular 2 typescript to javascript?
|
<p>Currently, I am still wrapping my head around the whole Angular 2 concept. I have used AngularJS (1) in the past, and I liked it.</p>
<p>So currently I am starting a new project and thought why not start using Angular 2. Now I know everyone is using Typescript instead of javascript. However, I'm still unsure how to make a project runnable on a simple web hosting server (PHP, HTML, MySQL, Javascript, etc).</p>
<p>I know I can run npm start on my Linux server, but how does one put it on a hosting server? Can't I just compile the Typescript to javascript so that I can use it in a browser without having to run npm? I read something about JSPM and few others, but I am unsure if this is what I need nor do I get how to get it to run using JSPM or something similar (for example using the "under 5 minutes quickstart" with JSBPM).</p>
<p>I know Angular 2 has a javascript part, and that works for me. However there are no coding examples, and everything you find on the internet is Typescript. So I can't proceed to run Angular 2 in javascript because the lack of tutorials.</p>
<p>In short I don't mind using Typescript, but I just want a pure javascript as a result which I can import into HTML and go from there.</p>
<p>Also on a side note question, do all the node_modules need to be present when running production?</p>
<p>Bonus points for tutorials which explain this!</p>
<p>Thanks!</p>
| 0 |
Await Task Not returning after completion
|
<p>I'm having an issue where a task is completing, but not returning back. I have a website and a web service on different servers. The website makes a call to the web service which utilizes a library with function myFunction(). If I make a call to myFunction from a console app on the web service's server, it will return as expected. However, when I make the call from the website to the web service to call myFunction(), it will get to "Step 3", but not "Step 4". I have a simplified version of the calls below.</p>
<pre><code>private string myFunction()
{
string myStr = myDoWork().GetAwaiter().GetResult();
return myStr;
}
private async Task<string> myDoWork()
{
logger.Debug("Step 1");
string answer = await aFunction();
logger.Debug("Step 4");
return answer;
}
public async Task<string> aFunction()
{
logger.Debug("Step 2");
return await bFunction(CancellationToken.None);
}
AsyncLock myLock = new AsyncLock();
public Task<string> bFunction(CancellationToken cToken)
{
return Task.Run(
async () =>
{
using (await myLock(cToken))
{
logger.Debug("Step 3");
result = "Hello";
return result;
}
},
cToken);
}
</code></pre>
<p>I'm new to async and await, so any help would be appreciated.</p>
| 0 |
Why use mem_fn?
|
<p>I'm confused as to why <code>std::mem_fn</code> is needed.</p>
<p>I have a function that takes in any callable (lambda, function pointer, etc),and binds it to an argument.</p>
<p>Eg:</p>
<pre><code>template<class T>
void Class::DoBinding(T callable) {
m_callable = std::bind(callable, _1, 4);
}
//somewhere else
Item item;
m_callable(item);
</code></pre>
<p>All code samples I've seen do:</p>
<pre><code>//some defined member function
Item::Foo(int n);
DoBinding(std::mem_fn(&Item::Foo));
</code></pre>
<p>Why can't it simply be:</p>
<pre><code>DoBinding(&Item::Foo);
</code></pre>
<p>It seems the latter is callable without having to use std::mem_fn, so why is it needed?</p>
| 0 |
How can I add a new format (<hr> tag) to Quill.js?
|
<p>I want to add a button which would add a <code><hr></code> tag to the <a href="http://beta.quilljs.com/docs/quickstart/">quill.js (beta)</a> editor.</p>
<p>Here the <a href="https://jsfiddle.net/Lgxkj4ag/">fiddle</a>.</p>
<pre><code><!-- Initialize Quill editor -->
<div id="toolbar-container">
<span class="ql-formats">
<button class="ql-hr"></button> //here my hr-button
</span>
<span class="ql-formats">
<button class="ql-bold"></button>
<button class="ql-italic"></button>
</span>
</div>
<div id="editor">
<p>Hello World!</p>
<hr> // this gets replaced by <p> tag automatically *strange*
<p>Some initial <strong>bold</strong> text</p>
</div>
</code></pre>
<p>I initialize my editor:</p>
<pre><code> var quill = new Quill('#editor', {
modules: {
toolbar: '#toolbar-container'
},
placeholder: 'Compose an epic...',
theme: 'snow'
});
</code></pre>
<p>Here I add a <code><h1></code> tag functionality to my editor and it works very well:</p>
<pre><code> $('.ql-hr').on("click",function(){
var range = quill.getSelection();
var text = quill.getText(range.index, range.length);
quill.deleteText(range.index, range.length);
quill.pasteHTML(range.index, '<h1>'+text+'</h1>');
})
</code></pre>
<p>Now I try the same for a <code><hr></code> tag, which doesn't work at all:</p>
<pre><code> $('.ql-hr').on("click",function(){
var range = quill.getSelection();
quill.pasteHTML(range.index, '<hr>');
})
</code></pre>
<p>the <code><hr></code> tag in the initial <code>div#editor</code> gets replaced with a <code><p></code> tag. And the button functionality I added doensn't work for <code><hr></code> tags, but for other tags it works. I know the <code><hr></code> tag is not implemented to Quill.js, that's also why I get this console output:</p>
<blockquote>
<p>quill:toolbar ignoring attaching to nonexistent format hr select.ql-hr</p>
</blockquote>
<p>Is there any way to fix this?</p>
| 0 |
How to implement reader for multiple queries but same output item?
|
<p>For a Spring batch job, we have 2 different queries on the same table. The requirement is to have a reader that execute two queries to read data from the same table.</p>
<p>One way could be : </p>
<pre><code><batch:step id="firstStep" next="secondStep">
<batch:tasklet>
<batch:chunk reader="firstReader" writer="firstWriter" commit- interval="2">
</batch:chunk>
</batch:tasklet>
</batch:step>
<batch:step id="secondStep" next="thirdStep">
<batch:tasklet>
<batch:chunk reader="secondReader" writer="secondWriter"
commit-interval="2">
</batch:chunk>
</batch:tasklet>
</batch:step>
</code></pre>
<p>But this demands totally another step to be defined which is a copy of the first. Is there any other way to achieve the same ? I am looking for something like MultiResourceItemReader for DB based readers that aggregates the data together.</p>
| 0 |
ES6 conditional if statement to check if arrays are empty
|
<p>I can't seem to get my jsx es6 react if statement to work.. What am I doing wrong?</p>
<pre><code>const otherVariables = doesntMatter;
return (
...
<div>
{if (props.student.length == null && props.teacher.length == null) => (
<p>empty</p>
) : (
<p>not empty</p>
)}
</div>
...
)
</code></pre>
<p>How can i check if both arrays are empty?</p>
| 0 |
How do I catch "Index out of range" in Swift?
|
<p>I would really like to use a more simple classic try catch block in my Swift code but I can't find anything that does it.</p>
<p>I just need:</p>
<pre><code>try {
// some code that causes a crash.
}
catch {
// okay well that crashed, so lets ignore this block and move on.
}
</code></pre>
<p>Here's my dilema, when the TableView is reloaded with new data, some information is still siting in RAM which calls <code>didEndDisplayingCell</code> on a tableView with a freshly empty datasource to crash.</p>
<p>So I frequently thrown the exception <code>Index out of range</code></p>
<p>I've tried this:</p>
<pre><code>func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
do {
let imageMessageBody = msgSections[indexPath.section].msg[indexPath.row] as? ImageMessageBody
let cell = tableView.dequeueReusableCellWithIdentifier("ImageUploadCell", forIndexPath: indexPath) as! ImageCell
cell.willEndDisplayingCell()
} catch {
print("Swift try catch is confusing...")
}
}
</code></pre>
<p>I've also tried this:</p>
<pre><code>func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
print(indexPath.section)
print(indexPath.row)
if msgSections.count != 0 {
if let msg = msgSections[indexPath.section].msg[indexPath.row] as? ImageMessageBody {
let cell = tableView.dequeueReusableCellWithIdentifier("ImageUploadCell", forIndexPath: indexPath) as! ImageCell
cell.willEndDisplayingCell()
}
}
}
</code></pre>
<p>This is a very low priority block of code, and I have wasted a lot of time with trial and error figuring out which error handler built into swift works for what seems to be extremely unique situations when I have tons of scenarios just like this one where the code can crash and it will not have any effect on the user experience.</p>
<p>In short, I don't need anything fancy but Swift seems to have extremely specific error handlers that differ based on whether I'm getting a value from a functions return value or getting a value from an array's index which may not exist.</p>
<p>Is there a simple try catch on Swift like every other popular programming language?</p>
| 0 |
Javascript convert string to date format yyyy-MM-dd
|
<p>I have a string which is in the format "05-01-2016" when i run the below code in chrome i get the correct output</p>
<blockquote>
<p>var fromDate = new Date(searchOpts.RunDateFrom);</p>
</blockquote>
<pre><code> fromDate.format("yyyy-MM-dd");
</code></pre>
<p>output = "2016/05/01"</p>
<p>However, when this code is execute inside my js file i get this output</p>
<blockquote>
<p>Sun May 01 2016 00:00:00 GMT+0530 (India Standard Time)</p>
</blockquote>
<p>How do i prevent this? I need to pass the date in this format "2016-05-01" to solr</p>
| 0 |
Regex for Version Number Format
|
<p>Could you please help in giving me the regex for the following version number format: </p>
<p>e.g. 10.01.03-13</p>
<p>< major >.< minor >.< patch >-< buildnumb ></p>
| 0 |
Error - required bootstrap/../vendor/autoload.php) index.php line 22 in Laravel 5
|
<p>I'm working on Laravel 5.2 framework and run first time project </p>
<p>When i run root link display error: </p>
<pre><code>Warning: require(/home/ubuntu/workspace/../bootstrap/autoload.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/index.php on line 22 Call Stack: 0.0028 236248 1. {main}() /home/ubuntu/workspace/index.php:0 Fatal error: require(): Failed opening required '/home/ubuntu/workspace/../bootstrap/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/index.php on line 22 Call Stack: 0.0028 236248 1. {main}() /home/ubuntu/workspace/index.php:0
</code></pre>
<p>Before i call composer install </p>
<p>Its my <strong>application/.htpaccess:</strong></p>
<pre><code><IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
</code></pre>
<p><strong>routes.php</strong></p>
<pre><code>Route::get('/', function () {
return view('welcome');
});
</code></pre>
<p><strong>application/index.php</strong></p>
<pre><code>require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
</code></pre>
<p><strong>EDIT:</strong> </p>
<p>I replaced in index.php to </p>
<pre><code>require __DIR__.'/../vendor/autoload.php';
</code></pre>
<p>But display error: </p>
<pre><code>Warning: require(/home/ubuntu/workspace/../vendor/autoload.php): failed to open stream: No such file or directory in /home/ubuntu/workspace/index.php on line 22 Call Stack: 0.0004 233376 1. {main}() /home/ubuntu/workspace/index.php:0 Fatal error: require(): Failed opening required '/home/ubuntu/workspace/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/ubuntu/workspace/index.php on line 22 Call Stack: 0.0004 233376 1. {main}() /home/ubuntu/workspace/index.php:0
</code></pre>
<p>I have folder vendor in root directory. How me solve this issue? Thank you. </p>
| 0 |
Hide text if it doesn't fit in one line with CSS
|
<p>I have a <code>div</code> element which contains some text. This element has fixed width. If the text is so long that it cannot fit in one line, I want to hide that text (the whole text, not just extra lines). Otherwise show the text. </p>
<p>Can this be done with CSS?</p>
<p>Adding some additional elements in html that can help to accomplish this is acceptable.</p>
| 0 |
NginX not executing PHP
|
<p>I've been through dozens of potential solutions to this problem but cannot find anything that works. Basically, PHP files are not executing on my NginX + PHP_fpm + Ubuntu 14 server. I have all the packages, and they are running. I've cleared browser cache etc., but nothing has worked yet. I appreciate all the help!</p>
<p>As of right now, if I try accessing the PHP file, the GET will return it as an HTML file but will not execute the script.</p>
<p>Here is my nginx.conf file:</p>
<pre><code>worker_processes 1;
worker_rlimit_nofile 8192;
events {
worker_connections 3000;
}
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
http {
include /etc/nginx/mime.types;
#default_type application/octet-stream;
default_type text/html;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
</code></pre>
<p>Here is my /sites-available/default file:</p>
<pre><code>##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /usr/share/nginx/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
include snippets/fastcgi-php.conf;
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
</code></pre>
<p>Here is my server conf file:</p>
<pre><code>server {
listen 8000 default_server;
listen [::]:8000 default_server ipv6only=on;
root /var/www/html;
#index index.php index.html index.htm;
#location / {
#index index.php index.html index.htm;
#}
}
</code></pre>
<p>As you can see, I've been playing around with these files. But to no avail.</p>
| 0 |
How to remove all files in Azure BLOB storage
|
<p>Background:
I have a system which works with a database where I keep metadata of files and Azure Blob storage where I keep files. The database and Azure Blob Storage work together via web-services. </p>
<p>To check that all parts of the system work I created unit tests to web-services which download, upload and remove files. After testing, the database and Azure Blob storage keep a lot of data and I need to remove all of them. I have a script to remove all data from the database (<a href="https://stackoverflow.com/questions/536350/drop-all-the-tables-stored-procedures-triggers-constraints-and-all-the-depend">Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement</a>). </p>
<p>Now I need to write a sctipt (power shell) or code (C#) to remove all files from Azure Blob storage, but I do not remove containers, only files in the containers. </p>
<p>My questions:
Which of these ways (power shell or С#) are the best ?
If I use C# and tasks(System.Threading.Tasks) to remove files it will be faster?</p>
| 0 |
min-height with calc function not working
|
<p>I have a bootstrap panel <a href="https://jsfiddle.net/mpsbhat/h3e1uk54/" rel="nofollow">here</a> where myself trying to set the <code>min-height</code> of <code>panel-body</code> class as,</p>
<pre><code>.panel-body {
min-height: calc(100% - 100px);
}
</code></pre>
<p>Why it is not working in the given fiddle? Is <code>calc</code> function browser dependent?</p>
| 0 |
How to get Image size from URL in ios
|
<p>How can I get the size(height/width) of an image from URL in objective-C? I want my container size according to the image. I am using <code>AFNetworking 3.0.</code>
I could use <code>SDWebImage</code> if it fulfills my requirement.</p>
| 0 |
Python "Too many indices for array"
|
<p>I am reading a file in python using pandas and then saving it in a numpy array.
The file has the dimension of 11303402 rows x 10 columns.
I need to split the data for cross validation and for that I sliced the data into 11303402 rows x 9 columns of examples and 1 array of 11303402 rows x 1 col of labels.
The following is the code:</p>
<pre><code>tdata=pd.read_csv('train.csv')
tdata.columns='Arrival_Time','Creation_Time','x','y','z','User','Model','Device','sensor','gt']
User_Data = np.array(tdata)
features = User_Data[:,0:9]
labels = User_Data[:,9:10]
</code></pre>
<p>The error comes in the following code:</p>
<pre><code>classes=np.unique(labels)
idx=labels==classes[0]
Yt=labels[idx]
Xt=features[idx,:]
</code></pre>
<p>On the line: </p>
<pre><code>Xt=features[idx,:]
</code></pre>
<p>it says 'too many indices for array'</p>
<p>The shapes of all 3 data sets are:</p>
<pre><code>print np.shape(tdata) = (11303402, 10)
print np.shape(features) = (11303402, 9)
print np.shape(labels) = (11303402, 1)
</code></pre>
<p>If anyone knows the problem, please help.</p>
| 0 |
Postgres shuts down immediately when started with docker-compose
|
<p>Postgres shuts down immediately when started with docker-compose. The yaml file used is below</p>
<pre><code>version: '2'
services:
postgres:
image: postgres:9.5
container_name: local-postgres9.5
ports:
- "5432:5432"
</code></pre>
<p>The log when docker-compose up command is executed</p>
<pre><code>Creating local-postgres9.5
Attaching to local-postgres9.5
local-postgres9.5 | The files belonging to this database system will be owned by user "postgres".
local-postgres9.5 | This user must also own the server process.
local-postgres9.5 |
local-postgres9.5 | The database cluster will be initialized with locale "en_US.utf8".
local-postgres9.5 | The default database encoding has accordingly been set to "UTF8".
local-postgres9.5 | The default text search configuration will be set to "english".
local-postgres9.5 |
local-postgres9.5 | Data page checksums are disabled.
local-postgres9.5 |
local-postgres9.5 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
local-postgres9.5 | creating subdirectories ... ok
local-postgres9.5 | selecting default max_connections ... 100
local-postgres9.5 | selecting default shared_buffers ... 128MB
local-postgres9.5 | selecting dynamic shared memory implementation ... posix
local-postgres9.5 | creating configuration files ... ok
local-postgres9.5 | creating template1 database in /var/lib/postgresql/data/base/1 ... ok
local-postgres9.5 | initializing pg_authid ... ok
local-postgres9.5 | initializing dependencies ... ok
local-postgres9.5 | creating system views ... ok
local-postgres9.5 | loading system objects' descriptions ... ok
local-postgres9.5 | creating collations ... ok
local-postgres9.5 | creating conversions ... ok
local-postgres9.5 | creating dictionaries ... ok
local-postgres9.5 | setting privileges on built-in objects ... ok
local-postgres9.5 | creating information schema ... ok
local-postgres9.5 | loading PL/pgSQL server-side language ... ok
local-postgres9.5 | vacuuming database template1 ... ok
local-postgres9.5 | copying template1 to template0 ... ok
local-postgres9.5 | copying template1 to postgres ... ok
local-postgres9.5 | syncing data to disk ... ok
local-postgres9.5 |
local-postgres9.5 | WARNING: enabling "trust" authentication for local connections
local-postgres9.5 | You can change this by editing pg_hba.conf or using the option -A, or
local-postgres9.5 | --auth-local and --auth-host, the next time you run initdb.
local-postgres9.5 |
local-postgres9.5 | Success. You can now start the database server using:
local-postgres9.5 |
local-postgres9.5 | pg_ctl -D /var/lib/postgresql/data -l logfile start
local-postgres9.5 |
local-postgres9.5 | ****************************************************
local-postgres9.5 | WARNING: No password has been set for the database.
local-postgres9.5 | This will allow anyone with access to the
local-postgres9.5 | Postgres port to access your database. In
local-postgres9.5 | Docker's default configuration, this is
local-postgres9.5 | effectively any other container on the same
local-postgres9.5 | system.
local-postgres9.5 |
local-postgres9.5 | Use "-e POSTGRES_PASSWORD=password" to set
local-postgres9.5 | it in "docker run".
local-postgres9.5 | ****************************************************
local-postgres9.5 | waiting for server to start....LOG: database system was shut down at 2016-05-16 16:51:54 UTC
local-postgres9.5 | LOG: MultiXact member wraparound protections are now enabled
local-postgres9.5 | LOG: database system is ready to accept connections
local-postgres9.5 | LOG: autovacuum launcher started
local-postgres9.5 | done
local-postgres9.5 | server started
local-postgres9.5 | ALTER ROLE
local-postgres9.5 |
local-postgres9.5 |
local-postgres9.5 | /docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
local-postgres9.5 |
local-postgres9.5 | LOG: received fast shutdown request
local-postgres9.5 | LOG: aborting any active transactions
local-postgres9.5 | LOG: autovacuum launcher shutting down
local-postgres9.5 | LOG: shutting down
local-postgres9.5 | waiting for server to shut down....LOG: database system is shut down
local-postgres9.5 | done
local-postgres9.5 | server stopped
local-postgres9.5 |
local-postgres9.5 | PostgreSQL init process complete; ready for start up.
local-postgres9.5 |
local-postgres9.5 | LOG: database system was shut down at 2016-05-16 16:51:55 UTC
local-postgres9.5 | LOG: MultiXact member wraparound protections are now enabled
local-postgres9.5 | LOG: database system is ready to accept connections
local-postgres9.5 | LOG: autovacuum launcher started
</code></pre>
<p>Postgres seems to work fine when a container is started using the same image with docker run</p>
<pre><code>docker run --name local-postgres9.5 -p 5432:5432 postgres:9.5
</code></pre>
| 0 |
TypeScript: 'super' must be called before before accessing 'this' in the constructor of a derived class
|
<p>I've seen this question passing a few times before, but I think my question is more concerning an architectural approach of this.<br>
In TypeScript it is not possible to use the <code>this</code> keyword before calling <code>super</code> (on a class that extends from another class).<br>
But what if you need to do something as in the example below?<br>
(Just for clarification: I'm creating a component lifecycle for a UI library, so it feels like I really need to do something like this, and I can't seem to think of any other way of tackling this).</p>
<h3>Code</h3>
<p>What I would like to do is this:</p>
<pre><code>class Person
{
public firstName: string;
constructor()
{
this.scream();
}
protected scream(): void
{
console.log(this.firstName);
}
}
class Employee extends Person
{
public lastName: string;
constructor(firstName: string, lastName: string)
{
this.lastName = lastName;
super(firstName);
}
protected scream(): void
{
console.log(this.firstName + ' ' + this.lastName);
}
}
</code></pre>
<h3>Problem</h3>
<p>The constructor of the parent class, 'Person', calls a protected method.<br>
The child class, 'Employee', wants to use its own parameter (<code>this.lastName</code>) when overriding this protected method.<br>
But the code above is throwing the error (in Webstorm at least):<br>
"'super' must be called before before accessing 'this' in the constructor of a derived class"</p>
<h3>Possible Solution</h3>
<p>A) Switch <code>this.lastName = lastName</code> with the <code>super</code>call</p>
<pre><code>class Employee extends Person
{
...
constructor(firstName: string, lastName: string)
{
super(firstName);
this.lastName = lastName;
}
...
}
</code></pre>
<p>=> The problem here is that <code>this.lastName</code> will be <code>undefined</code> inside the <code>scream()</code> method on class 'Employee'.</p>
<p>B)<br>
Use <code>setTimeout(callback, 0)</code>.
This way the <code>this.scream()</code> method will be called later.</p>
<pre><code>class Person
{
...
constructor()
{
setTimeout(() => this.scream(), 0);
}
...
}
</code></pre>
<p>=> But it just feels like a very ugly hack to me.</p>
<p>C)<br>
Don't call <code>this.scream()</code>from inside the Person class, but call it from the consumer.</p>
<pre><code>const employee: Employee = new Employee();
employee.scream();
</code></pre>
<p>=> But obviously this is not always what you want. </p>
<h3>Question</h3>
<ul>
<li>Am I doing a dumb thing here?</li>
<li>Are there better ways to arrange my code so I don't need to do this?</li>
<li>Is there some way to work around this error?</li>
</ul>
| 0 |
How can I validate a JWT passed via cookies?
|
<p>The <code>UseJwtBearerAuthentication</code> middleware in ASP.NET Core makes it easy to validate incoming JSON Web Tokens in <code>Authorization</code> headers. </p>
<p>How do I authenticate a JWT passed via cookies, instead of a header? Something like <code>UseCookieAuthentication</code>, but for a cookie that just contains a JWT.</p>
| 0 |
Android Studio Gradle Build takes more than 5 minutes
|
<p>So I have been working on a simple app in Android Studio and since last couple of days, whenever I click "Run", it takes more than 5 minutes to build. It didn't used to be this slow. I don't know why. It says "Gradle Build Running" and then app is loaded after 5 minutes. And this happens on both the emulator and on my android device. My grade version is 2.10
I looked up this issue and I have tried everything that other similar posts have suggested including:</p>
<ul>
<li>Adding --parallel and --offline to command line option settings</li>
<li>Enabling 'offline work' in Gradle setting</li>
<li>Adding <code>org.gradle.daemon=true</code> in gradle.properites file</li>
</ul>
<p>Below are the screen shots. </p>
<p><a href="https://i.stack.imgur.com/wzb0p.png"><img src="https://i.stack.imgur.com/wzb0p.png" alt="image 1"></a></p>
<p><a href="https://i.stack.imgur.com/o5m7X.png"><img src="https://i.stack.imgur.com/o5m7X.png" alt="image 2"></a></p>
<p><a href="https://i.stack.imgur.com/j6wy3.png"><img src="https://i.stack.imgur.com/j6wy3.png" alt="image 3"></a></p>
<p>Even after doing all these, my grade build takes 5+ minutes.
This is what was there in the event log: </p>
<pre><code>10:27:57 AM Executing tasks: [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
10:34:24 AM Gradle build finished in 6m 26s 378ms
</code></pre>
<p>Any suggestions will be helpful. Thanks in advance :)</p>
| 0 |
How can I make UINavigationController transparent in one view controller only?
|
<p>I want to make the <code>NavigationBar</code> transparent in only one <code>ViewController</code>. However, upon changing the <code>NavigationBar</code> in a single <code>ViewController</code>, the entire <code>navigationController</code> becomes transparent and after a few second crashes.Here is my block of code:</p>
<pre><code>override func viewWillAppear(animated: Bool) {
self.navigationController!.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.translucent = true
self.navigationController!.view.backgroundColor = UIColor.clearColor()
}
override func viewDidDisappear(animated: Bool) {
self.navigationController!.navigationBar.setBackgroundImage(nil, forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = nil
self.navigationController?.navigationBar.translucent = true
}
</code></pre>
<p>It crashes in line</p>
<pre><code>self.navigationController!.navigationBar.setBackgroundImage(nil, forBarMetrics: UIBarMetrics.Default)
</code></pre>
| 0 |
Autocomplete dropdown in MVC5?
|
<p>Hi i have one field in my view. That field is Customer it is a dropdown field. In that i have keep dropdown as select option to select the value. But i like to change that field as Autocomplete dropdown. </p>
<p><a href="https://i.stack.imgur.com/OaqsG.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/OaqsG.jpg" alt="enter image description here"></a></p>
<p>In the above image I have customerName field as dropdown field but i keep it by search and select option. But now i like to change this to autocomplete dropdown like which is mention the in the below image.</p>
<p><a href="https://i.stack.imgur.com/jdE9r.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/jdE9r.jpg" alt="enter image description here"></a></p>
<p><strong>My view Code</strong></p>
<pre><code> @Html.Label("Customer Name", new { @class = "control-label" })
@Html.DropDownListFor(model => model.CustomerID, new SelectList(string.Empty, "Value", "Text"), "Please select a Customer", new { @class = "form-control required", type = "text" })
</code></pre>
<p><strong>My jquery Code</strong></p>
<pre><code> $(function () {
debugger;
$.ajax(
'@Url.Action("GetVisitCustomer", "VisitorsForm", new { Area = "Sales" })',{
type: "GET",
datatype: "Json",
success: function (data) {
$.each(data, function (index, value) {
$('#CustomerID').append('<option value="' + value.CustomerID + '">' + value.DisplayName + '</option>');
});
}
});
});
</code></pre>
<p><strong>My Controller Code to get Customers and load in the field</strong></p>
<pre><code> public JsonResult GetVisitCustomer()
{
var objCustomerlist = (from c in db.Customers where c.IsDeleted== false select c).ToList();
return Json( objCustomerlist,JsonRequestBehavior.AllowGet);
}
</code></pre>
<p>I tried to explain my issue. Any one help to resolve this issue. I tried many ways but its not working. So any one understand my issue and give some solution or suggesstions.</p>
<p>The Code which i have tried </p>
<p>My View Code</p>
<pre><code> @Html.Label("Customer Name", new { @class = "control-label" })
@Html.TextBoxFor(Model=>Model.CustomerID)
</code></pre>
<p>My Jquery Code</p>
<pre><code> <script type="text/javascript">
$(document).ready(function () {
debugger;
$("#CustomerID").autocomplete({
source: function (request, response) {
$.ajax(
'@Url.Action("GetVisitCustomer", "VisitorsForm", new { Area = "Sales" })', {
type: "POST",
dataType: "json",
data: { term: request.term },
success: function (data) {
response($.map(data, function (item) {
return
{ label=item.CustomerID, value= item.DisplayName
};
}))
}
})
},
messages: {
noResults: "", results: ""
}
});
})
</script>
</code></pre>
<p>But this code is not working</p>
<p>Advance Thanks..</p>
| 0 |
Automatically open html links in new tab
|
<p>I have a html document with 100 html-links. When I open the document in a browser I want all the links in the document to open automatically in 100 different tabs in the same browser. Alternatively I want to do this some other way with the terminal in OS X or with cmd.exe in Windows. This is just for data collection and not web development.</p>
| 0 |
Onclick not working. Cannot read property 'click' of null
|
<p>I keep receiving the following error from the browser console when loading my script into my <a href="http://phoneparter.com/" rel="nofollow">Magento store</a>. All that it is listening for is an onclick event on a div yet I receive this error:</p>
<p>"Uncaught TypeError: Cannot read property 'click' of null."</p>
<p>The script works in <a href="https://jsfiddle.net/p1dvswnm/9/" rel="nofollow">JSfiddle</a> so I'm really not quite sure why it isn't working. I've tried enclosing it within a $( document ).ready() as well but I receive the same error.</p>
<p><strong>Code:</strong></p>
<pre><code>var step = 0;
var deviceType = "";
var modelType = "";
function showGen(){
$('.phoneTypes').css("display", "none");
if (deviceType == "Samsung"){
$('.sphoneGens').css("display", "block");
}
if (deviceType == "iPhone"){
$('.iphoneGens').css("display", "block");
}
if (deviceType == "iPad"){
$('.ipadGens').css("display", "block");
}
}
// Pick Device Type
$('.choicelabel').click(function(){
deviceType = $(this).children('input').val();
showGen();
});
//Pick Device Gen
$('.choiceType').click(function(){
modelType = $(this).children('input').val();
//$(".iphoneGens").css("display", "none");
console.log(deviceType);
console.log(modelType);
$(this).parents(".row").hide();
});
</code></pre>
<p>Any help debugging this issue will be greatly appreciated.</p>
| 0 |
ES6 Assign a variable with an arrow function
|
<p>I've just started getting accustomed with ES6 syntax and I was wondering if it was possible to assign to a variable with an arrow function. I'm writing a basic lightweight AJAX helper library and on a status of 200, I want to return a payload to the user, which I currently do with:</p>
<pre><code>var responseData = "";
switch (payload.returnType.toLowerCase()) {
case "json" : responseData = JSON.parse(httpRequest.responseText); break;
case "text" : responseData = httpRequest.responseText; break;
default : responseData = null; break;
}
callback(null, responseData);
</code></pre>
<p>This is fine, but I can't help but think I could make this cleaner, if I do:</p>
<pre><code>callback(null, () => { switch(payload.returnType.toLowerCase()) { ... });
</code></pre>
<p>I would expect the <code>return</code> statement to send the result of the expression as the 2nd parameter in my callback, however when I console log from the caller it prints the switch statement.</p>
<p>Alternatively I have tried to do:</p>
<pre><code>var responseData = () => {
switch (payload.returnType.toLowerCase()) {
case "json" : return JSON.parse(httpRequest.responseText); break;
case "text" : return httpRequest.responseText; break;
default : return null; break;
}
}
callback(null, responseData);
</code></pre>
<p>In this case, <code>responseData</code> is always empty. Is it possible to have the return value as my 2nd parameter or have it bound to <code>responseData</code> as the result of the arrow function?</p>
| 0 |
Detect if user is using webview for android/iOS or a regular browser
|
<p>How to detect if the user is browsing the page using <strong>webview</strong> for <strong>android</strong> or <strong>iOS</strong>?</p>
<p>There are <em>various</em> solutions posted all over stackoverflow, but we don't have a bulletproof solution yet for both OS.</p>
<p>The aim is an if statement, example:</p>
<pre><code>if (android_webview) {
jQuery().text('Welcome webview android user');
} else if (ios_webview) {
jQuery().text('Welcome webview iOS user');
} else if (ios_without_webview) {
// iOS user who's running safari, chrome, firefox etc
jQuery().text('install our iOS app!');
} else if (android_without_webview) {
// android user who's running safari, chrome, firefox etc
jQuery().text('install our android app!');
}
</code></pre>
<h1>What I've tried so far</h1>
<p><strong>Detect iOS webview</strong> (<a href="https://stackoverflow.com/a/30495399/1185126">source</a>):</p>
<pre><code>if (navigator.platform.substr(0,2) === 'iP'){
// iOS (iPhone, iPod, iPad)
ios_without_webview = true;
if (window.indexedDB) {
// WKWebView
ios_without_webview = false;
ios_webview = true;
}
}
</code></pre>
<p><strong>Detect android webview</strong>, we have a number of solutions like <a href="https://stackoverflow.com/questions/12727117/android-webview-user-agent-vs-browser-user-agent">this</a> and <a href="https://stackoverflow.com/questions/6783185/detect-inside-android-browser-or-webview">this</a>. I'm not sure what's the appropriate way to go because every solution seems to have a problem. </p>
| 0 |
Ways to declare Function in AngularJS Controller (controllerAs approach)
|
<p>I use <strong>controller as</strong> approach instead of $scope. I have some problems with method calling from HTML. So, the question is that, how many ways exist in declare and call functions in this approach. </p>
<p>first: (If I want to do s.th. at first)</p>
<pre><code>var vm= this ;
vm.dataOne=[];
function funcOne() {
myService.serviceFunc()
.then(function (response) {
vm.dataOne= response.data;
});
};
function activate() {
funcOne();
}
activate();
</code></pre>
<p>second: (If I want to initialize a variable based on a function returned value ) </p>
<pre><code> vm.dataTwo = function () {
doSomeThing();
}
</code></pre>
<ul>
<li>Is there any way, too?</li>
<li><p>How should define a function in controller
which will be called from HTML, as</p>
<pre><code>ng-click = "ctrl.dataTwo()";
</code></pre></li>
</ul>
| 0 |
Post Method using Volley not working
|
<p>Hi i am using <code>Volley</code> for my login page. I need to pass data like this manner</p>
<pre><code>{
userID : '-988682425884628921',
email :'[email protected]',
passwd : '123ss'
}
</code></pre>
<p>I am using POST Method to send data,I already check in DHC, The Api is working fine in DHC and I am getting <a href="http://pastie.org/10854767" rel="nofollow">JSON Response</a>, But when i try with Volley i am not able to get response. and not even any error in my logcat.</p>
<p>JAVA code</p>
<pre><code> RequestQueue mVolleyQueue = Volley.newRequestQueue(this);
CustomRequest req = new CustomRequest(Request.Method.POST,url,null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.v("tag","login response " + response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.v("tag","login error response " + error.getMessage());
}
}){
@Override
public Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("userID", "-988682425884628921");
params.put("email", "[email protected]");
params.put("passwd", "123ss");
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json; charset=utf-8");
return headers;
}
};
mVolleyQueue.add(req);
</code></pre>
<p>Error</p>
<pre><code>05-28 09:20:14.696 2450-2468/com.android.msahakyan.expandablenavigationdrawer E/tag﹕ parseNetworkError is ! null
05-28 09:20:14.697 2450-2468/com.android.msahakyan.expandablenavigationdrawer E/tag﹕ parseNetworkError status code : 400
05-28 09:20:14.697 2450-2468/com.android.msahakyan.expandablenavigationdrawer E/tag﹕ parseNetworkError message : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Header</h2>
<hr><p>HTTP Error 400. The request has an invalid header name.</p>
</BODY></HTML>
}
</code></pre>
| 0 |
Split dataframe into two on the basis of date
|
<p>I have dataset with 1000 rows like this </p>
<pre><code> Date, Cost, Quantity(in ton), Source, Unloading Station
01/10/2015, 7, 5.416, XYZ, ABC
</code></pre>
<p>i want to split the data on the base of date. For e.g. till date 20.12.2016 is a training data and after that it is test data.</p>
<p>How should i split? Is it possible?</p>
| 0 |
java.lang.RuntimeException: setAudioSource failed
|
<p>I am new to android development. I am just trying to record an audio with android studio(2.1.1) testing with 6.0.1 Marshmallow device.</p>
<pre><code>public class MainActivity extends AppCompatActivity {
Button start, stop;
public MediaRecorder recorder = null;
public String fileextn = ".mp4";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
start = (Button) findViewById(R.id.start_button);
stop = (Button) findViewById(R.id.stop_button);
start.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.start_button:
startRecord();
case R.id.stop_button:
stoprecord();
}
}
}
);
}
public void startRecord() {
recorder = new MediaRecorder();
recorder.reset();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setOutputFile(getFilePath());
try {
recorder.prepare();
recorder.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void stoprecord() {
if (recorder != null) {
recorder.stop();
recorder.reset();
recorder.release();
recorder = null;
}
}
private String getFilePath() {
String filepath = Environment.getExternalStorageDirectory().getPath();
File file = new File(filepath, "MediaRecorderSample");
if (!file.exists())
file.mkdirs();
return (file.getAbsolutePath() + "/" + fileextn);
}
}
</code></pre>
<p>By the way, I have included the uses-permission in manifext.xml file. </p>
<p><strong>This is what i get in the Android Monitor:</strong> </p>
<pre><code> 05-18 11:08:36.576 10414-10414/com.example.gk.audiocapture E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.gk.audiocapture, PID: 10414
java.lang.RuntimeException: stop failed.
at android.media.MediaRecorder.stop(Native Method)
at com.example.gk.audiocapture.MainActivity.stoprecord(MainActivity.java:65)
at com.example.gk.audiocapture.MainActivity$1.onClick(MainActivity.java:35)
at android.view.View.performClick(View.java:5207)
at android.view.View$PerformClick.run(View.java:21168)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
</code></pre>
<p>I tried for some answers, didn't find any.</p>
<p>MY AndroidManifest.xml: </p>
<pre><code> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gk.audiocapture">
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</code></pre>
<p></p>
| 0 |
no target device found android studio 2.1.1
|
<p>i'm using <strong>android studio 2.1.1</strong> in ubuntu 14.04.Now my question is,i want to run the program through my phone without emulator. so i chose the target as usb device but whenever i run this,below mentioned error is rasing.</p>
<p><strong>Error running app : No target device found.</strong></p>
<p>i checked my device by using <strong>adb devices</strong> command in terminal.
adithya@adithya-Lenovo-B460e:~$ adb devices
<strong>List of devices attached
59V8I7HEJJWGGMK7 device</strong></p>
<p>i also tried with selecting of MTP & PTP.but nothing worked out.
kindly anyone help me to solve this problem..</p>
| 0 |
Where are logs located?
|
<p>I'm debugging a JSON endpoint and need to view internal server errors. However, my <code>app/storage/logs</code> dir is empty and it seems there are no other directories dedicated to logs in the project. I've tried googling the subject to no avail.</p>
<p>How can I enable logging, if it's not already enabled and view the logs?</p>
| 0 |
how to call angular scope function from javascript function inside controller
|
<p>I have angular controller and Javascript function in that function , i am calling angular function. I am getting error: $scope.Name is not a function, $scope.dates is not a function.</p>
<pre><code> function validation() {
$scope.pageload = true;
$scope.Name();
$scope.dates();
}
$scope.Name = function () {
// do something
}
$scope.dates = function () {
// do something
}
</code></pre>
<p>working fine inside the controller</p>
<pre><code> var MyController = function ($scope, service)
{
function validation() {
$scope.pageload = true;
$scope.Name();
$scope.dates();
}
$scope.Name = function () {
// do something
}
$scope.dates = function () {
// do something
}
});
working:
var MyController = function ($scope, service)
{
LoginHomeService.getHomeService(function (data) {
$rootScope.CT1SessionObj = data.CT1SessionObj;
validation();
}, function (response) {
alert(response.Message);
});
function validation() {
$scope.pageload = true;
$scope.Name();
$scope.dates();
}
$scope.Name = function () {
// do something
}
$scope.dates = function () {
// do something
});
Not working:
var MyController = function ($scope, service)
{
LoginHomeService.getHomeService(function (data) {
$rootScope.CT1SessionObj = data.CT1SessionObj;
validation();
function validation() {
$scope.pageload = true;
$scope.Name();
$scope.dates();
}
$scope.Name = function () {
// do something
}
$scope.dates = function () {
// do something
}
}, function (response) {
alert(response.Message);
});
});
</code></pre>
| 0 |
Would onClick event work on touch on touch-screen devices?
|
<p>I've used <code>onclick</code> events in my website. But when I open it in google chromes' developer mode's mobile view, nothing happens on touch on the elements which work on click with mouse. So my question is: </p>
<p>Do I have to also add <code>ontouch</code> events along with <code>onclick</code> events, or onClick event work on touch on all touch-screen devices?</p>
<p>P.S: You can see all of my codes here: <a href="https://github.com/SycoScientistRecords/sycoscientistrecords.github.io/" rel="noreferrer">https://github.com/SycoScientistRecords/sycoscientistrecords.github.io/</a> </p>
<p>Or at the live website: <a href="http://sycoscientistrecords.github.io" rel="noreferrer">http://sycoscientistrecords.github.io</a> </p>
<p>And no I haven't tested the website on real phone.</p>
| 0 |
Retrofit2 - response body null on success request
|
<p>I'm having a problem with Retrofit2.</p>
<p>When I make a call to my webservice, even in case of success, the body of my response is null.</p>
<p>I tried to make the same call with RESTClient for Firefox and the body contains the correct answer.</p>
<p>This is my stack trace:</p>
<pre><code>D/Call request: Request{method=POST, url=http://myNeo4jServer.com, tag=null}
D/Call request header: Authorization: Basic xxxxxx
Accept: application/json; charset=UTF-8
D/Response raw header: Server: nginx
Date: Tue, 17 May 2016 10:55:13 GMT
Content-Type: application/json
Content-Length: 21549
Connection: keep-alive
Access-Control-Allow-Origin: *
OkHttp-Sent-Millis: 1463482513167
OkHttp-Received-Millis: 1463482513354
D/Response raw: retrofit2.OkHttpCall$NoContentResponseBody@e6c7df
D/Response code: 200
D/Response body: null
</code></pre>
<p>As you can see:</p>
<ul>
<li><p>Content-Length: 21549 (I think that counts also the characters in the body)</p></li>
<li><p>Response code: 200</p></li>
<li><p>Response body: null</p></li>
</ul>
<p>What am I doing wrong?</p>
<p><strong>Edit</strong></p>
<p>My interface:</p>
<pre><code>public interface PhonebookContactAPI {
@Headers({
"Authorization: Basic xxxxxx",
"Accept: application/json; charset=UTF-8",
"Content-Type: application/json"
})
@POST("/db/data/transaction/commit")
Call<ResponseBody> get(@Body RequestBody body);
}
</code></pre>
<p>My request:</p>
<pre><code>String json = "{\"statements\": [{\"statement\": \"MATCH (n) RETURN n\"}]}";
Retrofit client = new Retrofit.Builder()
.baseUrl(Globals.BASE_CLIENT_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
PhonebookContactAPI service = client.create(PhonebookContactAPI.class);
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json);
Call<ResponseBody> call = service.get(body);
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Log.d("Call request", call.request().toString());
Log.d("Call request header", call.request().headers().toString());
Log.d("Response raw header", response.headers().toString());
Log.d("Response raw", String.valueOf(response.raw().body()));
Log.d("Response code", String.valueOf(response.code()));
if(response.isSuccessful()) {
Log.d("Response body", new Gson().toJson(response.body()));
}
else {
Log.d("Response errorBody", String.valueOf(response.errorBody()));
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.d("onFailure", t.toString());
}
});
</code></pre>
| 0 |
Open app on firebase notification received (FCM)
|
<p>I want to open application automatically when notification is received, is this possible with Firebase and new FCM notifications?</p>
<p>I know I can set click_action but that's only for customizing which activity will start on notification click, I need something that will start automatically when notification is received.</p>
<p>I tried the quick start messaging firebase sample and there is a onMessageReceived() method but it only works if the app is in foreground. Is there something that will execute while app is in background as well?
GCM could do something like what I want here by directly starting activity intent from broadcast receiver which is called when notification is received.</p>
| 0 |
Calling of a VOID function in C
|
<p>I have a small problem with a code I'm writing.
I have to use a void function to print the content of a matrix and a normal array side by side. The problem is that I have no idea how to call for the function in the MAIN function so it can be printed.</p>
<p>I've tried to assign it to a variable but then I get the <strong>void value not ignored as it ought to be</strong> . Calling for the function alone doesn't work as well. At the moment I'm clueless about how can I use a VOID function in the Main.</p>
<p>This is the function that I have to print.
The calling in MAIN is inside a switch case.</p>
<pre><code>void print_all(char warehouse[][M], float price[], int n)
{
printf("\n\n");
int m=0, p=0;
for (m=0; m<n; m++)
{
for (p=0; p<M; p++)
{
printf("%c TEST", warehouse[m][p]);
}
printf(" %.2f Euros\n", price[m]);
}
}
</code></pre>
| 0 |
Caffe error Cannot copy param 0 weights from layer, shape mismatch
|
<p>I am getting following error while running test app. (when I am using trained model with my test application)</p>
<pre><code>F0518 18:21:13.978204 13437 net.cpp:766] Cannot copy param 0 weights from layer 'fc6'; shape mismatch. Source param shape is 4096 2304 (9437184); target param shape is 4096 9216 (37748736). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.
*** Check failure stack trace: ***
Aborted (core dumped)
</code></pre>
<p>Can anybody tell the reason for this ?</p>
<hr>
<p>deploy.prototxt</p>
<hr>
<pre><code>name: "CaffeNet"
layer {
name: "data"
type: "Input"
top: "data"
input_param { shape: { dim: 10 dim: 3 dim: 227 dim: 227 } }
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "norm1"
type: "LRN"
bottom: "pool1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "norm1"
top: "conv2"
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "norm2"
type: "LRN"
bottom: "pool2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "norm2"
top: "conv3"
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "conv4"
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
}
}
layer {
name: "relu4"
type: "ReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
}
}
layer {
name: "relu5"
type: "ReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "fc6"
type: "InnerProduct"
bottom: "pool5"
top: "fc6"
inner_product_param {
num_output: 4096
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc6"
top: "fc6"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7"
type: "InnerProduct"
bottom: "fc6"
top: "fc7"
inner_product_param {
num_output: 4096
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "fc7"
top: "fc7"
}
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8"
type: "InnerProduct"
bottom: "fc7"
top: "fc8"
inner_product_param {
num_output: 2
}
}
layer {
name: "prob"
type: "Softmax"
bottom: "fc8"
top: "prob"
}
</code></pre>
<hr>
<p>train_val.prototxt</p>
<hr>
<pre><code>name: "CaffeNet"
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: true
crop_size: 256
mean_file: "data/lmvhmv/imagenet_mean.binaryproto"
}
# mean pixel / channel-wise mean instead of mean image
# transform_param {
# crop_size: 126
# mean_value: 104
# mean_value: 117
# mean_value: 123
# mirror: true
# }
data_param {
source: "examples/imagenet/lmvhmv1_train_lmdb"
batch_size: 10
backend: LMDB
}
}
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mirror: false
crop_size: 256
mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
}
# mean pixel / channel-wise mean instead of mean image
# transform_param {
# crop_size: 256
# mean_value: 104
# mean_value: 117
# mean_value: 123
# mirror: true
# }
data_param {
source: "examples/imagenet/lmvhmv1_test_lmdb"
batch_size: 10
backend: LMDB
}
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 96
kernel_size: 11
stride: 4
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1"
top: "conv1"
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "norm1"
type: "LRN"
bottom: "pool1"
top: "norm1"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv2"
type: "Convolution"
bottom: "norm1"
top: "conv2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 2
kernel_size: 5
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "norm2"
type: "LRN"
bottom: "pool2"
top: "norm2"
lrn_param {
local_size: 5
alpha: 0.0001
beta: 0.75
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "norm2"
top: "conv3"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "conv4"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 384
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu4"
type: "ReLU"
bottom: "conv4"
top: "conv4"
}
layer {
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
group: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu5"
type: "ReLU"
bottom: "conv5"
top: "conv5"
}
layer {
name: "pool5"
type: "Pooling"
bottom: "conv5"
top: "pool5"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "fc6"
type: "InnerProduct"
bottom: "pool5"
top: "fc6"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu6"
type: "ReLU"
bottom: "fc6"
top: "fc6"
}
layer {
name: "drop6"
type: "Dropout"
bottom: "fc6"
top: "fc6"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc7"
type: "InnerProduct"
bottom: "fc6"
top: "fc7"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 4096
weight_filler {
type: "gaussian"
std: 0.005
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "relu7"
type: "ReLU"
bottom: "fc7"
top: "fc7"
}
layer {
name: "drop7"
type: "Dropout"
bottom: "fc7"
top: "fc7"
dropout_param {
dropout_ratio: 0.5
}
}
layer {
name: "fc8"
type: "InnerProduct"
bottom: "fc7"
top: "fc8"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 2
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 1
}
}
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "fc8"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "fc8"
bottom: "label"
top: "loss"
}
</code></pre>
| 0 |
Container command '/start.sh' not found or does not exist, entrypoint to container is shell script
|
<p>Project contents:</p>
<pre><code>rob@work:~/git/proj $ ls
lib node_modules props.json start.sh
app.js Dockerfile package.json README.md
</code></pre>
<p><code>start.sh</code> ..</p>
<pre><code>rob@work:~/git/proj $ cat start.sh
#/bin/bash
# do things
/some/other/stuff
echo "Starting app .."
node app.js
</code></pre>
<p><code>Dockerfile</code> ..</p>
<pre><code>FROM somewhere.com/dependencyProj
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
COPY props.json /etc/someService.d/props.json
EXPOSE 4101
ENTRYPOINT ["/start.sh"]
</code></pre>
<p>Build docker image:</p>
<pre><code>rob@work:~/git/proj $ docker build -t dx/proj:0.0.1 .
Sending build context to Docker daemon 59.99 MB
Step 1 : FROM somewhere.com/dependencyProj
latest: Pulling from dependencyProj
420890c9e918: Already exists
8ff1af46fe3d: Already exists
6db3a1c6f4ca: Already exists
d82a90c4ea1b: Already exists
f32685681727: Already exists
797dfb291196: Already exists
3a713b0b523e: Already exists
a9c617bff63b: Already exists
9ab84732ac6e: Already exists
2a85e0afdd4d: Already exists
a56b24146ce4: Already exists
0a91b00da1f7: Already exists
836b0e7c1105: Already exists
Digest: sha256:36b7a32bd12b85cbb2fb3203d43807c9b8735d6ceb50d813b76bfe2e5c3ebeb4
Status: Downloaded newer image for somewhere.com/dependencyProj:latest
---> 7c52bbbc3feb
Step 2 : RUN mkdir -p /usr/src/app
---> Running in aab7cf1f7974
---> 250317f63adf
Removing intermediate container aab7cf1f7974
Step 3 : WORKDIR /usr/src/app
---> Running in f60088532610
---> 60f3d9fe88c4
Removing intermediate container f60088532610
Step 4 : COPY . /usr/src/app
---> 004e0a440fb5
Removing intermediate container f247d134d88b
Step 5 : COPY props.json /etc/someService.d/props.json
---> 03b48249c94c
Removing intermediate container a3636849765d
Step 6 : EXPOSE 4101
---> Running in 0056e5c20264
---> 867765176927
Removing intermediate container 0056e5c20264
Step 7 : ENTRYPOINT /start.sh
---> Running in 80ae316b0629
---> d1e65def77ce
Removing intermediate container 80ae316b0629
Successfully built d1e65def77ce
</code></pre>
<p>Run docker image:</p>
<pre><code>rob@work:~/git/proj $ docker run -d dx/proj:0.0.1
0fd1f8087cc5be3e085454cf99b7a3795b9ce15909b0f416ae39380f93feaa44
docker: Error response from daemon: Container command '/start.sh' not found or does not exist..
</code></pre>
| 0 |
How to install mcrypt extension in xampp
|
<p>how to install mcrypt in xampp on windows?</p>
<p>My PHP Version 7.0.5 and xampp pack have not <strong>mcrypt</strong> <strong>extension</strong> so how can i install mcrypt on xampp ? </p>
| 0 |
Windows 10 and Unable to find vcvarsall.bat
|
<p>When I try to build one package:</p>
<pre><code>C:\Linter\intlib\PYTHON>python setup.py build
</code></pre>
<p>I get this error message:</p>
<blockquote>
<p>running build</p>
<p>running build_ext</p>
<p>building 'LinPy' extension</p>
<p>error: Unable to find vcvarsall.bat</p>
</blockquote>
<p>This is my Python version:</p>
<blockquote>
<p>Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32</p>
</blockquote>
<p>And I'm working on Windows 10 x64. I know about <a href="https://stackoverflow.com/questions/27670365/python-pip-install-error-unable-to-find-vcvarsall-bat-tried-all-solutions">this</a> thread and dozens of others (like <a href="https://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat">this</a> and <a href="https://stackoverflow.com/questions/2676763/what-version-of-visual-studio-is-python-on-my-computer-compiled-with/">this</a> and the list goes on). So, I guess I tried almost everything, but nothing works. It seems like all those threads have become outdated, so I need some new receipt. BTW. I tried this:</p>
<pre><code>SET VS90COMNTOOLS=%VS100COMNTOOLS%
</code></pre>
<p>And this (in Visual Studio 2015 Visual Studio Command Prompt):</p>
<pre><code>set DISTUTILS_USE_SDK=1
</code></pre>
<p>I looked for <code>vcvarsall.bat</code> everywhere on my machine, but could not find it.</p>
<p>I investigated this folder <code>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools</code>, but it does not contain any <code>.bat</code> files. Anyway, after all my manipulations <code>python setup.py build</code> still raises the very same error. So, I need help. Thanks!</p>
| 0 |
try/catch/finally masks Jenkinsfile problems in case of groovy compiler exceptions
|
<p>I have code similar to the one below in my Jenkinsfile:</p>
<pre><code>node {
checkout scm
// do some stuff
try {
// do some maven magic
} catch (error) {
stage "Cleanup after fail"
emailext attachLog: true, body: "Build failed (see ${env.BUILD_URL}): ${error}", subject: "[JENKINS] ${env.JOB_NAME} failed", to: '[email protected]'
throw error
} finally {
step $class: 'JUnitResultArchiver', testResults: '**/TEST-*.xml'
}
}
</code></pre>
<p>If the above code fails because of some jenkins-pipeline related errors in the <code>try { }</code> (e.g. using unapproved static method) the script fails silently. When I remove the try/catch/finally I can see the errors.
Am I doing something wrong? Shouldn't rethrowing <code>error</code> make the pipeline errors appear in the log?</p>
<p>EDIT:
I've managed to nail down the problem to groovy syntax, when e.g. I use a variable that hasn't been assigned yet.
Example:
<code>
echo foo
</code>
If <code>foo</code> is not declared/assigned anywhere Jenkins will fail the build and won't show the reason if it is inside the try/catch/finally which rethrows the exception.</p>
| 0 |
How do I override a function of a python library?
|
<p>I am using a python library where I need to override one of the functions. Let's call this <code>module.py</code>:</p>
<pre><code>def dump(nodes, args = 'bleh' ):
...validation checks
for node in nodes:
print(node, someother_args)
def print_node(node, someother_args):
...prints in some way i don't want
</code></pre>
<p>Now, I am using this <code>dump</code> method and I want to override the <code>print_node</code> function with my own <code>print_node</code> method because I want to print it in different way. What is the best way to do that?</p>
| 0 |
permission denied in linux when creating a new user
|
<p>I am new in linux and I was trying to do some commands in terminal. My problem is that when I do su to another user, and I want to create a directory there, it shows me that permission is denied. Please, help me to understand why this happens and what can I do to solve it. </p>
<pre><code>user@user_VB:~$ sudo su
root@user_VB:~$ useradd user1
root@user_VB:~$ groupadd students
root@user_VB:~$ usermod -g people user1
root@user_VB:~$ su user1
user1@user_VB:~$ mkdir exams
</code></pre>
<p>Now it shows:</p>
<blockquote>
<p>permission denied.</p>
</blockquote>
<p>But if I type this: </p>
<pre><code>user1@user_VB:~$ sudo mkdir exams
</code></pre>
<p>It shows:</p>
<blockquote>
<p>user1 is not in suboers file.</p>
</blockquote>
| 0 |
Why cannot Apache handle multiple requests at the same time?
|
<p>I have AMPPS installed.</p>
<p>My Apache server cannot handle multiple php requests at once (for example if I call <code>localhost/script.php</code> multiple times, they are processed in a consecutive order). <code>script.php</code> consists only of <code><?php sleep(10); ?></code>.</p>
<p>I read that <a href="http://httpd.apache.org/docs/2.0/mod/mpm_common.html#maxclients" rel="noreferrer">MaxClients</a> directive is responsible for concurrent access configuration, but it is missing in my <code>httpd.conf</code> at all.</p>
<p>Disabling Xdebug and writing <code>session_write_close();</code> to the beginning of the script didn't work.</p>
<p>When I added <code>session_start();</code> to the beginning of the file and my code looked like:</p>
<pre><code><?php
session_start();
session_write_close();
sleep(10);
phpinfo();
echo "Done";
</code></pre>
<p>When making 5 requests to <code>localhost/script.php</code>, last 4 waited for the first one to end and then ended concurrently.</p>
<p>Please, help me resolve the issue. If any information that is needed to help me resolve this problem is missing, please notify and I will add it.</p>
| 0 |
Unchecked or unsafe operations at ObjectInputStream
|
<p>I'm getting a "Unchecked or unsafe operations" error at this method:</p>
<pre><code>public static MyClass initApp(){
MyClass obj = new MyClass();
try{
ObjectInputStream oin =
new ObjectInputStream(new FileInputStream("file.dat"));
obj.setSomeList ( (Map<String,MyOtherClass>) oin.readObject()); //error line
}catch(IOException e)
{ System.out.println(e.getMessage()); }
catch(ClassNotFoundException e)
{ System.out.println(e.getMessage()); }
return obj;
}
</code></pre>
<p>Isn't Map the most abstract as possible in this case? How can I solve this? </p>
<p>Method setSomeList (NOTE! It is placed in another class! If that helps):</p>
<pre><code>public void setSomeList(Map<String,MyOtherClass> l){
for(Map.Entry<String,MyOtherClass> entrada : l.entrySet())
someList.put(entrada.getKey(),entrada.getValue().clone());
}
</code></pre>
| 0 |
Count the number of times a same value appears in a javascript array
|
<p>I would like to know if there is a native javascript code that does the same thing as this:</p>
<pre><code>function f(array,value){
var n = 0;
for(i = 0; i < array.length; i++){
if(array[i] == value){n++}
}
return n;
}
</code></pre>
| 0 |
How to fetch core data relationships in one single NSFetchRequest?
|
<p>I have a core data app with the model setup just like the image below:</p>
<p><a href="https://i.stack.imgur.com/pPHw8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pPHw8.png" alt="Core Data Model"></a></p>
<p>The relationships are setup like this:</p>
<p>Category<-->>Subcategory<-->>Item</p>
<p>Now, is it possible in one single fetch to get objects from Subcategory and Item entities that have the same attribute called categoryName? I think it can be done by using relationships, but the code I am using is not working which is:</p>
<pre><code>let fetchNote = NSFetchRequest(entityName: "Category")
fetchNote.predicate = NSPredicate(format: "ANY subcategory.name == %@ AND item.name == %@", "Badaue", "Badaue")
let notes = try! appDel.managedObjectContext.executeFetchRequest(fetchNote) as? [Category]
print(notes)
</code></pre>
| 0 |
"Fake hacker code" in html with css and js
|
<p>I found some code I wanted to test out. What am I missing here?
I don't have a lot of experience using JS and I am not sure if I'm missing something. I would be really happy if anyone is able to help!
Here is my html:</p>
<pre><code><html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link rel="stylesheet" type="text/css" href="spaced.css">
<link rel="shortcut icon" type="image/png" href="http://test.noa16.png"/>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300' rel='stylesheet' type='text/css'>
</head>
<body>
<p class="text" data-text="test text 010101101010101 lolol whatever"</p>
<script>
var printText = $('.text').data('text');
var contentArray = printText.split('/n');
$.each(contentArray, function(index, newLine) {
$('.text').append('<span style="display:block;" id="'+index+'"></span>');
var lineID = index;
var self = $(this);
setTimeout(function () {
$.each(self, function(index, chunk){
setTimeout(function () {
$('#'+lineID).append("<span>"+chunk+"</span>");
$('body, html').scrollTop($(document).height());
}, index*5);
});
}, index*100);
});
</script>
</body>
</html>
</code></pre>
<p>And this is my CSS:</p>
<pre><code>span {
min-width: 5px;
display: inline-block;
font-family: 'Source Sans Pro', sans-serif;
font-size: 0.85em;
letter-spacing: 1.5px;
color: #FFF;
}
body {
background: #111;
position: relative;
}
body, html {
height: 100%;
}
.text {
overflow: hidden;
height: auto;
}
</code></pre>
<p>Does anyone have any idea why this isn't working for me?</p>
| 0 |
Fatal error: call to a member function fetch_array() on boolean
|
<p>I am getting the error when trying to execute my php script:</p>
<blockquote>
<p>Fatal error: call to a member function fetch_array() on boolean in...</p>
</blockquote>
<p>The code in question is here:</p>
<pre><code>function backup()
{
global $mysqli;
$bup = "SELECT p.product_id, p.ean, p.image, p.model, p.status, p.price_sync, p.modified_by, p.date_modified, pd.name, pd.description, pd.language_id, pd.meta_description, pd.meta_keyword, pd.tag FROM oc_product p INNER JOIN oc_product_description pd ON p.product_id = pd.product_id";
$backup = $mysqli->query($bup);
$megainsert = "REPLACE INTO oc_product_backup(product_id, ean, image, model, status, price_sync, modified_by, date_modified, name, description, language_id, meta_description, meta_keyword, tag) VALUES ";
while($row = $backup->fetch_array(MYSQLI_ASSOC))
{
$product_id = $mysqli->real_escape_string($row['product_id']);
$ean = $mysqli->real_escape_string($row['ean']);
$image = $mysqli->real_escape_string($row['image']);
$model = $mysqli->real_escape_string($row['model']);
$name = $mysqli->real_escape_string($row['name']);
$description = $mysqli->real_escape_string($row['description']);
$meta_description = $mysqli->real_escape_string($row['meta_description']);
$meta_keyword = $mysqli->real_escape_string($row['meta_keyword']);
$tag = $mysqli->real_escape_string($row['tag']);
$megainsert .= "('".$product_id."', '".$ean."', '".$image."', '".$model."', '".$row['status']."', '".$row['price_sync']."', '".$row['modified_by']."', '".$row['date_modified']."', '".$name."', '".$description."', '".$row['language_id']."', '".$meta_description."', '".$meta_keyword."', '".$tag."'),";
}
$backup->close();
$megainsert = substr_replace($megainsert, "", -1);
$dobackup = $mysqli->query($megainsert);
if(!$dobackup) return $mysqli->error;
else return true;
}
</code></pre>
<p>the following line is where the problem is:</p>
<pre><code>while($row = $backup->fetch_array(MYSQLI_ASSOC))
</code></pre>
<p>The code right before the function above is as follows:</p>
<pre><code> function clearBackupPrices()
{
global $mysqli;
$clean = "TRUNCATE TABLE oc_product_price_backup";
$doclean = $mysqli->query($clean);
if(!$doclean) return $mysqli->error;
else return true;
}
</code></pre>
| 0 |
Update a table of information on a button click
|
<p>I have a table which will select information from a database and display it, I'm wondering if anyone can provide a code for me to update a column on the click of a button?</p>
<p>Example Table: (Access=Boolean)</p>
<pre><code>ID - Name - Access
---------------------------
1 - John - 1
---------------------------
2 - Ben - 1
---------------------------
3 - Terry - 0
---------------------------
</code></pre>
<p>My exisiting button is based on bootstrap,</p>
<pre><code> <button type=\"button\" id=\"passed\" class=\"btn btn-success btn-flat\"><i class=\"fa fa-check\"></i></button>
<button type=\"button\" id=\"insufficient\" class=\"btn btn-danger btn-flat\"><i class=\"fa fa-times\"></i></button>
</code></pre>
<p>I was hoping for something like this, ONCLICK button1 Run $Allowed SQL
ONCLICK button2 Run $NotAllowed SQL</p>
<pre><code>$allowed = mysqli_query($conn," UPDATE users SET Access = "1" WHERE id = '27' ");
$notallowed = mysqli_query($conn," UPDATE users SET Access = "0" WHERE id = '453' ");
</code></pre>
| 0 |
Customize JavaFx Alert with css
|
<p>Searching in <strong>caspian.css</strong> I found that I can customize dialog-pane.Alert extends Dialog so I tried some of of these lines of code:</p>
<pre><code>.dialog-pane {
-fx-background-color: black;
-fx-padding: 0;
.....
}
.dialog-pane > .expandable-content {
-fx-padding: 0.666em; /* 8px */
.....
}
.dialog-pane > .button-bar > .container {
-fx-padding: 0.833em; /* 10px */
.....
}
.....
</code></pre>
<p>but nothing changes.</p>
<p><strong>Question:</strong>
How can I do that? I mean I want to customize the background, the buttons, the header and everything other.</p>
| 0 |
Breaking a String Across Multiple Lines
|
<p>I wrote a script which is connecting to an Oracle database to select multiple entries in a specific table.</p>
<p>The statement looks like this:</p>
<pre><code>rs.open "SELECT PATH301 FROM NC301B WHERE EDIPROC like 'P30_' AND (LF301M > 0) AND (PATH301 NOT LIKE '%saptemp%') AND (PATH301 NOT LIKE '%SAPTEMP%') AND (PATH301 NOT LIKE '%usr%') AND (PATH301 NOT LIKE '%Windows%');", cn, 3
</code></pre>
<p>Now I want to know if it is possible to split this statement over multiple lines. For example like this:</p>
<pre class="lang-none prettyprint-override"><code>rs.open "SELECT PATH301 FROM NC301B
WHERE EDIPROC like 'P30_'
AND (LF301M > 0)
AND (PATH301 NOT LIKE '%saptemp%')
AND (PATH301 NOT LIKE '%SAPTEMP%')
AND (PATH301 NOT LIKE '%usr%')
AND (PATH301 NOT LIKE '%Windows%');", cn, 3
</code></pre>
<p>That first <code>SELECT</code> Statement is way to big and not looking good at all.
I hope you understand what I mean.</p>
| 0 |
what is AC means in leetcode, is it algorithm technique like DP?
|
<p>I found from various online coding forums, there is a technique called "AC", which looks like "Dynamic Programming" or "Back tracking", but not sure what it is how to use.</p>
<p>Any one has suggestions?</p>
| 0 |
How to setup spring-boot to allow access to the webserver from outside IP addresses
|
<p>I have been looking into how to setup <code>tomcat</code> within <code>spring-boot</code> to allow access from outside IP addresses. Currently I can view the UI from locahost:port but I can not access this from other systems.</p>
<pre><code>http://localhost:8081
</code></pre>
<p>When I am logged into the local computer it works.</p>
<pre><code>http://192.168.0.93:8081
</code></pre>
<p>When I am logged into the local computer and try <a href="http://192.168.0.93:8081" rel="noreferrer">http://192.168.0.93:8081</a> it does not work.</p>
<p>I want to access the UI from another computer via its IP address it does not work.</p>
<pre><code>http://192.168.0.93:8081
</code></pre>
<p>When I got to <code>springs</code> documentation I found you can add the IP address on which you want tomcat to set the webserver for using server.address. This should then allow the server to be accessed via this IP address by outside systems.</p>
<pre><code>server.port=8082
server.address=192.168.0.93
</code></pre>
<p>The port works fine if I do not supply the address but when I supply the address and try to run it I run into an issue for binding to that address. It looks like <code>spring-boot</code> has already assigned locahost:8082.</p>
<h1>Question:</h1>
<p>How do I correctly setup <code>spring-boot</code> to allow tomact to be accessed by outside addresses and recognize its own IP when accessed locally?</p>
<p>Thank you</p>
<h1>Stack Trace:</h1>
<pre><code>java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:765)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:473)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:239)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:194)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:151)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.miw.mcb.server.ReactAndSpringDataRestApplication.main(ReactAndSpringDataRestApplication.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
at java.lang.Thread.run(Thread.java:745)
2016-05-25 11:24:30 - Failed to start connector [Connector[HTTP/1.1-8081]]
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8081]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:239)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:194)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:151)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.miw.mcb.server.ReactAndSpringDataRestApplication.main(ReactAndSpringDataRestApplication.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:993)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 19 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:340)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:765)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:473)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
... 20 common frames omitted
2016-05-25 11:24:30 - Pausing ProtocolHandler ["http-nio-192.168.0.93-8081"]
2016-05-25 11:24:30 - Stopping service Tomcat
2016-05-25 11:24:30 - The stop() method was called on component [StandardServer[-1]] after stop() had already been called. The second call will be ignored.
2016-05-25 11:24:30 - Stopping ProtocolHandler ["http-nio-192.168.0.93-8081"]
2016-05-25 11:24:30 - Destroying ProtocolHandler ["http-nio-192.168.0.93-8081"]
2016-05-25 11:24:30 - Application startup failed
org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat servlet container
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:165)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at com.miw.mcb.server.ReactAndSpringDataRestApplication.main(ReactAndSpringDataRestApplication.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:159)
... 16 common frames omitted
</code></pre>
| 0 |
Typescript complains Property does not exist on type 'JSX.IntrinsicElements' when using React.createClass?
|
<p>I am using typescript to write redux application.</p>
<pre><code>var item = React.createClass({
render: function() {
return (<div>hello world</div>)
}
});
export default class ItemList extends Component<any, any> {
render() {
return (<item />)
}
}
</code></pre>
<p>Then typescript complains this:</p>
<pre><code>Property 'item' does not exist on type 'JSX.IntrinsicElements'.
</code></pre>
| 0 |
Multiple download links to one zip file before download javascript
|
<p>Is it possible, in javascript, to have multiple download urls sent into one zip file and that zip file can be downloaded. So pretty much, on my web page, there is one button, that when clicked downloads a zip file of all the files from the download urls compressed into the zip?</p>
<p>I believe I'd need to use jszip or some tool like that. Is this at all possible and is there any advice on where to start?</p>
| 0 |
APNS Firebase Notification failed to fetch token
|
<p><strong>For Swift3 / iOS10 see this link:</strong></p>
<p><a href="https://stackoverflow.com/questions/39729249/ios10-swift-3-and-firebase-push-notifications-fcm">ios10, Swift 3 and Firebase Push Notifications (FCM)</a></p>
<p>I'm trying to use the Firebase for Notifications and I integrated it exactly as described in the docs.
But I don't understand why is doesn't work. When I build my project I see this line: </p>
<pre><code>2016-05-25 16:09:34.987: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
</code></pre>
<p>This my AppDelegate:</p>
<pre><code> func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true
var service: DataService = DataService()
service.start()
registerForPushNotifications(application)
application.registerForRemoteNotifications()
return true
}
func registerForPushNotifications(application: UIApplication) {
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
}
func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {
if notificationSettings.types != .None {
application.registerForRemoteNotifications()
}
}
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)
var tokenString = ""
for i in 0..<deviceToken.length {
tokenString += String(format: "%02.2hhx", arguments: [tokenChars[i]])
}
FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Unknown)
print("Device Token:", tokenString)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
// Print message ID.
print("Message ID: \(userInfo["gcm.message_id"]!)")
// Print full message.
print("%@", userInfo)
}
</code></pre>
| 0 |
How to justify text in a label
|
<p>I have a label that displays on more than a line and I would like to justify the text in it (align left and right). What is the best way to achieve that?</p>
| 0 |
Xcode 7 simulator error "duplicate symbols for architecture x86_64"
|
<p>My development environment with <code>Xcode 7.2.1</code>, <code>CocoaPods 1.0.0</code> and <code>GoogleMaps 1.13.2</code></p>
<p>I can build code successful to generate a XXX.ipa file and install in my iPhone 6 Plus to work correctly.</p>
<p>But when I run Xcode simulator by item "iPhone 6" or "iPhone 6 Plus" always get the information as below</p>
<blockquote>
<p>"xxxx duplicate symbols for architecture x86_64" "linker command
failed with exit code 1 (use -v to see invocation)"</p>
</blockquote>
<p>I use the following solutions still can't fix it</p>
<ol>
<li><p>Build Options -> Enable Bitcode -> set "No"</p></li>
<li><p>Remove -ObjC from Other Linker Flags</p></li>
<li><p>project Targer -> Build phases -> compile sources, ckeck no duplicate files</p></li>
<li><p>Make sure I haven't #imported a .m file</p></li>
</ol>
<p>I am wondering if there are any other method to solve this, help would be appreciated thanks.</p>
| 0 |
React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
|
<p>I want to fetch my Json file in react js, for this I am using <code>fetch</code>. But it shows an error </p>
<p><code>Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0</code></p>
<p>What could be the error, i am getting no clue. I even validated my JSON.</p>
<pre><code>handleGetJson(){
console.log("inside handleGetJson");
fetch(`./fr.json`)
.then((response) => response.json())
.then((messages) => {console.log("messages");});
}
</code></pre>
<p>My Json (fr.json)</p>
<pre><code>{
"greeting1": "(fr)choose an emoticon",
"addPhoto1": "(fr)add photo",
"close1": "(fr)close"
}
</code></pre>
| 0 |
What are the main differences between Babel and TypeScript
|
<p>I know that TypeScript was used to write Angular2, which probably makes it a better choice for someone who wants to get into Angular2, but when I look at Babel it looks very much like TypeScript. </p>
<p>I noticed that many well known companies stick to Babel. </p>
<p>Some questions:</p>
<ol>
<li>What advantages do they have over each other? </li>
<li>Which make them better or worse choice for the project/developer?</li>
<li>What are the major differences between them and what make them unique?</li>
</ol>
| 0 |
firebase.auth().createUserWithEmailAndPassword Undefined is not a function
|
<p>I am following the firebase documentation on user management</p>
<pre><code>var firebase = require('firebase');
// Initialize Firebase
firebase.initializeApp({
serviceAccount: "./<mysecreturledittedout>.json",
databaseURL: "https://<mydatabaseurljusttobesafe>.firebaseio.com"
});
router.get('/create', function(req, res){
var email = req.email;
var password = req.password;
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(err){ // LINE 27 CRASH
var errorCode = err.code;
var errorMessage = error.message;
console.log("ERROR");
console.log(errorCode, errorMessage);
});
});
</code></pre>
<p>I get the following error</p>
<pre><code>undefined is not a function
TypeError: undefined is not a function
at d:\Users\Kitty\Code\Practice2\routes\index.js:27:21
</code></pre>
<p>From doing a little bit of research, I think undefined is not a function is basically a javascript version of a null pointer exception (could be wrong)</p>
<p>I have configured my service account and project on firebase. I am running this on localhost. Thanks. I am looking primarily for debugging tips, as I'm not sure how to test what isn't working.</p>
| 0 |
MemoryError when creating a very large numpy array
|
<p>I'm trying to create a very large numpy array of zeros and then copy values from another array into the large array of zeros. I am using Pycharm and I keep getting: <code>MemoryError</code> even when I try and only create the array. Here is how I've tried to create the array of zeros:</p>
<pre><code>import numpy as np
last_array = np.zeros((211148,211148))
</code></pre>
<p>I've tried increasing the memory heap in Pycharm from 750m to 1024m as per this question: <a href="https://superuser.com/questions/919204/how-can-i-increase-the-memory-heap-in-pycharm">https://superuser.com/questions/919204/how-can-i-increase-the-memory-heap-in-pycharm</a>, but that doesn't seem to help. </p>
<p>Let me know if you'd like any further clarification. Thanks!</p>
| 0 |
Key Error when key is in dictionary
|
<p>Just trying to pull some lat/lon info from EXIF data on a bunch of photos, but code is throwing a <code>KeyError</code> even though that key is used (successfully) later on to print specific coordinates. </p>
<p>Dictionary in question is "<code>tags</code>" - <code>'GPS GPSLatitude'</code> and <code>'GPS GPSLongitude'</code> are both keys in <code>tags.keys()</code>; I've triple checked.</p>
<p>So any intuition on why <code>tags['GPS GPSLatitude']</code> & <code>tags['GPS GPSLongitude']</code> are throwing key errors?</p>
<pre><code>import os
import exifread
output = dict()
output['name'] = []
output['lon'] = []
output['lat'] = []
for file in os.listdir(path):
if file.endswith(".JPG"):
full_path = path + file
print (file) #check to ensure all files were found
output['name'].append(file) #append photo name to dictionary
f = open(full_path, 'rb') #open photo
tags = exifread.process_file(f) #read exifdata
# lon = tags['GPS GPSLongitude'] #this + next line = one method
# output['lon'].append(lon)
# output['lat'].append(tags['GPS GPSLatitude']) # = cleaner second method
for tag in tags.keys():
if tag in ('GPS GPSLongitude','GPS GPSLatitude'):
print ("Key: %s, value %s" % (tag, tags[tag])) #successfully prints lat/lon coords with 'GPS GPSLongitude' and 'GPS GPSLatitude' as keys
</code></pre>
<p>UPDATE:</p>
<p>Here's the output of <code>print (tags.keys())</code> -- you'll see <code>GPS GPSLatitude</code> and <code>GPS GPSLongitude</code> in there. Also, have manually checked all the photos in the subset I'm using have GPS data.</p>
<p><code>dict_keys(['GPS GPSImgDirection', 'EXIF SceneType', 'MakerNote Tag 0x0006', 'GPS GPSDestBearing', 'Thumbnail XResolution', 'EXIF BrightnessValue', 'GPS GPSAltitude', 'GPS GPSLongitude', 'EXIF LensSpecification', 'GPS GPSAltitudeRef', 'GPS GPSSpeedRef', 'GPS GPSDestBearingRef', 'EXIF WhiteBalance', 'Thumbnail ResolutionUnit', 'EXIF FocalLengthIn35mmFilm', 'EXIF SceneCaptureType', 'Image Model', 'MakerNote Tag 0x0008', 'Image Make', 'EXIF ShutterSpeedValue', 'MakerNote Tag 0x0007', 'EXIF ExifImageWidth', 'EXIF LensModel', 'Image YResolution', 'EXIF ComponentsConfiguration', 'Image GPSInfo', 'EXIF ISOSpeedRatings', 'EXIF ExposureMode', 'EXIF Flash', 'EXIF FlashPixVersion', 'GPS GPSLatitudeRef', 'EXIF ExposureBiasValue', 'Thumbnail JPEGInterchangeFormatLength', 'Thumbnail Compression', 'Image YCbCrPositioning', 'EXIF MakerNote', 'EXIF FNumber', 'JPEGThumbnail', 'MakerNote Tag 0x0001', 'EXIF ColorSpace', 'EXIF SubSecTimeDigitized', 'Thumbnail JPEGInterchangeFormat', 'MakerNote Tag 0x0004', 'EXIF SubjectArea', 'Image ResolutionUnit', 'EXIF SensingMethod', 'Image DateTime', 'Image Orientation', 'EXIF ExifVersion', 'Image ExifOffset', 'GPS GPSImgDirectionRef', 'MakerNote Tag 0x0014', 'Thumbnail YResolution', 'EXIF DateTimeOriginal', 'MakerNote Tag 0x0005', 'EXIF LensMake', 'EXIF DateTimeDigitized', 'MakerNote Tag 0x0003', 'GPS GPSTimeStamp', 'EXIF ExposureTime', 'GPS Tag 0x001F', 'EXIF SubSecTimeOriginal', 'GPS GPSLatitude', 'Image Software', 'EXIF ApertureValue', 'GPS GPSDate', 'EXIF ExposureProgram', 'GPS GPSSpeed', 'EXIF ExifImageLength', 'EXIF MeteringMode', 'GPS GPSLongitudeRef', 'EXIF FocalLength', 'Image XResolution'])</code></p>
<p>Traceback</p>
<pre><code>---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-14-949ba89a1248> in <module>()
16 # lon = tags["GPS GPSLongitude"]
17 # output['lon'].append(lon)
---> 18 output['lat'].append(tags['GPS GPSLatitude'])
19 for tag in tags.keys():
20 if tag in ('GPS GPSLongitude','GPS GPSLatitude'):
KeyError: 'GPS GPSLatitude'
</code></pre>
<p>Link to photo: <a href="https://drive.google.com/a/cornell.edu/file/d/0B1DwcbbAH1yuTEs0cUhhODdlNnc/view]" rel="nofollow">https://drive.google.com/a/cornell.edu/file/d/0B1DwcbbAH1yuTEs0cUhhODdlNnc/view</a></p>
<p>Output of the print statement for this photo</p>
<pre><code>IMG_6680.JPG
Key: GPS GPSLongitude, value [76, 29, 353/20]
Key: GPS GPSLatitude, value [42, 26, 5069/100]
</code></pre>
| 0 |
How can I send data/text from PHP using WebSocket to process?
|
<p>I have process on server which acts as WebSocket server (not written in Ratchet). I want to be able to send data to this process using PHP (as client).</p>
<p>I found a lot of examples to send as TCP like this:</p>
<pre><code><?php
$addr = gethostbyname("localhost");
$client = stream_socket_client("tcp://$addr:8887", $errno, $errorMessage);
if ($client === false) {
throw new UnexpectedValueException("Failed to connect: $errorMessage");
}
fwrite($client, "GET / HTTP/1.0\r\nHost: localhost\r\nAccept: */*\r\n\r\n");
echo stream_get_contents($client);
?>
</code></pre>
<p>All I need I to send message to the process and close the connection. The result that I expect is the result from the webSocket will be later printed or "echo" to the PHP page.</p>
<p>Is there a way to make it work with <strong>curl</strong> in php?</p>
| 0 |
How to convert int to decimal in .net
|
<p>How to convert <code>int</code> to <code>decimal</code>
Example : convert 12 to 12.0</p>
<p>I tried below but to luck</p>
<pre><code>int i = 10;
Decimal newValue = Decimal.parse(i)
</code></pre>
<p>and</p>
<pre><code>Decimal newValue = Convert.ToDecimal(i)
</code></pre>
| 0 |
PostgreSQL - ERROR: column does not exist SQL state: 42703
|
<p>I am trying to do a cohort analysis and compare average number of rentals based on the renter's first rental year(= the year where a renter rented first time). Basically, I am asking the question: are we retaining renters whose first year renting was 2013 than renters whose first year was 2015? </p>
<p>Here is my code:</p>
<pre><code>SELECT renter_id,
Min(Date_part('year', created_at)) AS first_rental_year,
( Count(trip_finish) ) AS number_of_trips
FROM bookings
WHERE state IN ( 'approved', 'aboard', 'ashore', 'concluded', 'disputed' )
AND first_rental_year = 2013
GROUP BY 1
ORDER BY 1;
</code></pre>
<p>The error message I get is:</p>
<pre><code>ERROR: column "first_rental_year" does not exist
LINE 6: ... 'aboard', 'ashore', 'concluded', 'disputed') AND first_rent...
^
********** Error **********
ERROR: column "first_rental_year" does not exist
SQL state: 42703
Character: 208
</code></pre>
<p>Any help is much appreciated. </p>
| 0 |
How to convert array to string in codeigniter?
|
<p>I am new to PHP.</p>
<p>I want to convert this array; </p>
<pre><code>array(2) {
[0]=> object(stdClass)#24 (1) {
["item"]=> string(1) "2"
}
[1]=> object(stdClass)#25 (1) {
["item"]=> string(1) "1"
}
}
</code></pre>
<p>to string like this </p>
<p><code>string(1) "2", string(2)"1", string(3)"0"</code>...</p>
<p>What is the way to do this?</p>
<p>Note: i try add to "row()" in php code. but always single result.
for example: only <strong>string(1)"2"</strong></p>
| 0 |
Error: Status{statusCode=DEVELOPER_ERROR, resolution=null}
|
<p>I am usign gplus sign in, and getting this error at time I am in onActivityResult....</p>
<pre><code>@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
client.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
GoogleSignInAccount acct = result.getSignInAccount();
// Log.d("Result","details"+ acct.getDisplayName() + acct.getEmail());
mEmail = acct.getEmail();
String mFullName = acct.getDisplayName();
String mGoogleplusId = acct.getId();
SocialUser user = new SocialUser();
user.setType("googleplus");
user.setEmail(mEmail);
user.setFullname(mFullName);
user.setId(mGoogleplusId + "");
loginParams.put("email_id", mEmail);
loginParams.put("googlePlusId", mGoogleplusId);
loginParams.put("full_name", mFullName);
loginParams.put("registrationType", "googleplus");
SignUpService(user);
} else {
Toast.makeText(CustomerLogIn.this, "Unable to fetch data, Proceed manually", Toast.LENGTH_SHORT).show();
}
}
}
</code></pre>
<p>And I am calling for gplus login on button click. On clcking button following code is executed....</p>
<pre><code> GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(CustomerLogIn.this)
.addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
.build();
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, 0);
</code></pre>
<p>And I am geetng this error...</p>
<pre><code>Status{statusCode=DEVELOPER_ERROR, resolution=null}
</code></pre>
<p>on this line....</p>
<pre><code>GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
</code></pre>
<p>Please suggest the solution.</p>
| 0 |
Best practice in C++ for casting between number types
|
<p>What is the best practice for casting between the different number types? Types <code>float</code>, <code>double</code>, <code>int</code> are the ones I use the most in C++.</p>
<p>An example of the options where <code>f</code> is a <code>float</code> and <code>n</code> is a <code>double</code> or an <code>int</code>:</p>
<pre><code>float f = static_cast<float>(n);
float f = float(n);
float f = (float)n;
</code></pre>
<p>I usually write <code>static_cast<T>(...)</code> but wondered if there was any consensus within the C++ development community if there is a preferred way.</p>
<p>I appreciate this is may end up being an opinion based question and there may not be a "standard" way, in which case please let me know that there is no standard way so at least I know that :-)</p>
<p>I know this question has <a href="https://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-const-cast-and-reinterpret-cast-be-used">cropped up</a> in relation to casting in general, however, I am interested specifically in numbers and whether there are specific best practices in the approach for number types.</p>
| 0 |
Best incremental load method using SSIS with over 20 million records
|
<p><strong>What is needed</strong>: I'm needing 25 million records from oracle incrementally loaded to SQL Server 2012. It will need to have an UPDATE, DELETE, NEW RECORDS feature in the package. The oracle data source is always changing. </p>
<p><strong>What I have:</strong> I've done this many times before but not anything past 10 million records.First I have an [Execute SQL Task] that is set to grab the result set of the [Max Modified Date]. I then have a query that only pulls data from the [ORACLE SOURCE] > [Max Modified Date] and have that lookup against my destination table.</p>
<p>I have the the [ORACLE Source] connecting to the [Lookup-Destination table], the lookup is set to NO CACHE mode, I get errors if I use partial or full cache mode because I assume the [ORACLE Source] is always changing. The [Lookup] then connects to a [Conditional Split] where I would input an expression like the one below.</p>
<pre><code>(REPLACENULL(ORACLE.ID,"") != REPLACENULL(Lookup.ID,""))
|| (REPLACENULL(ORACLE.CASE_NUMBER,"")
!= REPLACENULL(ORACLE.CASE_NUMBER,""))
</code></pre>
<p>I would then have the rows that the [Conditional Split] outputs into a staging table. I then add a [Execute SQL Task] and perform an UPDATE to the DESTINATION-TABLE with the query below:</p>
<pre><code> UPDATE Destination
SET SD.CASE_NUMBER =UP.CASE_NUMBER,
SD.ID = UP.ID,
From Destination SD
JOIN STAGING.TABLE UP
ON UP.ID = SD.ID
</code></pre>
<p><strong>Problem:</strong> This becomes very slow and takes a very long time and it just keeps running. How can I improve the time and get it to work? Should I use a cache transformation? Should I use a merge statement instead? </p>
<p>How would I use the expression REPLACENULL in the conditional split when it is a data column? would I use something like :</p>
<pre><code>(REPLACENULL(ORACLE.LAST_MODIFIED_DATE,"01-01-1900 00:00:00.000")
!= REPLACENULL(Lookup.LAST_MODIFIED_DATE," 01-01-1900 00:00:00.000"))
</code></pre>
<p>PICTURES BELOW:</p>
<p><img src="https://i.stack.imgur.com/V5qWb.png" alt="Date Flow"></p>
<p><img src="https://i.stack.imgur.com/nIkwQ.png" alt="Control flow"></p>
| 0 |
How to install Memcached on windows 10 and Xampp
|
<p>I have tried to install Memcached on Xampp on a windows 10 machine but failed multiple times.</p>
<p>I have downloaded the relevant memcached.exe for my 64bit amd machine. I've also created the memcached service according to this: <a href="https://stackoverflow.com/questions/18226317/how-to-use-memcached-on-different-port/18228391#18228391">How to Use memcached on different port</a></p>
<p>I'm just not able to start memcached.</p>
<p>All help appreciated.</p>
| 0 |
Linux du command without traversing mounted file systems
|
<p>If the wording of the question is wrong, please let me know. It might explain why I can’t find an answer.</p>
<p>I want to find the usage on my main disk using a command like:</p>
<pre><code>du -sh /*
</code></pre>
<p>The problem is that I have a number of mount points at the root level, and I would like <code>du</code> to skip these.</p>
<p>I thought the <code>-x</code> option was supposed to do this, but either I misunderstand what it does or I’m using it the wrong way.</p>
<p>How can I apply <code>du</code> to only the root disk without traversing the additional mounts?</p>
<p>Thanks</p>
| 0 |
Get the name of a std::function
|
<p>In the following toy-example, I would like to get the name of a function. The function itself was given as an <code>std::function</code> argument. Is it possible in C++ to get name of a <code>std::function</code> object?</p>
<pre><code>void printName(std::function<void()> func){
//Need a function name()
std::cout << func.name();
}
void magic(){};
//somewhere in the code
printName(magic());
output: magic
</code></pre>
<p>Otherwise I would have to give the function's name as a second parameter.</p>
| 0 |
Flexbox not working properly on Firefox but okay on Chrome & Safari
|
<p>I'm building a website that relies heavily on flexbox. Only problem is that I cannot get it to mimic the chrome behaviour on Firefox. I looked on CSS-Tricks, SO and at this article (<a href="http://philipwalton.com/articles/normalizing-cross-browser-flexbox-bugs/" rel="noreferrer">http://philipwalton.com/articles/normalizing-cross-browser-flexbox-bugs/</a>)</p>
<p>All these were very nice and gave some good suggestions, none of which worked for me. I tried setting </p>
<pre><code>* {
min-height: 0;
min-width: 0;
}
</code></pre>
<p>And every variation on my child and parent elements, but to no avail. I have included a CodePen link that illustrates my problem. When opened in FF 37.0.2 AND 46.0.1, it is completely broken. In Chrome and Safari, it looks just fine.</p>
<pre class="lang-css prettyprint-override"><code>/* Header Styles */
#header{
width:85%;
margin:0 auto;
height:375px;
background-color:rgba(252,241,223, 1);
padding:25px 75px 25px 0;
font-family: 'Quattrocento Sans', sans-serif;
border-radius:3px 3px 0 0;
}
#header-logo{
width:33%;
height:100%;
display:flex;
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
align-items:center;
justify-content:center;
float:left;
}
#header-nav{
width:66%;
height:100%;
display:flex;
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
justify-content:center;
/* align-items:center;*/
flex-direction:column;
}
#header-nav-tabs{
margin-top:25px;
padding-top:25px;
border-top:1px solid rgba(0,0,0,0.5);
}
#header-nav-tabs a{
font-size: 20px;
color:black;
text-decoration:none;
margin:0 10px;
white-space: nowrap;
}
#header-nav-tabs a:hover{
text-decoration:underline;
}
@media screen and (max-width: 680px) {
#header{
height:auto;
text-align:center;
padding:25px;
display:flex;
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
flex-direction: column;
align-items: center;
}
#header-logo{
width:auto;
height:auto;
}
#header-nav{
width:auto;
height:auto;
}
#header-nav-tabs a{
font-size:17px;
}
}
</code></pre>
<pre class="lang-html prettyprint-override"><code><header id="header" role="banner">
<div id="header-logo">
<img src="http://staging.thestarvingsailor.ca/wp-content/uploads/2016/01/Moore-Logo.png" />
</div>
<div id="header-nav">
<div id="header-nav-title">
<h1>Test Site</h1>
<p>Description for the test site.</p>
</div>
<div id="header-nav-tabs">
<a href="http://www.moorefamilychiropractic.ca">Home</a>
<a href="http://www.moorefamilychiropractic.ca/about-us">About Us</a>
<a href="http://www.moorefamilychiropractic.ca/services">Services</a>
<a href="http://www.moorefamilychiropractic.ca/reviews">Reviews</a>
<a href="http://www.moorefamilychiropractic.ca/blog">Blog</a>
<a href="http://www.chirocorrection.com/moorechiro/" target="_blank" rel="noopener noreferrer">My ChiroCorrection</a>
<a href="http://www.moorefamilychiropractic.ca/how-can-chiropractic-help-me">How Can Chiropractic Help Me?</a>
<a href="http://www.moorefamilychiropractic.ca/contact-us">Contact Us</a>
</div>
</div>
</header>
</code></pre>
<p><a href="http://codepen.io/anon/pen/mPYZGY" rel="noreferrer">http://codepen.io/anon/pen/mPYZGY</a></p>
| 0 |
React: 'this.state' is undefined inside a component function
|
<p>I'm having trouble accessing <code>this.state</code> in functions inside my component. I already found <a href="https://stackoverflow.com/questions/33973648/react-this-is-undefined-inside-a-component-function">this</a> question on SO and added the suggested code to my constructor:</p>
<pre><code>class Game extends React.Component {
constructor(props){
super(props);
...
this.state = {uid: '', currentTable : '', currentRound : 10, deck : sortedDeck};
this.dealNewHand = this.dealNewHand.bind(this);
this.getCardsForRound = this.getCardsForRound.bind(this);
this.shuffle = this.shuffle.bind(this);
}
// error thrown in this function
dealNewHand(){
var allCardsForThisRound = this.getCardsForRound(this.state.currentRound);
}
getCardsForRound(cardsPerPerson){
var shuffledDeck = this.shuffle(sortedDeck);
var cardsForThisRound = [];
for(var i = 0; i < cardsPerPerson * 4; i++){
cardsForThisRound.push(shuffledDeck[i]);
}
return cardsForThisRound;
}
shuffle(array) {
...
}
...
...
</code></pre>
<p>It still does not work. <code>this.state.currentRound</code> is undefined. What is the problem?</p>
| 0 |
Using VBA how do I call up the Adobe Create PDF function
|
<pre><code> Sheets("Key Indicators").ExportAsFixedFormat Type:=xlTypePDF,
Filename:=ArchivePath, Quality:=xlQualityStandard,
IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
</code></pre>
<p>Currently this is what I have.</p>
<p>I understand how to ExportAsFixedFormat PDF but what I need to know how to do is to access the Create PDF function under Acrobat (As show in the picture below) using VBA. If I do ExportAsFixedFormat the links get flattened. Acrobat "Create PDF" would allow me to convert an Excel to PDF with hyperlinks included. </p>
<p><a href="https://i.stack.imgur.com/lzEXt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lzEXt.png" alt="AdobePDFMakerForOffice"></a></p>
<p>How would I do that?</p>
<p>I am using Excel 2016 and Adobe Pro DC </p>
<p><a href="https://i.stack.imgur.com/mmXeI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mmXeI.png" alt="enter image description here"></a>
These are my adobe references</p>
| 0 |
Finding Ten Digit Number using regex in notepad++
|
<p>I am trying to replace everything from a data dump and keep only the ten digit numbers from that dump using notepad++ regex.</p>
<p>Trying to do something like this <code>(?<!\d)0\d{7}(?!\d)</code> but no luck.</p>
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.