id
stringlengths
5
11
text
stringlengths
0
146k
title
stringclasses
1 value
doc_23537300
My app's Facebook login works fine on device. However, on iOS 9 simulator, I'm getting: -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)" And login is not working. I've seen facebook login issue - canOpenURL: failed for URL: "fbauth2:///" - error: "(null)" but I have FBSDKCoreKit framework. I've also seen Facebook SDK 4.5 IOS 9 but it's answer doesn't solve my problem. Why am I getting this error on simulator and not on device even though I've done the checklist at https://developers.facebook.com/docs/ios/ios9? A: This is not a problem. The FB SDK is trying to open the native facebook app which has the fbauth2:// url type. In Simulator its not available, so its just putting a log that it could not open the native Facebook app. You can configure the Facebook acct in Simulator and then tell the FB Login button to use the native Facebook account instead of opening the web view. But Facebook contends that millions of people use Facebook in browser and so in iOS 9 they have used the new SFSafariViewController as the default behaviour for facebook logins even on devices. You can try to use the native Facebook and see if it works. Check this link for the discussion. https://www.facebook.com/login.php?next=https%3A%2F%2Fdevelopers.facebook.com%2Fbugs%2F786729821439894%2F%3Fsearch_id A: After you have updated your App's .plist file with the LSApplicationQueriesSchemes array, which you seem to have already done: Next, verify that your Facebook SDK is version 4.6.0. Follow the Facebook directions if it's not. Lastly, which is probably where the problem arises, is to Reset your Simulator's content and settings To Reset your Simulator: * *Choose Simulator *Select Reset Content & Settings *and the Reset option Apple's Simulator, even the IDE, will have bugs and closing and reopening, along with reseting the simulator, are always something to consider early on in your search for a solution. Hope this helps! A: I downgraded my Facebook SDK from version 4.7 to 4.5.1 and worked fine on both Simulator and iphone device(without Facebook app installed). A: Why do I see console messages like 'canOpenURL: failed for URL: "fb...://' or ? This is an Xcode warning indicating the the canOpenURL: call returned false. As long as you have configured the LSApplicationQueriesSchemes entry in your plist as described above, you can ignore this warning. A: According to Facebook: iOS SDK supports SafariViewController which lets us switch show web-rendered dialogs instead of doing an app-switch. This beta SDK will automatically determine the best app switch experience for people based on their device. For example, defaulting the person's experience through SafariViewController instead of Safari for Facebook Login.... Facebook reference link: https://developers.facebook.com/bugs/786729821439894/?search_id Stack ref link: https://stackoverflow.com/a/32593070/2905967 A: By following these steps, you may be able to avoid this error: 1) go to -> Supporting File 2) info.plist 3) Right click on info.plist -> Open As -> Select Source Code * Add code below inside <dict>...</dict> * <key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array> A: 1] Authentication in Developer.facebook and generate Facebook Id like :=>460481580805052 2] Set Bitcode : No From Build Settings 3] Set up Plist File <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <string>fb460481580805052</string> </array> </dict> </array> <key>FacebookAppID</key> <string>460481580805052</string> <key>LSRequiresIPhoneOS</key> <true/> <key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>akamaihd.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>facebook.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>fbcdn.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> </dict> </dict> <key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fbapi20130214</string> <string>fbapi20130410</string> <string>fbapi20130702</string> <string>fbapi20131010</string> <string>fbapi20131219</string> <string>fbapi20140410</string> <string>fbapi20140116</string> <string>fbapi20150313</string> <string>fbapi20150629</string> <string>fbauth</string> <string>fbauth2 </string> <string>fb-messenger-api20140430</string> <string>fb-messenger-platform-20150128</string> <string>fb-messenger-platform-20150218</string> <string>fb-messenger-platform-20150305</string> </array> 4] Download 4 Sdk Framework like =>Bolts.framework =>FBSDKCoreKit.framework =>FBSDKLoginKit.framework =>FBSDKShareKit.framework A: please use LSApplicationQueriesSchemes or addd into plist your app id . A: For iOS 9 or above, add this method in your AppDelegate file: https://stackoverflow.com/a/43515243/535013
doc_23537301
stage ('Create and Deploy to k8s Dev Environment') { //agent {label 'docker-maven-slave'} options { skipDefaultCheckout() } steps { command """ echo "hiiiiiiii" helm template -f portal-chart/values-dev.yaml --set image.tag=${IMAGE} | \ kubectl apply --server=https://dddd.gggg.com:443 --token='${DEV_NS_TOKEN}' --insecure-skip-tls-verify=true -f - """ } Below are the logs: + echo hiiiiiiii hiiiiiiii + helm template -f portal-chart/values-dev.yaml --set image.tag=bde8ac5 + kubectl apply --server=https://dddd.gggg.com:443 --token=eyjsfkjdhfkjdhfkjdhfkjhfdjhfjdfjZCI6IlI5Zi1YOFpnd2NzcUpUR1czTG45aUhwR2dHMkYx --insecure-skip-tls-verify=true -f - Error: "helm template" requires at least 1 argument Usage: helm template [NAME] [CHART] [flags] error: no objects passed to apply [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Please verify my helm command and let me know if I am missing something over here. A: You must specify the Chartparameter. helm template --help Usage: helm template [NAME] [CHART] [flags] In your case it should be helm template -f portal-chart/values-dev.yaml --set image.tag=${IMAGE} portal-chart -f only specifies the values file! You also must specify for which chart it should be applied on.
doc_23537302
I’m getting the following error and I don’t know why or how to fix it Call to undefined method FluidTYPO3\Flux\Form\Container\Sheet::setOption() I am trying to get things working after disabling fluidpages and upgrading flux 9.4. I think I have done the database updates correctly. I’m using: typo3 8.7, flux 9.4, no fluidcontent, no fluidpages, vhs. Note: This is also cross posted in the TYPO3's Flux Slack channel where it's easier to have longer live conversations if needed. My Code Here’s what I had before in fluidbootstraptheme/Resources/Private/Templates/Content/Carousel.html <f:section name="Configuration"> <flux:form id="carousel" options="{group: 'Bootstrap', sorting: 200, icon: 'EXT:fluidbootstraptheme/Resources/Public/Icons/Content/Carousel.png'}"> Here’s what I have now in fluidbootstraptheme/Resources/Private/Templates/Content/Carousel.html <f:section name="Configuration"> <flux:form id="carousel"> <flux:form.option.group value="Bootstrap" /> <flux:form.option.sorting value="200" /> <flux:form.option.icon value="EXT:fluidbootstraptheme/Resources/Public/Icons/Content/Carousel.png" /> Additional References Here's some things that might help and I might have misunderstood, hence my site isn't working yet * *https://www.aemka.de/en/news/update-from-extflux-8-to-9.html *https://www.aemka.de/en/news/fluid-pages-page-layouts-without-fluidpages.html *https://github.com/FluidTYPO3/flux/issues/1542 A: Thanks to @Claus Due he pointed out that in one of my files I had accidentally placed flux:form.option inside of flux:form.sheet instead of directly inside flux:form. He also kindly added code to check for this specific error in Flux in the future. The wrong way <f:section name="Configuration"> <flux:form id="progressBar"> <flux:form.sheet name="progressBar"> <flux:form.option.group value="Bootstrap" /> <flux:form.option.sorting value="650" /> <flux:form.option.icon value="EXT:yourextension/Resources/Public/Icons/Content/ProgressBar.png" /> <flux:field.checkbox name="settings.progressBarAnimated" default="0" /> <flux:field.checkbox name="settings.progressBarStriped" default="0" /> <flux:field.select name="settings.progressBarColor" The right way <f:section name="Configuration"> <flux:form id="progressBar"> <flux:form.option.group value="Bootstrap" /> <flux:form.option.sorting value="650" /> <flux:form.option.icon value="EXT:yourextension/Resources/Public/Icons/Content/ProgressBar.png" /> <flux:form.sheet name="progressBar"> <flux:field.checkbox name="settings.progressBarAnimated" default="0" /> <flux:field.checkbox name="settings.progressBarStriped" default="0" /> <flux:field.select name="settings.progressBarColor" Way to improve the above code @Claus Due also pointed out that there's usually no need to use flux:form.option.icon if you use special conventions. copy whichever icon files you associate with content/page templates, to Resources/Public/Icons/Content or Resources/Public/Icons/Page and name them like the page/content template is named. Then remove the β€œicon” option from forms So for this snippet from the file typo3conf/ext/yourextension/Resources/Private/Templates/Content/ProgressBar.html I leave out the icon line... <f:section name="Configuration"> <flux:form id="progressBar"> <flux:form.option.group value="Bootstrap" /> <flux:form.option.sorting value="650" /> <flux:form.sheet name="progressBar"> <flux:field.checkbox name="settings.progressBarAnimated" default="0" /> <flux:field.checkbox name="settings.progressBarStriped" default="0" /> <flux:field.select name="settings.progressBarColor" ...and just make sure to add an icon specifically located and named typo3conf/ext/yourextension/Resources/Public/Icons/Content/ProgressBar.png Note: I abstracted fluidbootstraptheme to yourextension in the above code make it a little more obvious what gets replaced in your specific case.
doc_23537303
I found this post, which I adapted for sparse matrix operations. But: It's still very slow on large objects. I am wondering if someone has a better solution that operates directly on the indexed elements of the sparse matrix that would be faster. For instance, A@j indexes (from zero) the labels in A@Dimnames[[2]], which could be compacted and used to reindex A@j. (Note: This is why I used the triplet sparse matrix form rather than the Matrix default of column-sparse matrixes since figuring out that p value makes my head hurt every time.) require(Matrix) # set up a (triplet) sparseMatrix A <- sparseMatrix(i = c(1, 2, 1, 2, 1, 2), j = 1:6, x = rep(1:3, 2), giveCsparse = FALSE, dimnames = list(paste0("r", 1:2), rep(letters[1:3], 2))) A ## 2 x 6 sparse Matrix of class "dgTMatrix" ## a b c a b c ## r1 1 . 3 . 2 . ## r2 . 2 . 1 . 3 str(A) ## Formal class 'dgTMatrix' [package "Matrix"] with 6 slots ## ..@ i : int [1:6] 0 1 0 1 0 1 ## ..@ j : int [1:6] 0 1 2 3 4 5 ## ..@ Dim : int [1:2] 2 6 ## ..@ Dimnames:List of 2 ## .. ..$ : chr [1:2] "r1" "r2" ## .. ..$ : chr [1:6] "a" "b" "c" "a" ... ## ..@ x : num [1:6] 1 2 3 1 2 3 ## ..@ factors : list() # my matrix-based attempt OP1 <- function(x) { nms <- colnames(x) if (any(duplicated(nms))) x <- x %*% Matrix(sapply(unique(nms),"==", nms)) x } OP1(A) ## 2 x 3 sparse Matrix of class "dgCMatrix" ## a b c ## r1 1 2 3 ## r2 1 2 3 It worked fine, but seems quite slow on the huge sparse objects on which I intend to use it. Here's a larger item: # now something bigger, for testing set.seed(10) nr <- 10000 # rows nc <- 26*100 # columns - 100 repetitions of a-z nonZeroN <- round(nr * nc / 3) # two-thirds sparse B <- sparseMatrix(i = sample(1:nr, size = nonZeroN, replace = TRUE), j = sample(1:nc, size = nonZeroN, replace = TRUE), x = round(runif(nonZeroN)*5+1), giveCsparse = FALSE, dimnames = list(paste0("r", 1:nr), rep(letters, nc/26))) print(B[1:5, 1:10], col.names = TRUE) ## 5 x 10 sparse Matrix of class "dgTMatrix" ## a b c d e f g h i j ## r1 . . 5 . . 2 . . . . ## r2 . . . . . . . . . 4 ## r4 . . . . . . . 3 3 . ## r3 2 2 . 3 . . . 3 . . ## r5 3 . . 1 . . . . . 5 require(microbenchmark) microbenchmark(OPmatrixCombine1 = OP1(B), times = 30) ## Unit: milliseconds ## expr min lq mean median uq max neval ## OPmatrixCombine1 578.9222 619.3912 665.6301 631.4219 646.2716 1013.777 30 Is there a better way, where better means faster and, if possible, not requiring the construction of additional large objects? A: Here's an attempt using the index reindexing I had in mind, which I figured out with a friend's help (Patrick is that you?). It reindexes the j values, and uses the very handy feature of sparseMatrix() that adds the x values together for elements whose index positions are the same. OP2 <- function(x) { nms <- colnames(x) uniquenms <- unique(nms) # build the sparseMatrix again: x's with same index values are automatically # added together, keeping in mind that indexes stored from 0 but built from 1 sparseMatrix(i = x@i + 1, j = match(nms, uniquenms)[x@j + 1], x = x@x, dimnames = list(rownames(x), uniquenms), giveCsparse = FALSE) } Results are the same: OP2(A) ## 2 x 3 sparse Matrix of class "dgCMatrix" ## a b c ## r1 1 2 3 ## r2 1 2 3 all.equal(as(OP1(B), "dgTMatrix"), OP2(B)) ## [1] TRUE But faster: require(microbenchmark) microbenchmark(OPmatrixCombine1 = OP1(B), OPreindexSparse = OP2(B), times = 30) ## Unit: relative ## expr min lq mean median uq max neval ## OPmatrixCombine1 1.756769 1.307651 1.360487 1.341814 1.346864 1.460626 30 ## OPreindexSparse 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 30
doc_23537304
Now the internal variables of the function are shared. So, if I click on multiple buttons (i.e. before previous ajax requests have completed) the variables are over-writing each other.... $('.btn-merge').click(function(){ $this = $( this ); pid = $this.data('pid'); cid = $this.data('cid'); $this.removeClass('btn-primary').addClass('btn-warning').prop('disabled',true).closest('li.suggestions').addClass('waiting-merge'); putData = { catalogId : cid, productId : pid }; $.post("///url///",putData,function (returnData){ if (returnData === 'true'){ suggestion = $this.removeClass('btn-warning').addClass('btn-success').closest('li.suggestions').removeClass('waiting-merge').addClass('success-merge').appendTo('ul.catalog-products').slideDown(); suggestion.find('.btn-unmerge').data('cid',cid).show().prop('disabled',false).removeClass('btn-success').addClass('btn-danger'); suggestion.find('.suggestion-cid').text('Catalog ID:'+cid); } else $this.removeClass('btn-warning').addClass('btn-danger').removeAttr('disabled'); }); }); A: You are using global variables. Inside your callback function, prefix variables with var to make sure they don't leak the scope.
doc_23537305
the entire program was as follows: public class TextAreaSample extends JFrame implements ActionListener { public static void main(String[] args) { new TextAreaSample(); } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == bt) { File f; String filepath; JFileChooser fc = new JFileChooser(); fc.showOpenDialog(null); f = fc.getSelectedFile(); filepath = f.getAbsolutePath(); try { FileInputStream fis = new FileInputStream(filepath); Reader reader = new InputStreamReader(fis); BufferedReader br = new BufferedReader(reader); ta.read(br, "utf-8"); } catch (FileNotFoundException ex) { System.out.println("file not found"); } catch (IOException ex) { System.out.println("not oppend"); } } if (ae.getSource() == bt2) { ta.setText(" "); //.setText(" "); } } }
doc_23537306
data_hrs <- rnorm(n=513, m=20, sd=1) hours <- 528 days <- ceiling(hours/24) days_hours <- days*24 data_hrs[days_hours] <- NA ## padding with NA to reach full no of days hours <- length(data_hrs) hours_count <- seq(1:24) hours_count <- rep(hours_count,days) day_count <- NA ## counts the days for (t in 1:days){ day_count[((t-1)*24+1):(t*24)] <- rep(t,24) } df_plot <- data.frame(day_count, hours_count, data_hrs) print(ggplot(df_plot, aes(x=hours_count, y = data_hrs))+ geom_bar(stat="identity", width = 0.1, position = position_dodge(width = 0.5))+ theme_bw()+ facet_grid(day_count ~ .)+ scale_x_discrete(limits = c(seq(1:24)))+ theme(axis.text.x = element_text(angle = 90, hjust = 1))) This gives me the following (using my data): A: Use width = 1 to remove the space between the bars. Create a narrow plot if you want fine bars. A wide graph is not compatible with fine bars without space between the bars. ggplot(df_plot, aes(x=hours_count, y = data_hrs))+ geom_bar(stat="identity", width = 1)+ theme_bw()+ facet_grid(day_count ~ .)+ scale_x_discrete(limits = c(seq(1:24)))+ theme(axis.text.x = element_text(angle = 90, hjust = 1))
doc_23537307
one for country then State and cities My Country table is ok. But i want to include all states of america to my state table and all major cities of each state in america to my city table. i want any such database so that i can import my database i need only major cities. is there a site i can download or copy any such things , exactly as per my requirement Please help me i'm not finding it in the exact way.. Thanks A: This one is Free but you may end up writing a converter code or something to transfer the whole list into Database. http://www.census.gov/tiger/tms/gazetteer/places2k.txt A: I'm sure you could find something with a web search; e.g. "database major cities USA". For example, I found this in the first page of search results ... if you can afford to invest $20. A: Wikipedia has a list of US Cities with a population greater than 100,000 people. Does that meet your definition of "major"? If so, check it out.
doc_23537308
A = load 'test.csv' using PigStorage('|'); But I keep getting this error: [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2999: Unexpected internal error. java.net.URISyntaxException cannot be cast to java.lang.Error I've looked all over, but I can't find any reason this would happen. The test file I have above is a simple file that just contains 1|2|3 for testing. A: If you are running Pig in MAPREDUCE as the ExecType mode, then the following command should work A = LOAD '/user/pig/input/pipetest.csv' USING PigStorage('|'); DUMP A; Here is the output on your screen (1,2,3) Note that I have included the full path in HDFS for my csv file in the LOAD command
doc_23537309
data=nc.Dataset('oisst-avhrr-v02r01.20100308.nc') ​ -------------------------------------------------------------------------- OSError Traceback (most recent call last) <ipython-input-9-5387b338d47c> in <module> 1 import netCDF4 as nc ----> 2 data=nc.Dataset('oisst-avhrr-v02r01.20100308.nc') netCDF4\_netCDF4.pyx in netCDF4._netCDF4.Dataset.__init__() netCDF4\_netCDF4.pyx in netCDF4._netCDF4._ensure_nc_success() OSError: [Errno -51] NetCDF: Unknown file format: b'oisst-avhrr-v02r01.20100308.nc'
doc_23537310
Sheet1 : Consolidated_Sheet Sheet2 : Incentive_Report_Raw_Data Sheet3 : Offer_Report_Raw_Data Sheet4 : SQR_Report_Raw_Data Step 1: Integrate Data From Sheet3 to Consolidated Sheet - Works Sub InitialMigration() Dim sourceColumn As Range, targetColumn As Range Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("B") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("D") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AH") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("H") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AV") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("L") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AW") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("M") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("D") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("N") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("I") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("O") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AS") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("P") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("BC") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("W") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AO") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("Z") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AN") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("AB") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AK") Set targetColumn = Worksheets("Consolidated_Sheet").Columns("Y") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AM") 'Pricing Set targetColumn = Worksheets("Consolidated_Sheet").Columns("AD") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("F") 'Campaign Owner Set targetColumn = Worksheets("Consolidated_Sheet").Columns("I") sourceColumn.Copy [targetColumn] Set sourceColumn = Worksheets("Offer_Report_Raw_Data").Columns("AG") 'Product Set targetColumn = Worksheets("Consolidated_Sheet").Columns("F") sourceColumn.Copy [targetColumn] End Sub Step 2: I Need to match value from Consolidated_Sheet (Column U) to that in SQR (Column J) then copy value in same row SQR (Column F) to the corresponding row of initial value in Consolidated_Sheet (Column O). Match (CS-U) to (SQR-J) then copy (SQR-F) to (CS-O). Note: The rows on the two different sheets Do Not match. I have attempted this with limited success on a small scale - one row and it works, but I cannot find a way to make it work amongst a larger dataset - (~2,000+ rows). I found this on the internet and this is the closest I could get to what I was looking for - I honestly don't know if I asked the correct way. Sub Submission() Set wks1 = Worksheets("Consolidated_Sheet") Set wks2 = Worksheets("SQR_Report_Raw_Data") With wks1 End With If wks1.Range("U") = wks2.Range("J") Then wks2.Range("F").Copy wks1.Range("O") '<< cpy to 2nd WS End If End Sub Step 3: The requirement from the previous exercise would be necessary between the Consolidated_Sheet and the Incentive_Report_Raw_Data. Please note also that these Raw Data Sheets will be updated weekly and I would lie this to be able to continuously update everything. Ideally in a step by step process. A: Your first part is functional, but can be shortened quite a bit (and so made easier to maintain) if you use a small Sub to do the actual copying: Sub InitialMigration() CopyColumn "B", "D" CopyColumn "AH", "H" CopyColumn "AV", "L" CopyColumn "AW", "M" CopyColumn "D", "N" CopyColumn "I", "O" CopyColumn "AS", "P" CopyColumn "BC", "W" CopyColumn "AO", "Z" CopyColumn "AN", "AB" '...ETC ETC End Sub 'Utility sub: Copy col letter S to col letter D Sub CopyColumn(S As String, D As String) Worksheets("Offer_Report_Raw_Data").Columns(S).Copy _ Worksheets("Consolidated_Sheet").Columns(D) End Sub The last part is a bit more complicated but in the example below all of the logic is in the DoLookup Sub, so you can call this repeatedly from Submission, with different parameters for: * *the column you want to look up *which column you want to check that against *where to pick the value from in the event of a match *which column to put that value into Here's the code: Sub Submission() Dim wksCS As Worksheet, wksSQR As Worksheet Set wksCS = Worksheets("Consolidated_Sheet") Set wksSQR = Worksheets("SQR_Report_Raw_Data") 'look up colU against colJ - copy match from ColF to ColO DoLookup wksCS.Columns("U"), wksSQR.Columns("J"), "F", "O" 'add more lookups here.... End Sub 'Utility: for each value in SrcCol, check MatchCol for a match. ' If found, copy the value from Col 'ValCol' on the matched row to Col 'DestCol' on ' the consolidation sheet. Sub DoLookup(SrcCol As Range, MatchCol As Range, ValCol As String, DestCol As String) Dim rngSrc As Range, rngMatch As Range, c As Range, v, m 'just work with the "used" parts of the match columns Set rngSrc = Application.Intersect(SrcCol, SrcCol.Parent.UsedRange) Set rngMatch = Application.Intersect(MatchCol, MatchCol.Parent.UsedRange) For Each c In rngSrc.Cells v = c.Value If Len(v) > 0 Then m = Application.Match(v, rngMatch, 0) If Not IsError(m) Then c.EntireRow.Cells(1, DestCol).Value = _ rngMatch.Cells(m).EntireRow.Cells(1, ValCol) Else 'decide what you want to do here... c.EntireRow.Cells(1, DestCol).Value = "No match!" End If End If Next c End Sub Good luck!
doc_23537311
string footer = "My custom footer"; Paragraph footerParagraph = section.Footers.Primary.AddParagraph(footer); footerParagraph.AddTab(); footerParagraph.AddPageField(); Above will generate "My custom footer 1" for page 1, I need page nmuber to be right at the right most corner of the page. I can add extra spaces or tab but thought there must be a clean way to achieve this. Thanks. A: Keep it Simple: Use a Tab Stop The best way to do this is the same as you would do in most word processing tools: with a right-aligned tab-stop, placed on the right margin of the page. This is pretty straight forward, but I couldn't find the "full" solution anywhere, so here's what you need: // Grab the current section, and other settings var section = documentWrapper.CurrentSection; var footer = section.Footers.Primary; var reportMeta = documentWrapper.AdminReport.ReportMeta; // Format, then add the report date to the footer var footerDate = string.Format("{0:MM/dd/yyyy}", reportMeta.ReportDate); var footerP = footer.AddParagraph(footerDate); // Add "Page X of Y" on the next tab stop. footerP.AddTab(); footerP.AddText("Page "); footerP.AddPageField(); footerP.AddText(" of "); footerP.AddNumPagesField(); // The tab stop will need to be on the right edge of the page, just inside the margin // We need to figure out where that is var tabStopPosition = documentWrapper.CurrentPageWidth - section.PageSetup.LeftMargin - section.PageSetup.RightMargin; // Clear all existing tab stops, and add our calculated tab stop, on the right footerP.Format.TabStops.ClearAll(); footerP.Format.TabStops.AddTabStop(tabStopPosition, TabAlignment.Right); The hardest part of this, is figuring out what your tab stop position should be. Because I'm boring and really like encapsulation, I dynamically calculate the tab stop position, based on the page width, less the horizontal page margins. However, getting the current page width wasn't as easy as I'd thought it'd be, because I'm using PageFormat to set the page dimensions. Next Challenge: Getting Your Page Width, Dynamically First, I really hate having tightly coupled code (think: fan-in and fan-out), so even though I know at this point in time what my page width is, even to the point of hard-coding it, I still want to hard code it in only a single place, then refer to that one place everywhere else. I keep a custom "has-a"/wrapper class to keep this stuff encapsulated into; That's documentWrapper in my code here. Additionally, I don't expose any of the PDFSharp/MigraDoc types to the rest of my application, so I'm using ReportMeta as a way to communicate settings. Now for some code. When I setup the section, I'm using the MigraDoc PageFormat to define the size of my page for the current section: // Create, and set the new section var section = documentWrapper.CurrentDocument.AddSection(); documentWrapper.CurrentSection = section; // Some basic setup section.PageSetup.PageFormat = PageFormat.Letter; // Here's my little bit of hard-coding Unit pageWidth, pageHeight; PageSetup.GetPageSize(PageFormat.Letter, out pageWidth, out pageHeight); var reportMeta = documentWrapper.AdminReport.ReportMeta; if (reportMeta.PageOrientation == AdminReportMeta.ORIENT_LANDSCAPE) { section.PageSetup.Orientation = Orientation.Landscape; documentWrapper.CurrentPageWidth = pageHeight; } else { section.PageSetup.Orientation = Orientation.Portrait; documentWrapper.CurrentPageWidth = pageWidth; } What's really important here, is that I'm storing the CurrentPageWidth, this becomes really important when setting up our tab stops. The CurrentPageWidth property, is simply a MigraDoc Unit type. I am able to determine what this is by using MigraDoc's PageSetup.GetPageSize with my chosen PageFormat. A: A single tab will do. Create a right-aligned tab at the right-most position. You can set the tab stops for the footer style (recommended) or for the paragraph. Code snippet modifying a style: var style = document.Styles[StyleNames.Footer]; style.ParagraphFormat.TabStops.ClearAll(); style.ParagraphFormat.TabStops.AddTabStop(Unit.FromMillimeter(158), TabAlignment.Right); A: You could try something like this: Paragraph paragraph = new Paragraph(); paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddText("My custom footer: "); Paragraph paragraph2 = new Paragraph(); paragraph2.Format.Alignment = ParagraphAlignment.Right; paragraph2.AddText(" Page # "); paragraph2.AddPageField(); section.Footers.Primary.Add(paragraph); section.Footers.Primary.Add(paragraph2);
doc_23537312
_WebTryThreadLock(bool), 0x78695e90: Multiple locks on web thread not allowed! Please file a bug. Crashing now... 1 0xb1e3698 WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*) 2 0x5dc99de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ 3 0x5dc9920 __CFRunLoopDoObservers 4 0x5dbf22f __CFRunLoopRun 5 0x5dbebcb CFRunLoopRunSpecific 6 0x5dbe9fb CFRunLoopRunInMode 7 0xb1e3660 RunWebThread(void*) 8 0x742eecf _pthread_body 9 0x742ee45 _pthread_body 10 0x742cf0e thread_start I got this issue while I am using AdMob in my application.
doc_23537313
class User { public name: string; public works: (() => Promise<void>)[]; constructor(name: string) { this.name = name; this.works = []; } public attemptsTo(tasks) { this.works = this.works.append(tasks); } public expects(expectations) { this.works = this.works.append(expectations); } async run(): Promise<void> { // Runs all works then resolves } } And I use it like below: const admin = new User("Admin"); await user .attemptsTo([EnterCredentials,Login]) .expects([LoginSuccessfully]) .attemptsTo([NavigateToUsersPage]) .expects([SeeUsersList,AddNewUser]) .run(); I want to get a compilation error if I forget to put run() at the end of the chain. Is there anyway to ensure that a run() expression is always put at the end? According to this question, there is an @End annotation in java to achieve this purpose. How can I implement @End in typescript? Or if there is not anyway, How can I reimplement my class without requiring a run method call?
doc_23537314
<h:form id="keepAliveForm"> <p:poll interval="300" global="false"/> </h:form> In my main flow an end-state to redirect to a certain page: <end-state id="redirect" view="flowRedirect:home" /> A button on another page and a transition in the view-state to the redirect flow: <p:commandButton value="Test" action="theTest"/> <transition on="theTest" to="redirect" /> Now everything is working, except when the application server (tomcat 7) gets restarted and there is still a client on a page that was redirected with the polling in. Then every time when the polling fires I keep getting following exception : 9-okt-2013 11:01:12 com.sun.faces.util.Util checkIdUniqueness SEVERE: JSF1007: Duplicate component ID j_idt65 found in view. 9-okt-2013 11:01:12 com.sun.faces.util.Util checkIdUniqueness and also : Caused by: java.lang.IllegalStateException: CDATA tags may not nest Why are these exceptions being thrown? And is there a way to stop them, because they do not really break the application, but fill the logs with unnecessary clutter.
doc_23537315
id term subj prof hour 20 2016 COM James 4 20 2016 COM Henrey 4 30 2016 HUM Nelly 3 30 2016 HUM John 3 30 2016 HUM Jimmy 3 45 2016 CGS Tim 3 I need to divide hours if the id- term and subj same. There are 2 different prof with same id:20 - term and subj, so i divided hour 2. There are 3 different prof with same id : 30 - term and subj. So i divided hour 3. So the output should be like this; id term subj prof hour 20 2016 COM James 2 20 2016 COM Henrey 2 30 2016 HUM Nelly 1 30 2016 HUM John 1 30 2016 HUM Jimmy 1 45 2016 CGS Tim 3 A: In SAS you can use a double DOW loop to achieve this, once the data has been sorted in the correct order. The first loop counts how many profs there are with the same id, term and subj. The second loop divides hour by the number of profs. The loops are performed at each change of id, term or subj. I've created a new_hour variable and kept in the temporary _counter variable just so you can see the code working, you can obviously overwrite the hour variable and drop the _counter variable if you wish /* create initial dataset */ data have; input id term subj $ prof $ hour; datalines; 20 2016 COM James 4 20 2016 COM Henrey 4 30 2016 HUM Nelly 3 30 2016 HUM John 3 30 2016 HUM Jimmy 3 45 2016 CGS Tim 3 ; run; /* sort data */ proc sort data=have; by id term subj prof; run; /* create output dataset */ data want; do until(last.subj); /* 1st loop*/ set have; by id term subj prof; if first.subj then _counter=0; /* reset counter when id, term or subj change */ _counter+first.prof; /* count number of times prof changes */ end; do until(last.subj); /* 2nd loop */ set have; by id term subj; new_hour=hour / _counter; /* divide hour by number of profs from 1st loop */ output; /* output record */ end; run; A: Assuming your problem is as simple as the one you gave as an example, one proc sql should suffice. If it is more complicated, please explain how so we can be more helpful! data have; input id term subj $ prof $ hour; datalines; 20 2016 COM James 4 20 2016 COM Henrey 4 30 2016 HUM Nelly 3 30 2016 HUM John 3 30 2016 HUM Jimmy 3 45 2016 CGS Tim 3 ; run; proc sql; create table want as select *, hour / count(prof) as hour_adj from have group by id, subj; quit;
doc_23537316
preg_match_all('/(\{%IF:(.+?)%\}\r?\n?)(.+?)(\{%ENDIF:\2%\}\r?\n?)/s',$this->tpl_raw,$if_controls,PREG_SET_ORDER); That looks for {%IF:NAME%}Do 1{%ENDIF:NAME%} and I get that match. The problem is, what it's not doing, and I want to is in cases like this {%IF:NAME%}Do 1{%IF:OTHERNAME%} Do 2{%ENDIF:OTHERNAME%}{%ENDIF:NAME%} I cannot get it to ALSO match that inner portion. Based on the original answer here, I looked into doing this preg_match_all('/(\{%IF:(.+?)%\}\r?\n?)(.+?)|(?R)(\{%ENDIF:\2%\})\r?\n?/s',$this->tpl_working,$if_controls,PREG_SET_ORDER); But that gives me preg_match_all(): Compilation failed: recursive call could loop indefinitely at offset 31 Can anyone assist with how I can make this work?
doc_23537317
Here is code I got: * { box-sizing: border-box; } html, body { background-color: darkgrey; height: 100%; margin: 0; } html { font-family: sans-serif; } body { display: flex; align-items: center; } .wrapper { overflow: hidden; margin: auto; } div>div { margin: 0.5rem; float: left; position: relative; } div:nth-child( 4n) { clear: left; } img { width: 320px; max-height: 100%; } .border { border-style: solid; border-width: 1px; border-color: white; } .txt { background-color: rgba(0, 0, 0, 0.5); left: -8; width: 320px; position: absolute; bottom: -7px; padding-left: 20px; padding-right: 20px; padding-top: 10px; padding-bottom: 10px; max-width: 100%; color: white; } @media( max-width: 1024px) { div:nth-child( 2n + 3) { clear: left; } div:nth-child( 4n) { clear: none; } } <div class="wrapper"> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 1</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 2</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">Omelette du fromage</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">How you doin?</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 5</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 6</div> </div> </div> Labels should be on point with their layout but they are not previewing as they should. Here is link to other CSS editor which does it better: http://www.cssdesk.com/7kW7k A: Rewritten you layout using flexbox and perfored some style optimizations. Assuming you want adding scrollbars when 2 images in the row and page is shrinking. Result: * { box-sizing: border-box; } body { font-family: sans-serif; background-color: darkgrey; height: 100vh; margin: 0; /* for centering block both horizontally and vertically */ display: flex; justify-content: center; align-items: center; } .wrapper { display: flex; justify-content: center; flex-wrap: wrap; /* maximum 3 items, (320px + 2px border + 0.5rem margin-left + 0.5rem margin-right) Γ— 3 */ max-width: calc(322px * 3 + 0.5rem * 6); /* minimum 2 items, (320px + 2px border + 0.5rem margin-left + 0.5rem margin-right) Γ— 2 */ min-width: calc(322px * 2 + 0.5rem * 4); } .wrapper > div { margin: 0.5rem; } img { width: 320px; max-height: 100%; } .border { border: 1px solid #fff; position: relative; } .txt { position: absolute; bottom: 0; left: 0; right: 0; background-color: rgba(0, 0, 0, 0.5); padding: 10px 20px; color: white; } <div class="wrapper"> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 1</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 2</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">Omelette du fromage</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">How you doin?</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 5</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 6</div> </div> </div> You can test resizing in jsFiddle. If you want image shrinking you can add media query for this: * { box-sizing: border-box; } body { font-family: sans-serif; background-color: darkgrey; height: 100vh; margin: 0; /* for centering block both horizontally and vertically */ display: flex; justify-content: center; align-items: center; } .wrapper { display: flex; justify-content: center; flex-wrap: wrap; /* maximum 3 items, (320px + 2px border + 0.5rem margin-left + 0.5rem margin-right) Γ— 3 */ max-width: calc(322px * 3 + 0.5rem * 6); } .wrapper > div { margin: 0.5rem; } img { width: 320px; max-height: 100%; } .border { border: 1px solid #fff; position: relative; } .txt { position: absolute; bottom: 0; left: 0; right: 0; background-color: rgba(0, 0, 0, 0.5); padding: 10px 20px; color: white; } @media (max-width: 750px) { .border { width: calc(50% - 2rem); } .border > img { width: 100%; } } <div class="wrapper"> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 1</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 2</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">Omelette du fromage</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">How you doin?</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 5</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 6</div> </div> </div> Test resizing in jsFiddle. A: I added a left property and thus managed to get the alignment better: .txt { background-color: rgba(0, 0, 0, 0.5); width: 320px; position: absolute; bottom: -6px; left: -7px; padding-left: 20px; padding-right: 20px; padding-top: 10px; padding-bottom: 4px; max-width: 100%; color: white; } Fiddle: https://jsfiddle.net/mjpLmqwx/ A: * { box-sizing: border-box; } html, body { background-color: darkgrey; height: 100%; margin: 0; } html { font-family: sans-serif; } body { } .wrapper { margin: auto; width:100%; } .txt { background-color: rgba(0, 0, 0, 0.5); left: -8; width: 320px; position: absolute; bottom: 0px; padding-left: 20px; padding-right: 20px; padding-top: 10px; padding-bottom: 10px; max-width: 100%; color: white; margin: 0px; } div > div { margin: 0.5rem; } img { width:100%; } .border { border-style: solid; border-width: 1px; border-color: white; width: 47%; position: relative; float: left; } <div class="wrapper"> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 1</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 2</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">Omelette du fromage</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">How you doin?</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 5</div> </div> <div class="border"> <img src="http://i.imgur.com/VCsr2MH.png"> <div class="txt">div text 6</div> </div> </div>
doc_23537318
My entities looks as follows @Entity @Table(name = "BOOK") @NamedQuery(name="Book.findAll", query = "SELECT b from Book as b LEFT JOIN b.discountList as d where d.endingDate is null") public class Book { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private Long bookId; @Column(name = "TITLE") private String title; @Column(name = "ISBN") private String isbn; @Column(name = "DESCRIPTION") @Type(type="text") private String description; @Column(name = "PUBLISHING_DATE") private Date publishingDate; @Column(name = "BASE_PRICE") private BigDecimal basePrice; @ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.MERGE, CascadeType.PERSIST }) @JoinTable(name = "BOOK_TO_DISCOUNT", joinColumns = {@JoinColumn(name = "book_id")}, inverseJoinColumns = {@JoinColumn(name = "discount_id")}) private Set<Discount> discountList; } @Entity @Table(name = "DISCOUNT") public class Discount { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private Long discountId; @Column(name = "NAME") private String name; @Column(name = "RATE") private Integer rate; @Column(name = "START_DATE") private Timestamp startingDate; @Column(name = "END_DATE") private Timestamp endingDate; @ManyToMany(fetch = FetchType.LAZY, mappedBy = "discountList") private Set<Book> bookList; } My goal is to add a Discount which is related to some books, so I need to insert new promotion to the DISCOUNT table and add a relation into the BOOK_TO_DISCOUNT table. Right now I'm doing this action in this way: Set<Book> listOfLinkedBooks = discountData.getIdsOfBooksCoveredByThisDiscount().stream() .map(idOfBook -> entityManager.find(Book.class, idOfBook)).collect(Collectors.toSet()); Discount discount = new Discount(discountData.getDiscountId(), discountData.getName(), discountData.getRate(), discountData.getStartingDate(), discountData.getEndingDate(), listOfLinkedBooks); listOfLinkedBooks.forEach(a -> { Optional.ofNullable(a.getDiscountList()).orElseGet(Collections::emptySet) .add(discount); }); entityManager.merge(discount); The disadvantage of this solution lays in usage of find method, because the hibernate fetches the all data of entity, when the entity is only needed to map relation connected with it. Looking from from DB point of view the id is enough to do so operation. Is there any chance to do it with usage of getRelation method? The other solution, to optimize this operation, is to add new relation by hand, so I should create an entity for BOOK_TO_DISCOUNT table and just insert new relation manually. I perceive this idea as dirty one and implementation involves creating more entities. That is why I'm asking about usage getRelation in this case.
doc_23537319
EDIT Components used: TQuickRep, TQRBand, and the particular control that will hold the variable size content is TQRExpr EDIT The key piece of info not included in the answer is how to assign the expression to a TQRExprMemo since it doesn't have an expression property like TQRExpr. The answer to that is to enclose the expression in { } (eg. "{expression}") and assign it to the Lines property. Set RemoveBlankLines to True, AutoStretch to True, AutoSize to False. A: I always use a TQRExprMemo. Set AutoSize to True, AutoStretch to True, and IIRC there's a property to delete/suppress blank lines. I've used this frequently to produce mailing labels, address blocks on letters, and so forth.
doc_23537320
My code uses WIF (Windows Identity Foundation) and works fine operating systems above windows-xp. The only examples that I have seen of this use WIF to request the SAML tokens from a security token service but WIF is not supported on windows-xp as a result of which I am stuck. I tried to do some research but could not find a way of accomplishing the above stated scenario without using WIF. Is there any way for me to do this on a windows xp client? If not then what should I be doing differently? The code that I use to get tokens is: //GetSamlToken from STS for ACS realm using UserCredential, this uses WIF private SecurityToken GetSamlToken(string realm, string stsEndpoint, UserCredential userCredential) { Logger.Info("Getting Saml Token from Identity provider..."); using (var factory = new WSTrustChannelFactory(new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential), new EndpointAddress(new Uri(stsEndpoint)))) { factory.Credentials.UserName.UserName = userCredential.UserName; factory.Credentials.UserName.Password = userCredential.Password; factory.TrustVersion = TrustVersion.WSTrust13; WSTrustChannel channel = null; try { var rst = new RequestSecurityToken { RequestType = WSTrust13Constants.RequestTypes.Issue, AppliesTo = new EndpointAddress(realm), KeyType = KeyTypes.Bearer, }; channel = (WSTrustChannel)factory.CreateChannel(); RequestSecurityTokenResponse response; var token = channel.Issue(rst, out response); Logger.Info("Got Saml Token from Identity provider."); return token; } finally { if (channel != null) { channel.Abort(); } factory.Abort(); } } } //Gets OAuthToken from an ACS serviceEndpoint using a xmlSamlToken obtained from a STS. private NameValueCollection GetOAuthToken(string xmlSamlToken, string serviceEndpoint, string acsRelyingParty) { Logger.Info("Passing Saml token to ACS..."); WebClient client = new WebClient { BaseAddress = serviceEndpoint }; var values = new NameValueCollection { { "grant_type", "urn:oasis:names:tc:SAML:2.0:assertion" }, { "assertion", xmlSamlToken }, { "scope", acsRelyingParty } }; byte[] acsTokenResponse = client.UploadValues("v2/OAuth2-13", "POST", values); string acsToken = Encoding.UTF8.GetString(acsTokenResponse); var tokens = new NameValueCollection(); var parsed = new JavaScriptSerializer().DeserializeObject(acsToken) as Dictionary<string, object>; Logger.Info("Parsed OAuth token."); foreach (var item in parsed) { tokens.Add(item.Key, item.Value.ToString()); } Logger.Info("Returning OAuth token."); return tokens; }
doc_23537321
I have already written a code for uploading the file over the server in the UploadServelet.java class under fileupload package and have also done the mapping of the servelets in web.xml file" but still getting the error. Index.jsp <div class="container"> <form method="POST" action="upload" enctype="multipart/form-data"> <label for="fname"> Select Input File: </label> <input type="file" name="myFile" id="myFile" /> <br/> <input type="submit" value="upload" name="upload" id="upload" /> </form> </div> Web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> <display-name>Circedb</display-name> <servlet> <servlet-name>UploadServelet</servlet-name> <servlet-class>src.fileupload.UploadServelet</servlet-class> </servlet> <servlet-mapping> <servlet-name>UploadServelet</servlet-name> <url-pattern>/upload</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> Error logs: Type Exception Report Message Error instantiating servlet class [src.fileupload.UploadServelet] Description The server encountered an unexpected condition that prevented it from fulfilling the request. Exception javax.servlet.ServletException: Error instantiating servlet class [src.fileupload.UploadServelet] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Unknown Source) Root Cause java.lang.ClassNotFoundException: src.fileupload.UploadServelet org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1363) org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1186) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1747) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Unknown Source) Note The full stack trace of the root cause is available in the server logs. A: If UploadServelet compiled and uploaded correctly You need to uodate its package by removing src.: <servlet-class>fileupload.UploadServelet</servlet-class>
doc_23537322
To deploy this application, your deployment target should be running Windows Universal Runtime version 10.0.16299.0 or higher. You currently are running version 10.0.14393.2214. Please update your OS, or change your deployment target to a device with the appropriate version. A: The problem is not with your project, but with the PC you are trying to build it on. Maybe you have disabled updates, because apparently you still have Windows 10 Anniversary Update (14393) which is very old (current version is April 2018 Update (17134). To build apps with Fall Creators Update SDK (which is the first that supports .NET Standard 2.0.), you first have to update at least to that version of the operating system. Go to system Settings, Update & Security and check for updates. There must be a lot of them waiting for you already. If not, use Windows 10 Update Assistant from here. A: Go to Solution explorer and double tap the properties Then please select application options and select minimum build version based on your current OS build version. It works for me.
doc_23537323
> "message": "Instance of 'QuantumCircuit' has no 'h' member", > "message": "Instance of 'QuantumCircuit' has no 'cx' member", > "message": "Instance of 'QuantumCircuit' has no 'measure' member", What I do wrong? This is my code: from qiskit import * q = QuantumRegister(2) c = ClassicalRegister(2) qc = QuantumCircuit(q, c) qc.h(q[0]) qc.cx(q[0], q[1]) qc.measure(q, c) backend_sim = BasicAer.get_backend('qasm_simulator') result = execute(qc, backend_sim).result() print(result.get_counts(qc)) Thanks A: This looks like the same problem as this. The answer given here is that they are linter warnings probably produced by your IDE, they are not errors with your code - your code looks good to me!
doc_23537324
SQLServer 2005 A: Make the first column the primary key of the table. A: Set the column as a primary key. I doesn't have to be an identity column to has a PK. A: Create it the same way you would any other column: create table sometable (column1 varchar(10), column2 varchar(20)) or whatever. Do you mean: How can you get the database to force it to be unique? Either declare it to be the primary key, or create a unique index on the column. Perhaps you're thinking that a primary key must be auto-generated? There's no such rule. Whether you invent the value yourself or use an autonumber feature has nothing to do with whether a field can be a primary key. A: Why not just put a unique constraint on it: ALTER TABLE <table_name> ADD CONSTRAINT <constraint_name> UNIQUE(<column_name>)
doc_23537325
A: If I were you I'd avoid column names with special characters like ? in the table itself. Writing queries can get troublesome. But you can use column aliases if you want. For example, SELECT NOW() 'What time is it?', t.weatherNice 'Is the weather nice?' FROM table t A: It's not necessary. The is prefix already indicating that it's a boolean flag. Prefer not to use weird characters, it might work (if use use backticks for the column name), but might not be portable, and will certainly confuse others.
doc_23537326
Is there something I have to do to get the enclosed aggregates to be returned? Here's my code: private void btnGetPerson_Click(object sender, RoutedEventArgs e) { var proxy = new TutorWCFServicesClient(); proxy.GetPersonWithPersonKeyOfCompleted += new EventHandler<GetPersonWithPersonKeyOfCompletedEventArgs>(proxy_GetPersonWithPersonKeyOfCompleted); var perID = 29; // testing proxy.GetPersonWithPersonKeyOfAsync(perID); } void proxy_GetPersonWithPersonKeyOfCompleted(object sender, GetPersonWithPersonKeyOfCompletedEventArgs e) { var per = e.Result; if (per != null) { FirstName.Text = per.FirstName; LastName.Text = per.LastName; if (per.Phones != null) { var hPhone = (from phone in per.Phones where phone.PhoneType.ToLower() == "home" select phone).FirstOrDefault(); var cPhone = (from phone in per.Phones where phone.PhoneType.ToLower() == "cell" select phone).FirstOrDefault(); var wPhone = (from phone in per.Phones where phone.PhoneType.ToLower() == "work" select phone).FirstOrDefault(); if (hPhone != null) { PhoneHome.Text = string.Format("({0}) {1}-{2}", hPhone.AreaCode, hPhone.Exchange, hPhone.Number); } if (cPhone != null) { PhoneCell.Text = string.Format("({0}) {1}-{2}", cPhone.AreaCode, cPhone.Exchange, cPhone.Number); } if (wPhone != null) { PhoneSchool.Text = string.Format("({0}) {1}-{2}", wPhone.AreaCode, wPhone.Exchange, wPhone.Number); } } } else { FirstName.Text = "Not Found"; } } A: Dumb error, I forgot to refresh the ServiceReference in the Silverlight app.
doc_23537327
Hi all please help me to produce the following output using XSLT 2.0. I have this: <UL> <ITEM> aaa <NL>iii <ITEM1>111</ITEM1> <ITEM2>222</ITEM2> </NL> </ITEM> <ITEM> bbb <NL>vvv <ITEM1>333</ITEM1> <ITEM2>444</ITEM2> </NL> </ITEM> </UL> I need to produce this <UL> <ITEM> aaa <ITEM1>111</ITEM1> </ITEM> <ITEM> bbb <ITEM1>333</ITEM1> </ITEM> <NEW> <NL>iii <ITEM2>222</ITEM2> </NL> <NL>vvv <ITEM2>444</ITEM2> </NL> </NEW> </UL> I am trying to get the output using mode option as mentioned below: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <xsl:template match="NL"/> <xsl:template match="ITEM2"/> <xsl:template match="UL"> <xsl:copy> <xsl:apply-templates/> <NEW> <xsl:apply-templates select="descendant::NL" mode="move"/> </NEW> </xsl:copy> </xsl:template> <xsl:template match="ITEM" mode="move"> <xsl:copy> <xsl:apply-templates/> <xsl:apply-templates select="descendant::ITEM2" mode="move1"/> </xsl:copy> </xsl:template> <xsl:template match="NL" mode="move"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="ITEM2" mode="move1"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet> Thanks and regards Bala A: Here is an XSLT 2.0 stylesheet that creates the structure you want, although white space is different, as it is a problem with mixed content to produce the exact output: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:template match="UL"> <xsl:copy> <xsl:for-each-group select="ITEM" group-by="NL/*/node-name(.)"> <xsl:choose> <xsl:when test="position() eq 1"> <xsl:for-each select="current-group()"> <ITEM> <xsl:apply-templates select="text() | NL/*[node-name(.) eq current-grouping-key()]"/> </ITEM> </xsl:for-each> </xsl:when> <xsl:otherwise> <NEW> <xsl:for-each select="current-group()"> <NL> <xsl:apply-templates select="NL/(text() | *[node-name(.) eq current-grouping-key()])"/> </NL> </xsl:for-each> </NEW> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:copy> </xsl:template> <xsl:template match="NL/*"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet> I get the result <UL><ITEM> aaa <ITEM1>111</ITEM1> </ITEM><ITEM> bbb <ITEM1>333</ITEM1> </ITEM><NEW><NL>iii <ITEM2>222</ITEM2> </NL><NL>vvv <ITEM2>444</ITEM2> </NL></NEW></UL> When I add instructions to strip white space from the input and indent the output, as in <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"> <xsl:strip-space elements="*"/> <xsl:output indent="yes"/> <xsl:template match="UL"> <xsl:copy> <xsl:for-each-group select="ITEM" group-by="NL/*/node-name(.)"> <xsl:choose> <xsl:when test="position() eq 1"> <xsl:for-each select="current-group()"> <ITEM> <xsl:apply-templates select="text() | NL/*[node-name(.) eq current-grouping-key()]"/> </ITEM> </xsl:for-each> </xsl:when> <xsl:otherwise> <NEW> <xsl:for-each select="current-group()"> <NL> <xsl:apply-templates select="NL/(text() | *[node-name(.) eq current-grouping-key()])"/> </NL> </xsl:for-each> </NEW> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:copy> </xsl:template> <xsl:template match="NL/*"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet> the result is <UL> <ITEM> aaa <ITEM1>111</ITEM1> </ITEM> <ITEM> bbb <ITEM1>333</ITEM1> </ITEM> <NEW> <NL>iii <ITEM2>222</ITEM2> </NL> <NL>vvv <ITEM2>444</ITEM2> </NL> </NEW> </UL> As an alternative, if we know there are just ITEM1 and ITEM2 we want to split, here is stylesheet using modes: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()" mode="#all"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="#current"/> </xsl:copy> </xsl:template> <xsl:template match="NL"> <xsl:apply-templates select="ITEM1"/> </xsl:template> <xsl:template match="ITEM2"/> <xsl:template match="UL"> <xsl:copy> <xsl:apply-templates/> <NEW> <xsl:apply-templates select="descendant::NL" mode="move"/> </NEW> </xsl:copy> </xsl:template> <xsl:template match="ITEM1" mode="move"/> </xsl:stylesheet>
doc_23537328
import pandas_datareader.data as web from matplotlib import style import matplotlib.pyplot as plt !pip install https://github.com/matplotlib/mpl_finance/archive/master.zip from mpl_finance import candlestick_ohlc import matplotlib.dates as mdates import datetime as dt style.use('ggplot') start = dt.datetime(1996,1,1) end = dt.datetime(2020,5,8) df = web.DataReader('TATAMOTORS.NS', 'yahoo', start, end) df.head() df_ohlc = df[['Open', 'Close', 'High', 'Low']] df_ohlc.index = df_ohlc.index.map(mdates.date2num) df_volume = df['Volume'] ax1 = plt.subplot2grid((6,1), (0,0), rowspan=5, colspan=1) ax2 = plt.subplot2grid((6,1), (5,0), rowspan=1, colspan=1, sharex=ax1) ax1.xaxis_date() candlestick_ohlc(ax1, df_ohlc.values, width=2, colorup='g') ax2.fill_between(df_volume.index.map(mdates.date2num), df_volume.values, 0) plt.show() after running the above code, I'm getting the following error message ValueError: not enough values to unpack (expected 5, got 4) How can I resolve the following error ? A: The candlestick_ohlc function requires 5 values (t, open, high, low, close), you need to add the time values to your input for this purpose you can use : >>> values = np.hstack((np.array(df_ohlc.index).reshape(-1,1), df_ohlc.values)) >>> candlestick_ohlc(ax1, values, width=2, colorup='g') I suggest also that you use mplfinance instead of mpl_finance since the latter is deprecated
doc_23537329
My question is, should we consider finding fixed point of logic programs as proof theory or model theory or is it neither? A: My guess would be model theory since the fixpoint semantics of a logic program is its model. However, we know that |= coincides with |- for logic programs, so the semantics based on proving (=resolution) coincide with the semantics based on the fixed points (models). The preceding discussion is valid only for pure logic programs, i.e., no negation, bultins, arithmetics...
doc_23537330
I have to print token list on the left and shift or reduce rule on the right. Like: 2*4+4/2 //iniput 2 shift 2 2 2 reduce I -> F 2 2 reduce F -> T 2 2 reduce F -> T 2 * shift * 2 * 4 shift 4 2 * 4 4 reduce I -> F 2 * 4 2 * 4 reduce T*F -> T 2 * 4 8 reduce T -> E 2 * 4 8 reduce T -> E 2 * 4 + shift + 2 * 4 + 4 shift 4 2 * 4 + 4 4 reduce I -> F 2 * 4 + 4 4 reduce F -> T 2 * 4 + 4 4 reduce F -> T 2 * 4 + 4 / shift / 2 * 4 + 4 / 2 shift 2 2 * 4 + 4 / 2 2 reduce I -> F 2 * 4 + 4 / 2 4 / 2 reduce T/F -> T 2 * 4 + 4 / 2 8 + 2 reduce E+T -> E 2 * 4 + 4 / 2 end of parsing : 2 * 4 + 4 / 2 = 10 I am not familiar with lex & yacc, and I have no idea how to print the procedure out. Any help is welcome. A: You can easily enough ask Bison to show you what it is doing. But it's not going to come out looking like your chart. You'll have to read through the trace and condense it into the desired format. But that's not too hard, and you will appreciate having learned how to do it the first time you have to debug a grammar. I'm not going to explain here how to write a grammar, nor am I going to talk much about writing scanners. If you haven't done so already, I suggest you read through the simple examples in the bison manual, and then the chapter on semantic values. That will explain a lot of the background for the following. Bison has some very useful tools for visualising the grammar and the parse. The first is the state/transition table produced when you give bison the --report=all command-line option. You can use -v, which is what people will usually tell you to do. But I think --report=all is worthwhile for a novice because it comes closer to what you will have seen in class. The -v listing only shows the core items in each state, so it leaves out the items with the dot at the beginning. And it doesn't show you the lookaheads. Since it does show you all the action entries, including the GOTO actions, you can figure everything else out pretty easily. But, at least at the beginning, it's probably better to see all the details. You can ask bison to draw the state machine. It produces the drawing in Graphviz ("Dot") syntax, so you need Graphviz installed to look at the drawing. And state machines for any non-trivial grammar don't fit on an A4 sheet, or a computer screen, so they're really only useful for toy grammars. Read the manual to see how to tell Bison to output the Graphviz diagram if you want to give it a try. You'll probably want to refer to the state machine when you're trying to understand the traces. You could write out parsing actions by just running the state machine by hand, using the actions which Bison shows you. But there's a lot to be said for reading the bison trace. And it's really not very difficult to produce. You just need to add one more command-line option when you invoke bison, and you need to add a few lines to your grammar source file. All of the information here, and a lot more, can be found in the bison manual chapter on grammar debugging The option is -t or --debug. That tells Bison to generate the additional code to produce the traces. However, it does not enable tracing; you still have to do that by setting the value of the global variable yydebug to 1 (or some other non-zero value). Unfortunately, the variable yydebug is not defined unless the --debug option is specified, so if you just add yydebug = 1; to your main(), your program will no longer compile unless you run bison with the --debug option. That's annoying, so it's worth adding a few more lines to your code. The simplest few lines are these: (which can go just above your definition of main): #if YYDEBUG extern int yydebug; #else static int yydebug = 0; #endif That makes sure that yydebug is defined and usable in main regardless of whether you requested a debugging parser when you ran bison. But that still doesn't enable traces. To do that, you need one more line (at least) which you can put right at the top of main: yydebug = 1; Or you could be a bit more sophisticated and make it possible to run the parser with or without traces, by checking the command-line arguments. A good way to parse command-line arguments is with getopt, but for a quick-and-dirty executable which only has one command-line argument, you could use the sample code below, which sets yydebug only if the executable is invoked with -d as its first command line argument. This is probably pretty similar to the grammar you were given (or wrote), except that I used longer names for non-terminals. /* FILE: simple_expr.l */ %{ #include <stdio.h> #include <stdlib.h> #include <string.h> int yylex(void); void yyerror(const char* msg); %} %token NUMBER %printer { fprintf(yyo, "%d", $$); } NUMBER %% expr : term | expr '+' term | expr '-' term term : factor | term '*' factor | term '/' factor factor: NUMBER | '(' expr ')' %% #if YYDEBUG extern int yydebug; #else static int yydebug = 0; #endif int main(int argc, char* argv[]) { if (argc > 1 && strcmp(argv[1], "-d") == 0) yydebug = 1; return yyparse(); } void yyerror(const char* msg) { fprintf(stderr, "%s\n", msg); } We also need a lexical scanner. Here's a really simple one: (See the flex manual for any details you don't understand.) /* FILE: simple_expr.l */ %{ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "simple_expr.tab.h" %} %option noinput nounput noyywrap nodefault %% [[:space:]]+ ; [[:digit:]]+ { yylval = atoi(yytext); return NUMBER; } . return yytext[0]; Compile (a Makefile would be useful here. Or whatever you use for building projects): $ bison -o simple_expr.tab.c -d --debug --report=all simple_expr.y $ flex -o simple_expr.lex.c simple_expr.l $ gcc -Wall -o simple_expr simple_expr.tab.c simple_expr.lex.c You should take a look at simple_expr.output at this point. There you will find the bison state machine report. Now we run the program with traces enabled. (<<< is what Bash calls a "here-string". It takes a single argument and provides it to the executable as its standard input. This is really handy for debugging parsers.) The trace is quite long, because, as I said, Bison makes no attempt to compress the information. Here's how it starts: $ ./simple_expr -d <<< '2 * 3 + 12 / 4' Starting parse Entering state 0 Reading a token: Next token is token NUMBER (2) Shifting token NUMBER (2) Entering state 1 Reducing stack by rule 7 (line 22): $1 = token NUMBER (2) -> $$ = nterm factor () Stack now 0 Entering state 5 Reducing stack by rule 4 (line 19): $1 = nterm factor () -> $$ = nterm term () Stack now 0 Entering state 4 So, it first shifts the token 2 (which is a NUMBER). (Note: I snuck a %printer declaration into the grammar file so that bison can print out the semantic value of NUMBER tokens. If I hadn't done that, it would just have told me that it read a NUMBER, leaving me to guess which NUMBER it read. So the %printer declarations are really handy. But you need to read the manual to see how to use them properly.) The shift action causes it to go to state 1. Bison does immediate reductions when the default reduction doesn't depend on lookahead, so the parser now immediately reduces the stack using the rule factor: NUMBER. (You need either the state machine or the code listing with line numbers to see what "rule 7" is. That's one of the reasons we produced the report.) After the reduction, the stack contains only state 0, which is the state consulted for the GOTO action (on the non-terminal factor, which was just reduced). That action takes us to state 5. Again, an immediate reduction is possible, using rule 4 (term: factor). After the reduction, the stack has again been reduced to just the start state, and the GOTO action takes us to state 4. At this point, another token is actually necesary. You can read the rest of the trace below; hopefully, you can see what's going on. Reading a token: Next token is token '*' () Shifting token '*' () Entering state 10 Reading a token: Next token is token NUMBER (3) Shifting token NUMBER (3) Entering state 1 Reducing stack by rule 7 (line 22): $1 = token NUMBER (3) -> $$ = nterm factor () Stack now 0 4 10 Entering state 15 Reducing stack by rule 5 (line 20): $1 = nterm term () $2 = token '*' () $3 = nterm factor () -> $$ = nterm term () Stack now 0 Entering state 4 Reading a token: Next token is token '+' () Reducing stack by rule 1 (line 16): $1 = nterm term () -> $$ = nterm expr () Stack now 0 Entering state 3 Next token is token '+' () Shifting token '+' () Entering state 8 Reading a token: Next token is token NUMBER (12) Shifting token NUMBER (12) Entering state 1 Reducing stack by rule 7 (line 22): $1 = token NUMBER (12) -> $$ = nterm factor () Stack now 0 3 8 Entering state 5 Reducing stack by rule 4 (line 19): $1 = nterm factor () -> $$ = nterm term () Stack now 0 3 8 Entering state 13 Reading a token: Next token is token '/' () Shifting token '/' () Entering state 11 Reading a token: Next token is token NUMBER (4) Shifting token NUMBER (4) Entering state 1 Reducing stack by rule 7 (line 22): $1 = token NUMBER (4) -> $$ = nterm factor () Stack now 0 3 8 13 11 Entering state 16 Reducing stack by rule 6 (line 21): $1 = nterm term () $2 = token '/' () $3 = nterm factor () -> $$ = nterm term () Stack now 0 3 8 Entering state 13 Reading a token: Now at end of input. Reducing stack by rule 2 (line 17): $1 = nterm expr () $2 = token '+' () $3 = nterm term () -> $$ = nterm expr () Stack now 0 Entering state 3 Now at end of input. Shifting token $end () Entering state 7 Stack now 0 3 7 Cleanup: popping token $end () Cleanup: popping nterm expr ()
doc_23537331
For example: Task table: +------+-------------+-----------+ | id | name | projectID | +------+-------------+-----------+ | 1 | steal | 3 | | 2 | sell | 2 | | 3 | earn | 1 | +------+-------------+-----------+ project table: +------+-------------+-----------+ | id | name | online | +------+-------------+-----------+ | 1 | stealing | 1 | | 2 | selling | 1 | | 3 | earning | 0 | +------+-------------+-----------+ Select all the tasks where the project is online(online = 1) What I tried: SELECT * FROM `task` LEFT JOIN `project` ON project.id = task.projectID && project.online =1 That results to all the rows from project and from task But I only want the rows from task, and use the join for logical operating A: Use the table name before * to select only rows for a specific table SELECT `task`.* FROM `task` INNER JOIN `project` ON project.id = task.projectID AND project.online = 1 And use a inner join. See this great explanation of joins A: Try: SELECT * FROM `task` LEFT JOIN `project` ON project.id = task.projectID WHERE project.online =1 A: try this : SELECT T.* FROM `task` T LEFT OUTER JOIN `project` P ON P.id = T.projectID WHERE P.online = 1
doc_23537332
#titleBox { margin: 0 auto; width: 350px; background-color: #6da662; height: 100px; color: #fff; font-size: 16.5px; font-weight: bold; } span { line-height: 100px; } <div id="titleBox"> <span>I have 100px line height. || </span> I have 0 line height</div> Not only this I can't change the line height of other span element following the first one. http://jsfiddle.net/qhsnX/4/ #titleBox { margin: 0 auto; width: 350px; background-color: #6da662; height: 100px; color: #fff; font-size: 16.5px; font-weight: bold; } #one { line-height: 100px; } #two { line-height: 10px; color: black; } <div id="titleBox"> <span id="one">I have 100px line height. || </span> <span id="two">I have 10px line height </span> </div> Is this a bug in html language? A: Line-height is used to represent space between lines and is applied to a block element not for inline element. You can either change the span to div or you can use "display:inline-block" property in css
doc_23537333
{% load i18n %} {% get_current_language as LANGUAGE_CODE %} {% get_available_languages as LANGUAGES %} {% get_current_language_bidi as LANGUAGE_BIDI %} the current language is {{ LANGUAGE_CODE }} but I'm getting blank where the code should appear. What am I missing? thanks. A: This is probably one of two problems: * *Make sure you have django.core.context_processors.i18n in settings.TEMPLATE_CONTEXT_PROCESSORS *Make sure you pass RequestContext(request) as your context_instance if you are rendering your template using render_to_response A: You might have left the USE_I18N = False in your settings. see docs
doc_23537334
[2/37] Building CXX object lib\CMakeFiles\cxx_shared.dir\__\src\algorithm.cpp.obj FAILED: lib/CMakeFiles/cxx_shared.dir/__/src/algorithm.cpp.obj C:\PROGRA~1\LLVM\bin\clang-cl.exe /nologo -TP -DNDEBUG -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -D_ALLOW_MSC_VER_MISMATCH -D_CRTBLD -D_CRT_SECURE_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -IC:\Users\User\AppData\Roaming\libcxx-master\include -fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME -D_LIBCPP_NO_VCRUNTIME /MD /O2 /Ob2 /DNDEBUG /std:c++14 -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-compat -Wno-undef -Wno-reserved-id-macro -Wno-gnu-include-next -Wno-gcc-compat -Wno-zero-as-null-pointer-constant -Wno-deprecated-dynamic-exception-spec -Wno-sign-conversion -Wno-old-style-cast -Wno-deprecated -Wno-shift-sign-overflow -Wno-double-promotion -Wno-error -EHsc /Zl /showIncludes /Folib\CMakeFiles\cxx_shared.dir\__\src\algorithm.cpp.obj /Fdlib\CMakeFiles\cxx_shared.dir\ -c C:\Users\User\AppData\Roaming\libcxx-master\src\algorithm.cpp In file included from C:\Users\User\AppData\Roaming\libcxx-master\src\algorithm.cpp:10: In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\random:1645: In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\istream:163: In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\ostream:137: In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\ios:215: In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\__locale:23: In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\support/win32/locale_win32.h:15: In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xlocinfo.h:6: In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\yvals.h:9: In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\crtdbg.h:13: In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\vcruntime_new_debug.h:10: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\vcruntime_new.h(34,16): error: redefinition of 'nothrow_t' struct nothrow_t { ^ C:\Users\User\AppData\Roaming\libcxx-master\include\new(123,25): note: previous definition is here struct _LIBCPP_TYPE_VIS nothrow_t {}; ^ This is my CMAKE. (also tried 19.20) cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="C:/Program Files (x86)/Ninja/ninja.exe" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME -D_LIBCPP_NO_VCRUNTIME" -DCMAKE_C_LINK_EXECUTABLE="C:/Program Files/LLVM/bin/lld-link.exe" -DCMAKE_CXX_LINK_EXECUTABLE="C:/Program Files/LLVM/bin/lld-link.exe" -DLLVM_USE_LINKER="C:/Program Files/LLVM/bin/lld-link.exe" -DLLVM_PATH="C:/Program Files/LLVM" -DLIBCXX_ENABLE_SHARED=YES -DLIBCXX_ENABLE_STATIC=NO -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES "C:/Users/User/AppData/Roaming/libcxx-master" This is my SDK set LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\lib\x64; C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64; C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64 Can I make it work? Where to send issue to whom? A: I face the same issue with VS2019. I removed no_runtime flags but set -DCMAKE_C_LINK_EXECUTABLE="lld-link.exe -flavor link" ^ -DCMAKE_CXX_LINK_EXECUTABLE="lld-link.exe -flavor link" ^ Added -flavor link and it linked successfully. I did not test exceptions but test program with std::thread compiles and runs same as with cl compiler. UPD: basic try-catch with std::exception thrown works UPD: full cmake batch (your paths may vary!) cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="D:/Programming/ninja-build/ninja.exe" ^ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="clang-cl.exe" ^ -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows" ^ -DCMAKE_CXX_COMPILER="clang-cl.exe" ^ -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows " ^ -DCMAKE_C_LINK_EXECUTABLE="lld-link.exe -flavor link" ^ -DCMAKE_CXX_LINK_EXECUTABLE="lld-link.exe -flavor link" ^ -DLLVM_USE_LINKER="lld-link.exe" ^ -DLLVM_PATH="C:/Program Files/LLVM" -DLIBCXX_ENABLE_SHARED=YES ^ -DLIBCXX_ENABLE_STATIC=NO -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES ^ "D:\Programming\cpp_sandbox\libcxx-9.0.0.src"
doc_23537335
I run H2 in cluster mode with 2 nodes. I have two tables in a H2 database (v1.4.189), a parent and a child. The child contains a foreign key to the ID of a row of parent table. Usually, I don't get any errors when inserting a row in child table. But after a while, I'm getting this error when inserting : Referential integrity constraint violation: "CONSTRAINT_1FE: PUBLIC.CHILD FOREIGN KEY(fkey) REFERENCES PUBLIC.PARENT(ID) (86)" The strange thing is that the INSERT INTO data that produced the error was successfully inserted, and that there is no foreign key constraint violation ! I've tried to document the exact steps to reproduce the error, but with a fresh database, the error never happens : drop table CHILD; drop table PARENT; create table CHILD(id int auto_increment, name varchar(255), fkey int); create table PARENT(id int auto_increment, name varchar(255)); ALTER TABLE `CHILD` ADD FOREIGN KEY (fkey) REFERENCES `PARENT` (`id`); insert into PARENT(name) values('hello'); insert into PARENT(name) values('world'); select * from PARENT; insert into CHILD(name, fkey) values('hello', 1); -- this works for a while, but someday the Referential integrity error -- will pop, but data will be added anyway (wtf?) insert into CHILD(name, fkey) values('world', 2); On the database, I'm only doing simple things like selecting, inserting, deleting... The amusing fact is that after this error happened once, I get another strange errors : when deleting (or updating) rows of the CHILD table, the DELETE FROM or UPDATE functions always return 0, even if some rows have been deleted... (also jdbc executeUpdate() always returns 0) Is the database corrupted at some point ? The only workaroud I found to fix this error, is to delete all tables and recreate the tables, which is not what I want to do. A: H2 main developper thomas mueller answered this question on github: This is one of the documented limitations of the cluster feature, see also "Clustering Algorithm and Limitations": "Using auto-increment and identity columns is currently not supported." I'm afraid it's hard to fix it. I suggest to not use the cluster feature for this reason. Support for it will probably be removed in the future. I hope a new cluster / automatic failover feature can be added, but this will take some time. But this might be interesting for you: https://github.com/shesse/h2ha See issue on github I managed to get it working: using sequences and inserting in two times: - Get the nextval for this table sequence, eg: nextid =select childsequence.nextval from dual - Then do your INSERT INTO child and specify the id nextid A: The exception is being thrown because the foreign key is not found, you need to insert the dependent data first. Example: // Execute below query first INSERT INTO root_table VALUES (value1, value2) // Execute below query after root_table INSERT INTO sub_Table VALUES (value1, value2, FK_root_ID)
doc_23537336
So, I installed WSL and an Umbuntu distribution, hoping that's the right direction to go. Now, how can I have VS Code (on Windows) utilize the Linux dist to run NPM scripts, without me being required to mirror all NPM development tools to the Linux OS which I already have installed on Windows.
doc_23537337
I want to use a outbound gateway to send a file, then continue my flow. The problem is that I have an exception telling me: IllegalArgumentException: 'remoteDirectoryExpression' is required I saw that I can use a RemoteFileTemplate where I can set the sftp session factory plus the remote directory information, but the directory I wan't is defined in my flow by the code put in the header just before the launch of the batch. @Bean public IntegrationFlow orderServiceFlow() { return f -> f .handleWithAdapter(h -> h.httpGateway("myUrl") .httpMethod(HttpMethod.GET) .expectedResponseType(List.class) ) .split() .channel(batchLaunchChannel()); } @Bean public DirectChannel batchLaunchChannel() { return MessageChannels.direct("batchLaunchChannel").get(); } @Bean public IntegrationFlow batchLaunchFlow() { return IntegrationFlows.from(batchLaunchChannel()) .enrichHeaders(h -> h .headerExpression("oiCode", "payload") ) .transform((GenericTransformer<String, JobLaunchRequest>) message -> { JobParameters jobParameters = new JobParametersBuilder() .addDate("exec_date", new Date()) .addString("oiCode", message) .toJobParameters(); return new JobLaunchRequest(orderServiceJob, jobParameters); }) .handle(new JobLaunchingMessageHandler(jobLauncher)) .enrichHeaders(h -> h .headerExpression("jobExecution", "payload") ) .handle((p, h) -> { //Logic to retreive file... return new File(""); }) .handle(Sftp.outboundGateway(sftpSessionFactory, AbstractRemoteFileOutboundGateway.Command.PUT, "payload") ) .get(); } I don't see how I can tell my outbound gateway which will be the directory depending what is in my header. A: The Sftp.outboundGateway() has an overloaded version with the RemoteFileTemplate. So, you need to instantiate SftpRemoteFileTemplate bean and configure its: /** * Set the remote directory expression used to determine the remote directory to which * files will be sent. * @param remoteDirectoryExpression the remote directory expression. */ public void setRemoteDirectoryExpression(Expression remoteDirectoryExpression) { This one can be like FunctionExpression: setRemoteDirectoryExpression(m -> m.getHeaders().get("remoteDireHeader")) A: Before I got an answer, I came with this solution but I'm not sure it's a good one. // flow // .handle((p, h) -> { //Logic to retreive file... return new File(""); }) .handle( Sftp.outboundGateway( remoteFileTemplate(new SpelExpressionParser().parseExpression("headers['oiCode']")), AbstractRemoteFileOutboundGateway.Command.PUT, "payload") ) .handle(// next steps //) .get(); public RemoteFileTemplate remoteFileTemplate(Expression directory) throws Exception { RemoteFileTemplate template = new SftpRemoteFileTemplate(sftpSessionFactory); template.setRemoteDirectoryExpression(directory); template.setAutoCreateDirectory(true); template.afterPropertiesSet(); return template; } But this provoke a warn because of exception thrown by the ExpresionUtils java.lang.RuntimeException: No beanFactory
doc_23537338
I am trying to draw a table on the Canvas, by looping through a list and adding a right and left column for each item, represented by using the Rect The function responsible for drawing the table rows is shown below: fun drawTableRow(canvas: Canvas, question: Document.H) { val textBounds = Rect() var cellHeight = if(question.value.isNullOrEmpty()) { 20f } else { paint.getTextBounds(question.value, 0, question.value!!.length, textBounds) textBounds.height().toFloat() } if(cellHeight <= 20f) cellHeight = 20f paint.textAlign = Paint.Align.LEFT val top = yPointer val right = (width.toFloat() - (pageMargin * 2)) / 3 val bottom = height - (yPointer + cellHeight + pageMargin) val leftCell = RectF(pageMargin, top, right, bottom) val rightCell = RectF(leftCell.right, top, pageMargin, bottom) var textY = yPointer + yPadding canvas.drawRect(rightCell, contentBgPaint) canvas.drawRect(leftCell, contentBgPaint) canvas.drawText(question.h.hQuestion.title, 0, question.h.hQuestion.title.length, pageMargin, textY, paint) canvas.drawText(question.h.hQuestion.subtitle, 0, question.h.hQuestion.subtitle.length, pageMargin, textY + 16f, paint) canvas.drawText(question.value!!, 0, question.value!!.length, leftCell.right, textY, paint) yPointer += cellHeight.toInt() } And when running the debugger, the Rect coordinates seem to be set correctly. However, an usual behavior occurs - either only one rectangle is being drawn, or the rectangles are overlapping each other exactly, despite having different coordinates. Because if I attempt to only draw the right rectangle, it still appears on the left side in the document, with the exact proportions of the left rectangle, as seen in the image below. A: It was a stupid mistake. The documentation for RectF clearly states that left <= right and top <= bottom. The debugger clearly shows that the right cell has a left value that is > right. I replaced pageMargin with width.toFloat() - pageMargin in the right cell, which solved the issue.
doc_23537339
serialHelper is a class module arround python serial and this code does work nicely #!/usr/bin/env python import threading from time import sleep import serialHelper sh = serialHelper.SerialHelper() def serialGetter(): h = 0 while True: h = h + 1 s_resp = sh.getResponse() print ('response ' + s_resp) sleep(3) if __name__ == '__main__': try: t = threading.Thread(target=sh.serialReader) t.setDaemon(True) t.start() serialGetter() #tSR = threading.Thread(target=serialGetter) #tSR.setDaemon(True) #tSR.start() except Exception as e: print (e) however the attemp to run serialGetter as thread as remarked it just dies. Any reason why that function can not run as thread ? A: Quoting from the Python documentation: The entire Python program exits when no alive non-daemon threads are left. So if you setDaemon(True) every new thread and then exit the main thread (by falling off the end of the script), the whole program will exit immediately. This kills all of the threads. Either don't use setDaemon(True), or don't exit the main thread without first calling join() on all of the threads you want to wait for. Stepping back for a moment, it may help to think about the intended use case of a daemon thread. In Unix, a daemon is a process that runs in the background and (typically) serves requests or performs operations, either on behalf of remote clients over the network or local processes. The same basic idea applies to daemon threads: * *You launch the daemon thread with some kind of work queue. *When you need some work done on the thread, you hand it a work object. *When you want the result of that work, you use an event or a future to wait for it to complete. *After requesting some work, you always eventually wait for it to complete, or perhaps cancel it (if your worker protocol supports cancellation). *You don't have to clean up the daemon thread at program termination. It just quietly goes away when there are no other threads left. The problem is step (4). If you forget about some work object, and exit the app without waiting for it to complete, the work may get interrupted. Daemon threads don't gracefully shut down, so you could leave the outside world in an inconsistent state (e.g. an incomplete database transaction, a file that never got closed, etc.). It's often better to use a regular thread, and replace step (5) with an explicit "Finish up your work and shut down" work object that the main thread hands to the worker thread before exiting. The worker thread then recognizes this object, stops waiting on the work queue, and terminates itself once it's no longer doing anything else. This is slightly more up-front work, but is much safer in the event that a work object is inadvertently abandoned. Because of all of the above, I recommend not using daemon threads unless you have a strong reason for them.
doc_23537340
Currently I'm making just for an example for how to use it right. CREATE OR REPLACE PROCEDURE "STG"."TRUNC_TEST" AS BEGIN execute immediate 'truncate table TESTSP'; END; That's my example of simple stored procedure. My job design probably seen like this Oracle Connector 1=>Transformer=>Oracle Connector 2=>Stored Procedure Stage Oracle Connector 1 do Select, Oracle Connector 2 do Insert to TESTSP My settings in the stored procedure stage General : I've already put all the credential , with Transaction ISO as None Syntax Procedure Name : TRUNC_TEST Procedure Type : Transform (i've also tried to change it to Target) Database Procedure Type : Stored Procedure Generate procedure call (checked) Parameters Empty Error Codes Empty NLS Map Project Default UTF-8 Advanced Execution mode :Default(Sequential) Combinability : Default Configuration file : default In the Input tabs General Execute Procedure for each row (checked) Transaction size : 0 Partitioning Collector type Auto Columns Just brought all the columns from Oracle connector 2 Advanced Default The job showing green line and success, but the SP isn't working. It should've been truncate the TESTSP table, but when I do a select *, the data is still there. Maybe my stored procedure is wrong since I'm still learning how to make it? Or maybe there is something wrong with my 'Settings' in the stored procedure stage? A: Every time you are running your job, you are just creating or replacing the SP definition. You will have to call the SP in order to execute it. That is the reason you are able to execute it outside. I suggest you to create a generic SP in your database which will accept table name as parameter. Once this is created, use SP stage to invoke the SP with column you want to truncate. You can also use after SQL option in oracle connector to avoid extra SP stage.
doc_23537341
<span ng-if="checkValidityForDate(fields.secondaryAction[$index],fields.secondaryAction[$index].attributes[0].name,$index,fields.secondaryAction[$index].action.action_name) == true && flagForUniqueActionsDict[$index] == false" style="display:inline-block;" flex> <input class="hidden" name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-datatype" value="date"></input> <select id="date" class="date-field" name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-date" ng-model="fields.secondaryAction[$index].attributes[0].filterModifier" style="margin: 10px;display:inline-block;" ng-init="fields.secondaryAction[$index].attributes[0].filterModifier=(fields.secondaryAction[$index].action.action_name+'-is_between')" flex> <option value="{{fields.secondaryAction[$index].action.action_name}}-is_between" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_between')">is between</option> <option value="{{fields.secondaryAction[$index].action.action_name}}-is_less_than" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_less_than')">is less than</option> <option value="{{fields.secondaryAction[$index].action.action_name}}-is_greater_than" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_greater_than')">is greater than</option> <option value="{{fields.secondaryAction[$index].action.action_name}}-is_equal_to" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_equal_to')">is equal to</option> <option value="{{fields.secondaryAction[$index].action.action_name}}-in_the_last" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-in_the_last')">in the last</option> </select> <span id="is_between" class="date-options" ng-if="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_between')"> <!-- Test Begins --> <span class="input-group ui-datepicker" style="margin-bottom: -14px;display:inline-block;" data-ng-controller="DatepickerDemoCtrl" flex> <input type="text" class="form-control" datepicker-popup="{{format}}" id="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val1" name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val1" ng-model="fields.secondaryAction[$index].attributes[0].filterValue" is-open="opened" datepicker-options="dateOptions" style="display:inline-block;width:120px;height:30px;" close-text="Close" ng-click="open($event)"> </span> <span style="margin-left:10px;margin-right:10px;">and</span> <span class="input-group ui-datepicker" style="margin-bottom: -14px;width:200px;display:inline-block;" data-ng-controller="DatepickerDemoCtrl" flex> <input type="text" class="form-control" datepicker-popup="{{format}}" id="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val2" name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val2" ng-model="fields.secondaryAction[$index].attributes[0].filterValue1" is-open="opened" datepicker-options="dateOptions" style="display:inline-block;width:120px;height:30px;" close-text="Close" ng-click="open($event)"> </span> <!-- Test Ends --> </span> My problem is - When fields.secondaryAction[$index].action.action_name gets updated (from a different dropdown), the values of Select Dropdown gets updated. However, the ng-model fields.secondaryAction[$index].attributes[0].filterModifier never gets updated based on the new values. Any solution for this?
doc_23537342
I do not know if int (a) is necessary. from sys import exit class Glowna_klasa(object): def start(self): suma = 0 a = int(input("Take a number: ")) print("Now suma have: ", suma) if int(suma) == 8: print("END") exit(1) if int(a) == 2: print("2 sztuki majΔ…: 1.40") # here need add to suma ? return self.start() elif int(a) == 3: print("3 sztuki majΔ…: 2.30") return self.start() elif int(a) == 4: print("4 sztuki majΔ…: 3.20") return self.start() else: print("Error, need number") crv = Glowna_klasa() crv.start() This is what i need: >>>Take a number: 2 >>>2 sztuki majΔ…: 1.40 >>>Now suma have: 2 >>>Take a number: 2 >>>2 sztuki majΔ…: 1.40 >>>Now suma have: 4 >>>Take a number: 4 >>>4 sztuki majΔ…: 3.20 >>>Now suma have: 8 >>>END A: Your overall structure is more complicated than the problem suggests. You are trying to keep a "running sum" of input, until you reach a given value. Consider this structure: laczny = 0 while laczny < 8: wybor = int(input("Take a number: ")) laczny += wybor print("Now laczny have: ", laczny) # work on wybory 0, 1, 2, 3, ... print("END") No class, no recursion, no exit from the middle. Easier for you, I hope.
doc_23537343
I have a class which implements IPresenter : public class SoldierPresenter : IPresenter { ... public SolierPresenter(ISoldierView soldierView) { } ... } When I call : var presenters = ObjectFactory.GetAllInstances<IPresenter>(); I get zero instances... what am i missing?! Here is the configuration code for the container: Scan( scanner => { scanner.AssemblyContainingType(typeof(IShell)); scanner.WithDefaultConventions(); scanner.TheCallingAssembly(); scanner.AddAllTypesOf<IPresenter>(); scanner.WithDefaultConventions(); }); Thanks in advance, Erik. Container.WhatDoIHave(); Shows the following: IPresenter (DutyManager.Presentation.Framework.IPresenter) DutyManager.Presentation.SoldiersPresenter, DutyManager.Presentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Configured DutyManager.Presentation.SoldiersPresenter, DutyManager.Presentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Scoped as: PerRequest ISoldiersView (DutyManager.Presentation.ISoldiersView) DutyManager.Presentation.SoldiersView, DutyManager.Presentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null DutyManager.Presentation.SoldiersView, DutyManager.Presentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Scoped as: PerRequest A: Your code sample does not provide enough information. Are you configuring the container owned by ObjectFactory, or are you creating your own instance of Container? ObjectFactory can only access its own Container. You are trying to call GetAllInstances on ObjectFactory, but you call WhatDoIHave on Container. It is not clear which container you are configuring with the "Scan" statement you included. Using the code you provided (and assuming use of ObjectFactory throughout), I was not able to reproduce your issue. Make sure you are consistently using the same container. If that doesn't solve your problem, you might consider posting to the StructureMap mailing list, where it will get a lot more attention from StructureMap users.
doc_23537344
Incidentally, I'm upgrading some ancient (10+ year-old) code to compile on a modern C++ compiler. /* WordStore.h */ #ifndef WORD_STORE_H #define WORD_STORE_H class WordStore { public: WordStore(); }; #endif // semclass.h #ifndef SEMCLASS_H #define SEMCLASS_H #include <iostream> using namespace std; void ReadSemRules(std::istream& stream, WordStore& ws); #endif // semclass.cxx #include <iostream> #include <string.h> #include "WordStore.h" #include "SemClass.h" using namespace std; void ReadSemRules(istream& stream, WordStore& ws) { } A: You have stray unprintable character in your program between the m and the &: https://godbolt.org/g/gAAoGn void ReadSemRules(std::istream& stream, WordStore& ws); ^^
doc_23537345
B = Button(newWindow[num], text="Change Direction", command=lambda: clk == change_direction_dummy(CLOCK,)) B.grid(row=4, column=2) B.after(2000, B.destroy())
doc_23537346
If you compile to ES3, you have the widest support, but also additional boilerplate for compatibility (size, partially impossible to parse). If you target esnext, you basically have no boilerplate (clean output code!), but very limited support. The problem is that the TypeScript compiler does not transpile JS code or any code from node_modules in general. Hence, if you e.g. compile a library to ES6 and someone wants to use it in their browser app (targeting ES3 or ES5), then they wouldn't be able to just use that library. What is the best practice here? How should I configure my package.json and tsconfig.json? And if the library user will need to do something, what's the preferred way here? Thanks a lot! A: I think there can be compromise. For me the main reason to use es6 in the library - to support rollup's tree-shaking. For this the package.json has option module: "main": "dist/alina-core.js", "module": "dist/alina-core-es.js", When user uses rollup, it will be required to transpile to ES5 after tree-shaking anyway, so, in module specified ES6 version. But if library user uses old build pipeline, he will get main transpiled ES5 version.
doc_23537347
void packedBlend16(uint8_t mask, uint16_t* dst, uint16_t const* a, uint16_t const* b) { for (int i = 0; b < 8; ++i) { int const control = mask & (1 << i); dst[i] = control ? a[i] : *b++; } } The tricky part for me is spacing out the elements of b correctly in the vector. So far, my approach is: * *256 entry LUT[mask] to get a shuffle that expands the elements of b in the right place with pshufb *Construct a blend vector from the mask with vpbroadcastw + vpand + vpcmpeqw *pblendvb a with the shuffled elements of b I suspect that a 256 entry LUT is not the best approach. I could potentially have 2 16 entry LUT's for the upper/lower bits. But you would have to add an offset to the upper LUT based on the popcnt of the lower 4-bits of the mask. I'm doing 4 of these independently at a time, so I want to maximize throughput, but can accept latency. Are there other approaches that I could take?
doc_23537348
Controller: public function update() { $string = 'xml/gzip'; $xml = simplexml_load_file("compress.zlib://$string"); foreach ($xml->merchant as $merchant) { $merchant_name = $merchant['name']; $merchant_id = $merchant['id']; $data1 = array( 'merchant_id' => $merchant_id, 'merchant_name' => $merchant_name ); $this->load->model('Administration_model'); $this->Administration_model->insert_merchants($data1); } } Model: public function insert_merchants($data1) { $this->db->insert('merchants', $data1); } The foreach loop in my controller is running data from an xml spreadsheet, and as the error says - the values '911' and 'website.com' SHOULD be the inserted values... So why is it determining 'website.com' as a 'field list'? Error: A Database Error Occurred Error Number: 1054 Unknown column 'website.com' in 'field list' INSERT INTO `merchants` (`merchant_id`, `merchant_name`) VALUES (911, website.com) Would it have anything to do with the fact that merchant_id is a primary column and this is technically a duplicate entry... And if so, any tips on how to add "ON DUPLICATE KEY..." functionality? A: You need to quote strings, else it thinks you are referring to column names. INSERT INTO `merchants` (`merchant_id`, `merchant_name`) VALUES (911, 'website.com') A: Your code doesn't look like it has any problems with it. I would suggest upgrading to the latest version of CodeIgniter, currently 3.1.5, and re-running your code. $data = array( 'merchant_id' => 911, 'merchant_name' => 'website.com', ); $this->db->insert('merchants', $data); If you still have problems, try hard coding a value and put the let us know what happens. As for your duplicate key issue, CodeIgniter 3.1.5 has a replace function which updates on a duplicate key. Do keep in mind the performance loss of using this, as for a large import this could be very slow. For large datasets, look into batching the queries. $data = array( 'merchant_id' => 911, 'merchant_name' => 'website.com', ); $this->db->replace('merchants', $data);
doc_23537349
So far I have: ISession session = .... IQuery query = session.CreateQuery("exec LogData @Time=:time @Data=:data"); query.SetDateTime("time", time); query.SetString("data", data); query.?????; What should the method ????? be? Or am doing something more fundamentally wrong? A: ExecuteUpdate on SQL Query should help you. Sample: ISession session = .... IQuery query = session.CreateSQLQuery("exec LogData @Time=:time, @Data=:data"); query.SetDateTime("time", time); query.SetString("data", data); query.ExecuteUpdate(); A: This seems to be a limitation of NHibernate, from NHibernate Documentation: The procedure must return a result set. NHibernate will use IDbCommand.ExecuteReader() to obtain the results. A: NHibernate allows you to do object-oriented programming and takes care of fetching the objects from and saving the objects to the database behind the scenes. NHibernate does not provide you with an easy API for simply executing stored procedures, because that doesn't seem to have much to do with object-oriented programming, whether fetching objects or saving them. So you are doing something fundamentally wrong in attempting to use NHibernate directly to execute highly procedural code. If you want to use NHibernate, you have to tell it how executing this stored procedure behind the scenes will magically help with fetching objects from and saving objects to the database. You can: * *Use ADO.NET directly, opening a new IDbConnection or getting the ISession's connection, creating an IDbCommand, etc. Do this if you need a one-off approach to executing stored procedures. *Create an NHibernate listener and configure it in the Configuration, to execute this stored procedure when certain other events are sent through the NHibernate pipeline. Only do this if this stored procedure should actually be executed every time and only when these events occur. A: You can use UniqueResult to execute a stored proc that doesn't return anything. I'm using the following to call a stored proc that either inserts or updates a record to track users currently logged in to our ASP.NET MVC site. IQuery query = session.GetNamedQuery("UserSession_Save"); query.SetInt32("UserID", userID); query.SetString("CookieID", cookieID); query.SetString("Controller", controller); query.SetString("Action", action); query.UniqueResult(); A: In general, calling a procedure that does some other chores and return a result set at the end is not different than making a SELECT query. Therefore, in the answers above, when executing the query in the last step you need to call query.List<T>(); where T is a POCO object that is defined in your code. A: Do following solutions: public void Test(TestEntity TestEntity) { IQuery query = NHSession.CreateSQLQuery("exec LogData :Time, :Data"); query.SetParameter("Time", TestEntity.Time); query.SetParameter("Data", TestEntity.Data); object obj = query.UniqueResult(); }
doc_23537350
var regexOne = /^(regex).*$/gm; var regexTwo = /^(regex).*$/gm; var regexThree = /^(regex).*$/gm; var regexFour = /^(regex).*$/gm; var searchQuery = [regexOne, regexTwo, regexThree, regexFour]; for(query in searchQuery){ console.dir(query.toString()); } The above code prints: '0' '1' '2' '3' How can i get this working. A: When you iterate an Array with for..in loop, the loop variable with have just the current index as string, not the actual value. Quoting MDN documentation on Array iteration and for...in, The for..in statement iterates over the enumerable properties of an object, in arbitrary order. .... .... Note: for..in should not be used to iterate over an Array where index order is important. Array indexes are just enumerable properties with integer names and are otherwise identical to general Object properties. There is no guarantee that for...in will return the indexes in any particular order and it will return all enumerable properties, including those with non–integer names and those that are inherited. Because the order of iteration is implementation dependent, iterating over an array may not visit elements in a consistent order. Therefore it is better to use a for loop with a numeric index (or Array.forEach or the for...of loop) when iterating over arrays where the order of access is important. The bold text above says it all. So, you should iterate arrays with one of the following options * *normal for loop for(var i = 0; i < searchQuery.length; i += 1) { console.dir(searchQuery[i]); } *Array.prototype.forEach function searchQuery.forEach(function(currentRegEx) { console.dir(currentRegEx); }); *for...of, loop (Note: This will work only in environments which implement ECMAScript 6) for(var currentRegEx of searchQuery) { console.dir(currentRegEx); } A: for-in, in JavaScript, loops through the enumerable property names of an object. It's not for looping through array entries or array indexes (although with safeguards it can be used for the latter, which is why you're seeing 0, 1, etc.Β β€” those property names are array indexes). For details about looping through arrays, see this answer, which has a thorough list of options and explanations of each of them. Side note 1: Your code is falling prey to The Horror of Implicit Globals because you never declare the query variable. (The for-in construct doesn't declare it for you.) Side note 2: Unless you need the regexOne and such variables, you can create your array of regexes more concisely: var searchQuery = [ /^(regex).*$/gm, /^(regex).*$/gm, /^(regex).*$/gm, /^(regex).*$/gm ];
doc_23537351
Now I noticed that bindValue() has an optional paramType parameter that can be set to QSql::Out and QSql::InOut. Is it correct that the QSql::Out and QSql::InOut arguments are useful when CALLing procedures and that they have no use for lets say a SELECT statement? Are there other use cases than CALL? A: It turned out that QSql::Out and QSql::InOut are actually intended for use with procedure calls only. However it also turned out that Qt/MySQL parameter binding does not support the mentioned OUT and INOUT parameters types (see here).
doc_23537352
Here's what I've got in my view: <label>Group: <input ng-model="group" ui-select2="select2GroupConfig"></label> Here's what I have in my model: $scope.select2GroupConfig = { ajax: { url: 'theURL', data: function (term, page) { return { q: term }; }, results: function (data, page) { return { results: data }; } } }; This works as expected. My question: How can I update the value via the model? I tried: $scope.group = 'some group'; I also tried using an object: $scope.group = { id: 32, text: 'some group'}; but that doesn't either work. How do you update a select2 that uses AJAX, via the model? A: Turns out you can set it to an object, but only after ui-select2 runs; I was trying to give it an initial value. So, instead of using the regular model, you have to use select2's initSelection function: $scope.group = 'Dummy Content'; $scope.select2GroupConfig.initSelection = function ( el, fn ) { fn({ id: 2, text: 'Some group' }); } Note that you have to give the input an initial value, otherwise initSelection is never called. That's why I'm just setting it to some dummy content. This works, but it feels like a hack. Does anybody have any better ideas? A: If you have initSelection setup, you can pass just the ID and the directive will pull up the entire row object. This will also allow you to set the value when the page loads to just the ID too. If you don't want to use initSelection you can set the entire row (object) as the value and select2 will update accordingly. It all depends on your use-case however.
doc_23537353
navigator.device.capture.captureVideo(videoCaptureSuccess, videoCaptureError, {limit:1}); function videoCaptureSuccess(fileURL) { window.resolveLocalFileSystemURI(fileURL, function(fileEntry) { // doing something }); } resolveLocalFileSystemURI not working as the path is something like '/private/var/mobile/...'. But for image it is '/var/mobile/...' Please help me to save the captured video to the app documents Thanks in advance
doc_23537354
class Object { ... vector<Object*> objlist; ... }; Now, Objects will be added to list in both of these ways: Object obj; obj.objlist.push_back(new Object); and Object name; Object* anon = &name; obj.objlist.push_back(anon); If a make a destructor that is simply ~Object { for (int i = 0; i < objlist.size(); i++) { delete objlist[i]; objlist[i] = NULL; } } Will there be any adverse consequences in terms of when it tries to delete an object that was not created with new? A: No, you can only delete what you newed Object* anon = &name; When name goes out of scope, you will have an invalid pointer in your vector. A: Yes, there will be adverse effects. You must not delete an object that was not allocated with new. If the object was allocated on the stack, your compiler has already generated a call to its destructor at the end of its scope. This means you will call the destructor twice, with potentially very bad effects. Besides calling the destructor twice, you will also attempt to deallocate a memory block that was never allocated. The new operator presumably puts the objects on the heap; delete expects to find the object in the same region the new operator puts them. However, your object that was not allocated with new lives on the stack. This will very probably crash your program (if it does not already crash after calling the destructor a second time). You'll also get in deep trouble if your Object on the heap lives longer than your Object on the stack: you'll get a dangling reference to somewhere on the stack, and you'll get incorrect results/crash the next time you access it. The general rule I see is that stuff that live on the stack can reference stuff that lives on the heap, but stuff on the heap should not reference stuff on the stack because of the very high chances that they'll outlive stack objects. And pointers to both should not be mixed together. A: This will not work - if you delete an object that wasn't allocated by new you've violated the rules or the delete operator. If you need to have your vector store objects that may or may not need to be deleted, you'll need to keep track of that somehow. One option is to use a smart pointer that keeps track of whether the pointed to object is dynamic or not. For example, shared_ptr<> allows you to specify a deallocator object when constructing the shard_ptr<> and as the docs mention: For example, a "no-op" deallocator is useful when returning a shared_ptr to a statically allocated object However, you should still be careful when passing pointers to automatic variables - if the vector's lifetime is longer than the lifetime of the variable then it'll be refering to garbage at some point. A: What you're actually asking is whether it's safe to delete an object not allocated via new through the delete operator, and if so, why? Unfortunately, this is obfuscated by some other problems in your code. As mentioned, when name goes out of scope, you're going to end up with an invalid pointer. See zneak's answer for why your original question doesn't result in a safe operation, and why the scope for name actually matters.
doc_23537355
Laravel Framework 8.77.1 PHP 7.4.3 The database table is What I am trying is the Laravel Query public function search_friend_custom(Request $request) { $search = $request->input('search'); $search = 'chase '; // ** $Search variable has chase string for searching.** $friends = DB::table('users') ->select('users.*','users.id as user_tab_id') ->where('role_id', 2) ->where('name', 'like', '%' . $search . '%') ->orWhere('first_name', 'like', '%' . $search . '%') ->orWhere('last_name', 'like', '%' . $search . '%') ->paginate(10); return view('user.custom_search' , compact('friends')); } What it is returing are both Chase's Hadyman Services with role_id=3 and Chase Mary role_id=2 both. But the aspected result is only Chase Mary as it's role_id is 2. Please guide, I am not getting what I am missing here? A: You should logically group them inside a closure so your role_id takes precedence but doesn't interfere with the rest of the query. $friends = DB::table('users') ->select('users.*','users.id as user_tab_id') ->where('role_id', 2) ->where(fn($builder) => $builder->where('name', 'like', '%' . $search . '%') ->orWhere('first_name', 'like', '%' . $search . '%') ->orWhere('last_name', 'like', '%' . $search . '%') )->paginate(10); See the documentation for more references.
doc_23537356
Possible Duplicate: Can't run a ruby hello world application in Aptana I've just installed the latest version of Aptana. I've then tried to create a project, residing in C:\Users\User\My Documents\Aptana Studio 3 Workspace\abc that only contains a single main.rb file with the following contents: puts "hello world" When trying to run it, it spits out the following message: c:\Ruby192\bin\rubyw.EXE: No such file or directory -- User/AppData/Local/Aptana (LoadError) The c:\Ruby192\bin\rubyw.EXE file name seems correct. When looking in the configuration options, the full filename of the file to be run also seems correct. I've tried to copy the main.rb to C:\, as it looked at first glance as the problem could be related with white spaces, but even then the error remains the same! I wonder what the problem might be? A: Try adding C:\Ruby192\bin to your PATH environment variable. See how that works. A: I don't know if this will fix it, but Max gave the following answer to a similar problem I had asked about: This has been fixed in 3.0.4 which is now under QA and will be public early this week. You have a choice of either wait or switch to Beta builds following instructions at http://wiki.appcelerator.org/display/tis/Changing+the+Update+Type Cheers, Max
doc_23537357
signal(SIGABRT, SignalHandler); A: Nope; there can only be one signal handler per signal. Note also the trying to do just about anything in a signal handler is impossible. You can't make any system calls, can't really allocate memory, and can't use Objective-C. As well, trying to catch SIGABRT is futile. By the time that is sent, it indicates that your app is well into the weeds. Trying to recover from such a state is rife with fragility. What are you trying to do?
doc_23537358
port: 9191 -- cloud: gateway: routes: - id : USER-SERVICE uri : lb://USER-SERVICE predicates : - Path=/users/** - id: DEPARTMENT-SERVICE uri: lb://DEPARTMENT-SERVICE predicates: - Path=/departments/** -- spring: application: name: API-GATEWAY eureka: client: register-with-eureka: true fetch-registry: true service-url: defaultzone: http://localhost:8761/eureka/ instance: hostname: localhost
doc_23537359
Can somebody provide a step by step guide on how to get FireBug working on IE9. Thank you. A: Check out the IE developer toolbar for use with IE9: http://www.microsoft.com/en-us/download/details.aspx?id=18359, or firebug lite: http://getfirebug.com/firebuglite. A: Even better, if you are trying to debug a jsp or html page just stick this tag in the file: <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
doc_23537360
For the current record, we have the option of using a date literal such as '12/31/9999' or specify it as NULL. The dimension tables also have an additional 'current_flag' attribute in addition to 'start_date' and 'end_date'. It is probably a minor design decision but just wanted to see if there are any advantages of using one over the other in terms of query performance or in any other way? A: I have seen systems written both ways. Personally, I go for the infinite end date (but not NULL and the reason is simple: it is easier to validate that the type-2 records are properly tiled, with no gaps or overlaps. I prefer only one validation to two -- the other being the validation of the is_current flag. There is also only one correct way of accessing the data. That said, a system that I'm currently working on also publishes a view with only the current records. That is handy. That system is not in SQL Server. One optimization that you can attempt is clustering so the current records are all colocated -- assuming they are much more commonly accessed. You can do this using either method. Using a clustered index like this makes updates more expensive, but they can be handy for optimizing memory.
doc_23537361
Please let me know how we can set the RowHeight of the list item dynamically. var StatusList = new ListView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, RowHeight = Constants.CategoryRowHeight + 60, BackgroundColor = Constants.BackgroundColor, ItemTemplate = GetDataTemplate() }; A: You can set the HasUnevenRows property of ListView to True. var StatusList = new ListView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HasUnevenRows = true, RowHeight = Constants.CategoryRowHeight + 60, BackgroundColor = Constants.BackgroundColor, ItemTemplate = GetDataTemplate() }; A: There is a bug on iOS which causes that the rows cannot have different heights. Setting HasUnevenRows=true only causes that you can set a custom height for ALL cells. If this bug ever gets fixes, I can inform you. But: this will work for UWP and Android, so you can use a different CellView for iOS instead
doc_23537362
I want to change the panel content in the expanded row and reply button is pressed and also keep the row in the dataTable expanded. If I can resolve this issue it will be nice. I also used partiallySubmit property to update only some components with ajax, not all. I provide the code here: <p:dataTable id="topicDataTable" value="#{index.topics}" var="topic" rowIndexVar="row" rowKey="#{topic.id}" style="border:none;" onExpandStart="getExpandedRow()"> <!-- expandedRow="#{true}" --> <p:column style="border-style:none;"> <p style="padding-left: 50px; font-size: 8px;"> <br /> </p> <p style="font-size: 18px;">#{topic.title}</p> <p style="font-size: 8px;">#{topic.displayedCreatedOn}</p> </p:column> <p:column style="width:2%; border-style:none;"> <p:rowToggler /> </p:column> <p:rowExpansion style="border:none;"> <p style="font-size: 16px;"> <br /> </p> <div style="padding-left: 30px;"> <h:form id="replyForm" style="width:100%"> <p:panel id="repeatPanel"> <p:scrollPanel id="scrollPanel" style="padding-left:50px;max-height:300px; overflow-y: auto;" mode="native"> <p:repeat id="repeatComponent" value="#{topic.messages}" var="reply"> <!-- rowIndexVar="row" --> <div style="padding-left: 30px; font-size: 14px;"> <p style="font-size: 14px; color: black;">#{reply.createdBy}</p> <p style="font-size: 8px; line-height: 12px"> #{reply.displayedCreatedOn}</p> <p style="font-size: 4px;"> <br /> </p> <p style="color: rgba(0, 0, 0, .5); white-space: pre-wrap; font-size: 14px;">#{reply.text}</p> </div> <p style="padding-left: 50px; font-size: 16px;"> <br /> </p> </p:repeat> </p:scrollPanel> <!-- <h:form id="replyForm" style="width:100%"> --> <p> <p:inputTextarea id="replyArea" binding="#{replyInput}" required="true" requiredMessage="The reply should not be empty" style="vertical-align: middle; width:99.3%; " /> </p> <p> <p:message for="replyArea" style="color:red; font-size: 14px; " /> </p> <p style="font-size: 8px;"> <br /> </p> <p> <p:commandButton value="Reply" style="font-size: 12px; float:right; vertical-align:right;" partialSubmit="true" actionListener="#{index.updateMessages}" process="@form" update="replyForm:repeatPanel" onstart="saveScrollPos()" oncomplete="getScrollPos()"> <!-- process="@form topicaDataTable:#{row}:repeatPanel"" --> <f:attribute name="rowId" value="#{row}" /> </p:commandButton> </p> <p style="padding-left: 50px; font-size: 8px;"> <br /> </p> <!-- </h:form> --> </p:panel> </h:form> </div> <p style="padding-left: 50px; font-size: 16px;"> <br /> </p> </p:rowExpansion> </p:dataTable>
doc_23537363
Unfortunately I have a number of PDFs that ghostscript cannot render accurately so I have been experimenting with sips. I can get faithfully rendered jpegs out of sips but only at the normal resolution. However, if I ask sips to zoom in as I do with ghostscript, the fonts looks very pixelated, almost as if rasterizes the PDF first then increases size of the bitmap it has created. Is there any way to tell sips to zoom first then rasterize as ghostscript appears to be doing?
doc_23537364
Currently I am trying to achieve the above by running a Lambda that writes to the table when the above events occur. I'm having trouble finding tag-related triggers for my use case. Here are some potential solutions that I've researched: * *S3 PUT trigger, for detecting tag creation: However, it seems like this trigger is only activated for object creation, and not for PutObjectTagging PUT requests. * *Creating a CloudWatch rule for detecting tag changes: The problem with this one is that the tag support doesn't seem to include anything beyond the service level, such as tag changes to S3 objects. Also, tag creation and deletion are left out by this solution.
doc_23537365
<?php global $Sys; //echo $Sys->Auth->chkAuth(); if(isset($_POST['update_slider'])) { unset($_POST['update_slider']); $post = $_POST; unset($_POST); foreach($post as $name => $value) { $value = (is_numeric($value)) ? $value : intval($value); $result = $Sys->db->query("UPDATE dj_photo SET slider_status = $value WHERE name = $name"); } if($result->affected_rows != 0) { $Sys->Template->setAlerts($result->affected_rows . ' images were added to the image slider.'); } else { $Sys->Template->setAlerts('No images were added to the slider.', 'error'); } } ?> <div id="webCfg"> <h2>Website Configuration</h2> <?php global $Sys; $alerts = $Sys->Template->getAlerts(); if ($alerts != '') { echo '<div><ul class="alerts">' . $alerts . '</ul></div>'; } $result = $Sys->db->query('SELECT * FROM dj_photo ORDER BY group_name ASC'); ?> <form action="" method="post"> <table cellpadding="1" cellspacing="0" id="webCfgTbl"> <tr><td class="label"><label for="submit"></label></td><td class="content"><div class="row submitrow"><input type="submit" id="submit" name="update_slider" class="submit" value="Update Slider" /></div></td></tr> <tr> <?php $i = 1; while($slider = $result->fetch_object()) { if($slider->slider_status == 1) { $add = 'selected'; } else { $remove = 'selected'; } if(($i % 6) == 0) { echo " Slider Name: " . $slider->name; echo '<td><div class="adm_slider_pics"><img style="width:180px;height:120px;" alt="' . ucfirst($slider->name) . '" src="../photogallery/' . $slider->img_group . '/' . $slider->name . '" title="' . ucfirst($slider->title) . '" /></a></td><td class="content"><select name="' . $slider->name . '"><option value="1" ' . $add . '>Add</option><option value="0" ' . $remove . '>Remove</option></select></div></td></tr><tr>'; } else { echo " Slider Name: " . $slider->name; echo '<td><div class="adm_slider_pics"><img style="width:180px;height:120px;" alt="' . ucfirst($slider->name) . '" src="../photogallery/' . $slider->img_group . '/' . $slider->name . '" title="' . ucfirst($slider->title) . '" /></a></td><td class="content"><select name="' . $slider->name . '"><option value="1" ' . $add . '>Add</option><option value="0" ' . $remove . '>Remove</option></select></div></td>'; } $i++; } ?> <tr><td class="label"><label for="submit"></label></td><td class="content"><div class="row submitrow"><input type="submit" id="submit" name="update_slider" class="submit" value="Update Slider" /></div></td></tr> </tr></table> </form> </div> echo " Slider Name: " . $slider->name; prints this out: Slider Name: DSCF3727.jpg Slider Name: DSCF3687.jpg Slider Name: DSCF3744.jpg Slider Name: DSCF4070.jpg Slider Name: DSCF4071.jpg Slider Name: DSCF4073.jpg Slider Name: 10245379_229236400605097_7329379469957650735_n.jpg Slider Name: 10314007_229236253938445_8056225029697636541_n.jpg Slider Name: DSCF3618.jpg Slider Name: 10550825_261238134071590_1715454340087601479_n.jpg Slider Name: 1551739_261238150738255_2482363522486143465_n.jpg Slider Name: 10626882_284760908385979_3153917771920003400_n.jpg Slider Name: 10689730_284760921719311_8515870397004989019_n.jpg Slider Name: DSCF3384.jpg Slider Name: DSCF3382.jpg Slider Name: biker.jpg Slider Name: 10410927_255245578004179_6557207701489592736_n.jpg Slider Name: 10400847_255245548004182_5319163275713658480_n.jpg Slider Name: 111111.jpg Slider Name: DSCF3013.jpg Slider Name: DSCF4040.jpg Slider Name: 1011255_238047056390698_6002378516798338793_n.jpg Slider Name: 10373785_238048733057197_8255990183542589096_n.jpg Slider Name: 10383572_238047003057370_1041466926744898970_n.jpg Slider Name: DSCF4047.jpg Slider Name: DSCF4051.jpg Slider Name: DSCF4109.jpg Slider Name: DSCF4121.jpg Slider Name: DSCF4136.jpg Slider Name: DSCF4029.jpg Slider Name: Rancho-las-lomas-wedding-DJ.jpg Slider Name: webtest.jpg <?php global $Sys; //echo $Sys->Auth->chkAuth(); if(isset($_POST['update_slider'])) { print_r($_POST); exit; unset($_POST['update_slider']); $post = $_POST; unset($_POST); foreach($post as $name => $value) I add print_r($_POST); after the if and before exit; and get this: Array ( [update_slider] => Update Slider [DSCF3727_jpg] => 0 [DSCF3687_jpg] => 0 [DSCF3744_jpg] => 0 [DSCF4070_jpg] => 0 [DSCF4071_jpg] => 0 [DSCF4073_jpg] => 0 [10245379_229236400605097_7329379469957650735_n_jpg] => 0 [10314007_229236253938445_8056225029697636541_n_jpg] => 0 [DSCF3618_jpg] => 0 [10550825_261238134071590_1715454340087601479_n_jpg] => 0 [1551739_261238150738255_2482363522486143465_n_jpg] => 0 [10626882_284760908385979_3153917771920003400_n_jpg] => 0 [10689730_284760921719311_8515870397004989019_n_jpg] => 0 [DSCF3384_jpg] => 0 [DSCF3382_jpg] => 0 [biker_jpg] => 0 [10410927_255245578004179_6557207701489592736_n_jpg] => 0 [10400847_255245548004182_5319163275713658480_n_jpg] => 0 [111111_jpg] => 0 [DSCF3013_jpg] => 0 [DSCF4040_jpg] => 0 [1011255_238047056390698_6002378516798338793_n_jpg] => 0 [10373785_238048733057197_8255990183542589096_n_jpg] => 0 [10383572_238047003057370_1041466926744898970_n_jpg] => 0 [DSCF4047_jpg] => 0 [DSCF4051_jpg] => 0 [DSCF4109_jpg] => 0 [DSCF4121_jpg] => 0 [DSCF4136_jpg] => 0 [DSCF4029_jpg] => 0 [Rancho-las-lomas-wedding-DJ_jpg] => 0 [webtest_jpg] => 0 ) DSCF3727_jpg I am stumped on this. Any help is appreciated. A: For anyone wondering how to fix this PHP problem (Not Mysqli problem): Old: if(isset($_POST['update_slider'])) { unset($_POST['update_slider']); $post = $_POST; unset($_POST); foreach($post as $name => $value) { $value = (is_numeric($value)) ? $value : intval($value); $result = $Sys->db->query("UPDATE dj_photo SET slider_status = $value WHERE name = $name"); } if($result->affected_rows != 0) { $Sys->Template->setAlerts($result->affected_rows . ' images were added to the image slider.'); } else { $Sys->Template->setAlerts('No images were added to the slider.', 'error'); } } New: if(isset($_POST['update_slider'])) { unset($_POST['update_slider']); $post = $_POST; unset($_POST); $search = array('_jpg', '_jpeg', '_png', '_bmp', '_gif'); $replace = array('.jpg', '.jpeg', '.png', '.bmp', '.gif'); foreach($post as $name => $value) { $column = str_replace($search, $replace, $name); $value = (is_numeric($value)) ? $value : intval($value); $result = $Sys->db->query("UPDATE dj_photo SET slider_status = '" . $value . "' WHERE name = '" . $column . "'"); } if($result) { $Sys->Template->setAlerts($result->mysqli_affected_rows . ' images were added to the image slider.'); } else { $Sys->Template->setAlerts('No images were added to the slider.', 'error'); } }
doc_23537366
The error i get is below and has apparently something to do with the fact that i have limited access to the clearDB cloud service. In short, the script asks to see the content of proc - which holds all the procedures that I might have stored on the remote DB. The thing is that I do not use procedure and I wish to have this operation ignored completely. is there a way to tell jooq autogeneration to not query PROC? Error while fetching functions org.jooq.exception.DataAccessException: SQL [select `mysql`.`proc`.`db`, `mysql`.`proc`.`name`, `mysql`.`proc`.`comment`, `mysql`.`proc`.`param_list`, `mysql`.`proc`.`returns` from `mysql`.`proc` where `mysql`.`proc`.`db` in (?) order by `mysql`.`proc`.`db` asc, `mysql`.`proc`.`name` asc]; **SELECT command denied to user 'b******4'@'ip-**-**-**-**.ec2.internal' for table 'proc'** at org.jooq.impl.Utils.translate(Utils.java:1078) at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:462) at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:302) at org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:319) at org.jooq.impl.SelectImpl.fetch(SelectImpl.java:1024) at org.jooq.util.mysql.MySQLDatabase.getRoutines0(MySQLDatabase.java:306) at org.jooq.util.AbstractDatabase.getRoutines(AbstractDatabase.java:629) at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:241) at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:174) at org.jooq.util.GenerationTool.run(GenerationTool.java:291) at org.jooq.util.GenerationTool.main(GenerationTool.java:135) at org.jooq.util.GenerationTool$main.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at build_25tutouf1gvhdgaqpfank74rq6$_run_closure7.doCall(/home/jes/Development/git/bjdata/build.gradle:126) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877) at groovy.lang.Closure.call(Closure.java:412) at groovy.lang.Closure.call(Closure.java:425) at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:502) at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:483) at org.gradle.api.internal.tasks.TaskStatusNagger$1.execute(TaskStatusNagger.java:77) at org.gradle.api.internal.tasks.TaskStatusNagger$1.execute(TaskStatusNagger.java:73) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$1.run(DefaultTaskPlanExecutor.java:33) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198) at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:266) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:135) at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:95) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:31) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33) at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45) at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32) at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51) at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155) at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128) at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user 'b*********4'@'ip-**-**-**-**.ec2.internal' for table 'proc' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379) at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:189) at org.jooq.impl.AbstractResultQuery.execute(AbstractResultQuery.java:250) at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:298) ... 104 more and the configuration used to generate the whole thing with jooq is: <configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.0.0.xsd"> <jdbc> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://us-cdbr-east-**.cleardb.net/heroku_******</url> <user>b***********4</user> <password>***********</password> </jdbc> <generator> <name>org.jooq.util.DefaultGenerator</name> <database> <name>org.jooq.util.mysql.MySQLDatabase</name> <includes>.*</includes> <excludes></excludes> <recordVersionFields></recordVersionFields> <recordTimestampFields></recordTimestampFields> <dateAsTimestamp>false</dateAsTimestamp> <unsignedTypes>true</unsignedTypes> <inputSchema>heroku_*****</inputSchema> </database> <generate> <relations>true</relations> <deprecated>true</deprecated> <instanceFields>true</instanceFields> <generatedAnnotation>true</generatedAnnotation> <records>true</records> <pojos>false</pojos> <immutablePojos>false</immutablePojos> <interfaces>false</interfaces> <daos>false</daos> <jpaAnnotations>false</jpaAnnotations> <validationAnnotations>false</validationAnnotations> <globalObjectReferences>true</globalObjectReferences> </generate> <target> <packageName>***********.entities.generated</packageName> <directory>/***********/src/main/java/</directory> </target> </generator> </configuration> A: This issue (#2958) was fixed in jOOQ 3.3.0 and in 3.2.3 (#2960). I suggest upgrading... More background infos in this thread: https://groups.google.com/forum/#!topic/jooq-user/WpUnYQSDIlY
doc_23537367
A: RECORD_ACTION and RECORD_IS_ROOT are system variable in TIBCO MDM. User does not have control on these variables. So, will suggest to use user define attribute for any Rulebase operations.
doc_23537368
Please tell me how to you will fix it ? Visit https://codepen.io/benfrain/pen/wJgZYP What I add class in html for content add <div class="pn-ProductNav_Wrapper"> <nav id="pnProductNav" class="pn-ProductNav"> <div id="pnProductNavContents" class="pn-ProductNav_Contents"> <a href="#" class="pn-ProductNav_Link" aria-selected="true">Chairs</a> <a href="#" class="pn-ProductNav_Link">Tables</a> <a href="#" class="pn-ProductNav_Link">Cookware</a> <a href="#" class="pn-ProductNav_Link">Beds</a> <a href="#" class="pn-ProductNav_Link">Desks</a> <a href="#" class="pn-ProductNav_Link">Flooring</a> <a href="#" class="pn-ProductNav_Link">Lighting</a> <a href="#" class="pn-ProductNav_Link">Mattresses</a> <a href="#" class="pn-ProductNav_Link">Solar Panels</a> <a href="#" class="pn-ProductNav_Link">Bookcases</a> <a href="#" class="pn-ProductNav_Link">Mirrors</a> <a href="#" class="pn-ProductNav_Link">Rugs</a> <a href="#" class="pn-ProductNav_Link">Curtains &amp; Blinds</a> <a href="#" class="pn-ProductNav_Link">Frames &amp; Pictures</a> <a href="#" class="pn-ProductNav_Link">Wardrobes</a> <a href="#" class="pn-ProductNav_Link">Storage</a> <a href="#" class="pn-ProductNav_Link">Decoration</a> <a href="#" class="pn-ProductNav_Link">Appliances</a> <a href="#" class="pn-ProductNav_Link">Racks</a> <a href="#" class="pn-ProductNav_Link">Worktops</a> </div> </nav> <button id="pnAdvancerLeft" class="pn-Advancer pn-Advancer_Left" type="button"> <svg class="pn-Advancer_Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 551 1024"><path d="M445.44 38.183L-2.53 512l447.97 473.817 85.857-81.173-409.6-433.23v81.172l409.6-433.23L445.44 38.18z"/></svg> </button> <button id="pnAdvancerRight" class="pn-Advancer pn-Advancer_Right" type="button"> <svg class="pn-Advancer_Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 551 1024"><path d="M105.56 985.817L553.53 512 105.56 38.183l-85.857 81.173 409.6 433.23v-81.172l-409.6 433.23 85.856 81.174z"/></svg> </button> </div> Here is JavaScript Visit https://codepen.io/benfrain/pen/wJgZYP Thanks A: There is a simple solution. First you must replace the with since click events on anchors will not propagate. Second, add a property to each one of the spans like data-tab-id="div1" and so for...third, add divs with matching id's of those defined in the spans, and by default, set to visible only the first div. Those divs will contain the content you want to display. Now, on the onclick event of each span, get the value of property data-tab-id, and then hide all divs first, and make visible only the one with the matching id, and that's all, you will have a tab control working 100%.
doc_23537369
I was import "package:http/http.dart' as http". But, Result is "The built-in library 'dart: io' is not available on Dartium" in Datium console. So "dart build" and run the "Uncaught Unsupported operation: Platform._version" error comes in chrome console. Also, dart: html and dart: io's "HttpRequest" was using the request fails. How can I get response data from the server(tomcat or another was)? Thanks your answer!!! import 'dart:async'; import "dart:html"; import "dart:convert"; import 'package:http/http.dart' as http; final ButtonElement loginButton = querySelector("#login"); void main() { loginButton.onClick.listen((e) { requestTest2IO(); }); } void requestTest2IO(){ var url = 'server url'; http.get(url, headers : {'Cookie': 'JSESSIONID : xxxxxxxxxxxxxxxxxxxxxx', 'User-Agent': 'xxxxxxx', 'x-app-stat-json': '(Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36,appversion=8}' }) .then((response) { List<String> repos = JSON.decode(response.body); print(repos); }); }
doc_23537370
array([[137, 138, 139, ..., 126, 126, 125], [139, 139, 139, ..., 126, 126, 126], [140, 140, 140, ..., 127, 126, 126], ..., [132, 135, 137, ..., 136, 135, 133], [133, 134, 136, ..., 136, 134, 133], [133, 134, 134, ..., 136, 134, 133]], dtype=uint8) My goal is to manipulate the array such that I can transform it to a binary array, where a threshold (e.g. 100) determines whether the entry is 0 or 1. For now I just implemented nested for-loops checking the row and columns respectivley. thres = 100 for k in range(0, len(my_array)): for i in range(0, len(my_array[0])): if(my_array[k][i] < thres): my_array[k][i] = 1 else: my_array[k][i] = 0 It is mentioned that I am not tied to any perfromance goals. But just out of curiosity: How can I make use of numpy efficiently such that I can achieve a better performance? Since the provided array can be computed in a reasonable amount of time, the above mentioned approach works just fine. I can image that with increase of the array size the performance of the approach will become quite insufficient. A: How about my_array[my_array < thresh] = 1 my_array[my_array > 1] = 0 or even better if you don't mind true false my_array <= thresh or my_array = (my_array < thresh).astype('uint8') if you do. If you have to loop on an array, do not use it. They are (much) worse than Python lists for that - try it on your example and see how much faster it is. Use a list if you loop.
doc_23537371
ipython notebook --profile=nbserver 2014-07-18 11:14:05.473 [NotebookApp] Using existing profile dir: u'/home/local/AD/jack/.ipython/profile_nbserver' 2014-07-18 11:14:05.482 [NotebookApp] Using MathJax from CDN: https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js 2014-07-18 11:14:05.497 [NotebookApp] Serving notebooks from local directory: /home/local/AD/jack/.ipython/profile_nbserver 2014-07-18 11:14:05.497 [NotebookApp] 0 active kernels 2014-07-18 11:14:05.497 [NotebookApp] The IPython Notebook is running at: all ip addresses on your system]:9999 2014-07-18 11:14:05.498 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). When I attempt to access it remotely using: https://devs-sandbox02.jfk.ad.radio.com:9999 The server goes into a loop repeating the message: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/zmq/eventloop/ioloop.py", line 346, in start self._handlers[fd](fd, events) KeyError: 6 ERROR:root:Exception in I/O handler for fd 6 What is causing this? How do I work around it? A: I was having the same issue, and just fixed it by upgrading pyzmq: $ pip search pyzmq pyzmq - Python bindings for 0MQ INSTALLED: 13.0.2 LATEST: 14.3.1 $ sudo pip install --upgrade pyzmq (Hope this helps anyone else who winds up here like I did!)
doc_23537372
fetch('http://localhost:8080/api/login', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ username: this.state.username_login, password: this.state.password_login }) }) .then((response) => response.json()) .then((responseJson) => { console.log(responseJson); //this is the object containing the token }) .catch(function(error) { console.log("request failed"); }) } so responseJson is the the object containing my web token. The request was successful and now I've passed it to the client. Now, I am thinking of saving it to a cookie. How can I send this to the server? Should I make a POST request? If so how do I do that once the JSON object is received? If there is a better way, I would like to know. A: Cookies are automatically passed along any HTTP request made with fetch
doc_23537373
Here are the details: * *It is an ASP.Net WCF REST service deployed to IIS 7.5 *Requests to all functions but 1 at the endpoint work as intended. *The request causing the redirect is a POST with a file attached to the packet. *The client connecting to the endpoint is putting in a different URL in the header than the URL they are actually posting to. I have enabled Failed Request Tracing and the reason for the redirect is "HTTP/1.1 302 object Moved". We do not have any HTTP Redirects defined on the server, so IIS or some other component is causing the redirect without our intention. Here is an excerpt from the log file for a successful request: Successful Request From Development Machine Notice the "url" in the log file is not the actual DNS entry for the IP address the client software is POSTing the data to. Here is an example of what is put in the header for the response back to the client, specifically the Location of where to redirect to, which does not exist: Redirect to Non-Existant Endpoint It's odd that the redirect is happening, but what is really odd to me is the URL that it is being redirected to. Any help is greatly appreciated.
doc_23537374
var temp=true if(temp) window.open('test.aspx'); My problem is window.open() in new tab should not subject to pop-up blockers. I have tried window.open('viewReport.aspx', '_newtab' ); and window.open('viewReport.aspx', '_blank' );, but its always subject to pop-up blocker. Please provide any solution. Thanks. A: Window.open will force opening a new tab with a given URL. This is called a Pop-Up. You cannot control it. Instead use javascript to simulate a windows by using ex. https://jqueryui.com/dialog/ or http://fancybox.net. Both works with ajax request so you can pull the html content from another page. A: My problem is window.open() in new tab should not subject to pop-up blockers. You might think that but the people writing web browsers do not. You cannot open a new tab or window from JavaScript except in response to a user event. The solution is to find some other way to present your information (such as providing the user with a link to it or placing it in the same page). A: Create a jquery popup div in β€˜on click trigger’ event, that pop up displays with opacity background and it will remains center the popup if you scrolling zoom out the browser and closing it fadeout, and also you can customize the content of the popup div for your cool website designs. Working example: http://istockphp.com/jquery/creating-popup-div-with-jquery/#sthash.5HcIfl8n.dpuf
doc_23537375
public abstract class ClassValue extends Object Lazily associate a computed value with (potentially) every type. For example, if a dynamic language needs to construct a message dispatch table for each class encountered at a message send call site, it can use a ClassValue to cache information needed to perform the message send quickly, for each class encountered. Please help me, I am very curious..
doc_23537376
Microsoft provides an example of this in their article COM Interop Part 1: Client Tutorial: // Create an instance of a COM coclass: FilgraphManager graphManager = new FilgraphManager(); // See if it supports the IMediaControl COM interface. // Note that this will throw a System.InvalidCastException if // the cast fails. This is equivalent to QueryInterface for // COM objects: IMediaControl mc = (IMediaControl) graphManager; // Now you call a method on a COM interface: mc.Run(); However, it appears as though they are instantiating a COM object and casting it to a COM interface. For the interface I am interested in, IDesktopWallpaper, there does not seem to be an implementing COM object to instantiate. An example I found here defines some class that gets instantiated and then casts it to the interface the same way that the msdn example does: [ComImport, Guid("C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD")] internal class IDesktopWallpaper { } [Guid("B92B56A9-8B55-4E14-9A89-0199BBB6F93B"), //B92B56A9-8B55-4E14-9A89-0199BBB6F93B InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface DesktopWallpaperInterface { // declared members } I'm not understanding what the instantiated object is. It seems like an arbitrary object, it has a GuidAttribute which seems to indicate that it is an actual COM object. Another example i found here System.Type and System.Runtime.InteropServices.Marshal to instantiate an object and then casts it to the interface: IntPtr ptrRet; SHGetMalloc(out ptrRet); System.Type mallocType = System.Type.GetType("IMalloc"); Object obj = Marshal.GetTypedObjectForIUnknown(ptrRet,mallocType); IMalloc pMalloc = (IMalloc)obj; This method seems to be requesting a pointer to an existing instance of the interface. I can't find any methods like SHGetMalloc for IDesktopWallpaper in the Windows Shell documentation. Question So, long story short, what's the standard way to get an instance of a COM interface? In the event that there is no one-size-fits-all solution, what are the standard ways that one can use to get an instance of a COM interface and in what circumstance is each of these ways most useful? Edit After downloading the Windows 10 SDK and referencing that against the Requirements section of the IDesktopWallpaper interface documentation, I have discovered that you can look up the MIDL from Shobjidl.h and use that in the GuidAttribute for your interface declaration and then look up the CLSID from Shobjidl.idl and use that in conjunction with Type.GetTypeFromCLSID(Guid) and Activator.CreateInstance(Type) to get an instance of an object that implements IDesktopWallpaper. I also see now that the CLSID is what is used in the second method listed above for the GuidAttribute of the seemingly arbitrary object. It seems like this method allows you to mimic managed instantiation of the object by instantiating the class and then casting the instance to the COM interface. However I am still interested to know if this is the best way to do this and what pros and cons may be associated with this method vs others. A: You can get a pointer to a COM object reference by a variety of methods: * *P/Invoke CoCreateInstance *P/Invoke CLSIDFromProgID β†’ CoCreateInstance *P/Invoke IRunningObjectTable.GetObject *Type.GetTypeFromCLSID β†’ Activator.CreateInstance *Type.GetTypeFromProgID β†’ Activator.CreateInstance *new SomeType() where SomeType is marked with ComImport Activator.CreateInstance and new SomeType() eventually hit CoCreateInstance (if they do not get intercepted by various in-app-domain stuff). Calls to CoCreateInstance for an out-of-process server will eventually hit IRunningObjectTable with a class moniker (I think). The best option depends on what you are trying to do: * *For an in-process server, just use ComImport *For an out-of-process server that is not implemented in .Net, ComImport will work, I would prefer to call CoCreateInstance to pass the right CLSCTX. *For a .net implemented out-of-process server implemented in .Net, you must call CoCreateInstance directly to avoid the "optimizations" added by ComImport that would result in the server being run in-process *If you are dealing with a moniker, use IRunningObjectTable *If you are starting out with a ProgID rather than a CLSID, use either CLSIDFromProgID or Type.GetTypeFromProgID Regardless of how we get a reference to an object, we start out with IUnknown (object in .Net), and then have to call IUnknown->QueryInterface to get a pointer to a particular interface. Calling QueryInterface in .Net is effected by casting to an interface marked as ComVisible (and usually annotated with GuidAttribute). In the example you named, you would end up with: // based off of https://bitbucket.org/ciniml/desktopwallpaper [ComImport] [Guid("B92B56A9-8B55-4E14-9A89-0199BBB6F93B")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IDesktopWallpaper { void SetWallpaper([MarshalAs(UnmanagedType.LPWStr)] string monitorID, [MarshalAs(UnmanagedType.LPWStr)] string wallpaper); [return: MarshalAs(UnmanagedType.LPWStr)] string GetWallpaper([MarshalAs(UnmanagedType.LPWStr)] string monitorID); [return: MarshalAs(UnmanagedType.LPWStr)] string GetMonitorDevicePathAt(uint monitorIndex); [return: MarshalAs(UnmanagedType.U4)] uint GetMonitorDevicePathCount(); [return: MarshalAs(UnmanagedType.Struct)] Rect GetMonitorRECT([MarshalAs(UnmanagedType.LPWStr)] string monitorID); void SetBackgroundColor([MarshalAs(UnmanagedType.U4)] uint color); [return: MarshalAs(UnmanagedType.U4)] uint GetBackgroundColor(); void SetPosition([MarshalAs(UnmanagedType.I4)] DesktopWallpaperPosition position); [return: MarshalAs(UnmanagedType.I4)] DesktopWallpaperPosition GetPosition(); void SetSlideshow(IntPtr items); IntPtr GetSlideshow(); void SetSlideshowOptions(DesktopSlideshowDirection options, uint slideshowTick); void GetSlideshowOptions(out DesktopSlideshowDirection options, out uint slideshowTick); void AdvanceSlideshow([MarshalAs(UnmanagedType.LPWStr)] string monitorID, [MarshalAs(UnmanagedType.I4)] DesktopSlideshowDirection direction); DesktopSlideshowDirection GetStatus(); bool Enable(); } [ComImport] [Guid("C2CF3110-460E-4fc1-B9D0-8A1C0C9CC4BD")] public class DesktopWallpaper { } [Flags] public enum DesktopSlideshowOptions { None = 0, ShuffleImages = 0x01 } [Flags] public enum DesktopSlideshowState { None = 0, Enabled = 0x01, Slideshow = 0x02, DisabledByRemoteSession = 0x04 } public enum DesktopSlideshowDirection { Forward = 0, Backward = 1 } public enum DesktopWallpaperPosition { Center = 0, Tile = 1, Stretch = 2, Fit = 3, Fill = 4, Span = 5, } [StructLayout(LayoutKind.Sequential)] public struct Rect { public int Left; public int Top; public int Right; public int Bottom; } An example use of which would be: public partial class Form1 : Form { private IDesktopWallpaper Wallpaper; public Form1() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.Wallpaper = (IDesktopWallpaper)new DesktopWallpaper(); uint monitorCount = Wallpaper.GetMonitorDevicePathCount(); for (uint i = 0; i < monitorCount; i++) { lbMonitors.Items.Add(Wallpaper.GetMonitorDevicePathAt(i)); } } private void lbMonitors_SelectedValueChanged(object sender, EventArgs e) { var path = (string)lbMonitors.SelectedItem; tbWallpaper.Text = Wallpaper.GetWallpaper(path); } } Which produces the form:
doc_23537377
Ext.define('ParentController', { extend: 'Ext.app.ViewController', alias: 'controller.parent', sayHelloFromChild: function() { this.sayHello(); // Uncaught TypeError: this.sayHello() is not a function } }); Ext.define('ChildController', { extend: 'ParentController', alias: 'controller.child', sayHello: function() { console.log('Hello); } }); I want to call child method sayHello(); inside parent controller. A: i just tested in sencha fiddle. Look : https://fiddle.sencha.com/#view/editor&fiddle/2r1g You have syntax error in console.log('Hello);. This is a problem.
doc_23537378
My certificate setup is like this: Test Root CA -> Test Sub CA -> Test Server -> Test Client So both server and client cert are signed by the Sub CA. I tried to setup my client and server keystore: Client-Keystore: * *Client Cert & Key (PKCS12) Client-Truststore: * *Sub CA Cert *Root CA Cert Server-Keystore: * *Server Cert & Key (PKCS12) I tried to do all variations: Import only client/server cert into keystore, import full CA chain... I always run into that error. I activated SSL debugging in Java, but still this is the last error message i can see. Could you please help me by taking a look at the log file? I split it into two parts due to space limitations. Log until first error is the first half and shows SSL negotiation and key store handling and shows the first time the certificate path cannot be found. Rest of the log is the rest. I believe the SSL handshake and certificate validation are ok. When i manually set the truststore like this URL trustStoreURL = classLoader.getResource("jsse/client-truststore.jks"); System.setProperty("javax.net.ssl.trustStore", trustStoreURL.getFile()); System.setProperty("javax.net.ssl.trustStorePassword", "password"); the validation works and SSL is fine. Both truststores are identical anyway. But what does happen if this is not set? I thought setting this programatically (see below) should be fine, but somehow i get the feeling another truststore is loaded (cacerts) that somehow breaks validation. I would really like to understand what is going on and can understand the SSL handshake in the log. I do not understand why certificate validation fails, though. Thank you! Edit: JAVA-Version: openjdk version "1.8.0_91" OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14) OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode) Code to configure SSL Context parameters: private static SSLContextParameters defineClientSSLContextClientParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(Thread.currentThread().getContextClassLoader().getResource("jsse/client-keystore.jks").toString()); ksp.setPassword(PWD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(PWD); kmp.setKeyStore(ksp); KeyStoreParameters tsp = new KeyStoreParameters(); tsp.setResource(Thread.currentThread().getContextClassLoader().getResource("jsse/client-truststore.jks").toString()); tsp.setPassword(PWD); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(tsp); SSLContextServerParameters scsp = new SSLContextServerParameters(); //scsp.setClientAuthentication(ClientAuthentication.REQUIRE.name()); scsp.setClientAuthentication(ClientAuthentication.NONE.name()); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); return sslContextParameters; } private static SSLContextParameters defineServerSSLContextParameters() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource(Thread.currentThread().getContextClassLoader().getResource("jsse/server-keystore.jks").toString()); ksp.setPassword(PWD); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyPassword(PWD); kmp.setKeyStore(ksp); KeyStoreParameters tsp = new KeyStoreParameters(); tsp.setResource(Thread.currentThread().getContextClassLoader().getResource("jsse/server-truststore.jks").toString()); tsp.setPassword(PWD); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(tsp); SSLContextServerParameters scsp = new SSLContextServerParameters(); //scsp.setClientAuthentication(ClientAuthentication.REQUIRE.name()); scsp.setClientAuthentication(ClientAuthentication.NONE.name()); SSLContextParameters sslContextParameters = new SSLContextParameters(); sslContextParameters.setKeyManagers(kmp); sslContextParameters.setTrustManagers(tmp); sslContextParameters.setServerParameters(scsp); return sslContextParameters; } Code that configures my test route: @Override protected RouteBuilder[] createRouteBuilders() throws Exception { RouteBuilder[] rbs = new RouteBuilder[2]; // A consumer rbs[0] = new RouteBuilder() { public void configure() { // Needed to configure TLS on the client side WsComponent wsComponent = (WsComponent) context.getComponent("idsclient"); wsComponent.setSslContextParameters(defineClientSSLContextClientParameters()); from("direct:input").routeId("foo") .log(">>> Message from direct to WebSocket Client : ${body}") .to("idsclient://localhost:9292/echo") .log(">>> Message from WebSocket Client to server: ${body}"); } }; // A provider rbs[1] = new RouteBuilder() { public void configure() { // Needed to configure TLS on the server side WebsocketComponent websocketComponent = (WebsocketComponent) context.getComponent("idsserver"); websocketComponent.setSslContextParameters(defineServerSSLContextParameters()); // This route is set to use TLS, referring to the parameters set above from("idsserver:localhost:9292/echo") .log(">>> Message from WebSocket Server to mock: ${body}") .to("mock:result"); } }; return rbs; } The test cert for the server side looks like this (taken from the log file): found key for : server chain [0] = [ [ Version: V3 Subject: CN=Test Server, OU=MyDepartment, O=MyCompany, L=Munich, ST=Bavaria, C=DE Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11 Key: Sun RSA public key, 2048 bits modulus: 19697468346206325338625931027401620685505412743602335229201285324147237256216294710834287613270808792700765169197171367371459991031662084309764776191914171160104989266207613238184784158415975037177065022201531172433794931849866898549526682368884371139417838799836320672154199909478730633522432282118939559532307066108447566990979134741165253612506513491626459651819946324249745973578011579650517987718802720162457248935339641095429277723082345377268006775487733517858798408645354401260091015110745708667097965877142342305591846833532604648462225727819942287641383438004739414038605341137460966856052237012367021734999 public exponent: 65537 Validity: [From: Tue Oct 25 09:37:42 CEST 2016, To: Thu Oct 25 09:37:42 CEST 2018] Issuer: CN=Test SubCA 2016, O=Company, C=DE SerialNumber: [ 01] Certificate Extensions: 6 [1]: ObjectId: 2.5.29.35 Criticality=false AuthorityKeyIdentifier [ KeyIdentifier [ 0000: A5 55 EC 7E AC F0 98 95 EA 58 D7 BF 43 92 2C 65 .U.......X..C.,e 0010: AA A0 32 73 ..2s ] ] [2]: ObjectId: 2.5.29.19 Criticality=false BasicConstraints:[ CA:false PathLen: undefined ] [3]: ObjectId: 2.5.29.37 Criticality=false ExtendedKeyUsages [ clientAuth serverAuth ] [4]: ObjectId: 2.5.29.15 Criticality=false KeyUsage [ DigitalSignature Key_Encipherment ] [5]: ObjectId: 2.5.29.17 Criticality=false SubjectAlternativeName [ DNSName: localhost DNSName: 127.0.0.1 ] [6]: ObjectId: 2.5.29.14 Criticality=false SubjectKeyIdentifier [ KeyIdentifier [ 0000: 7F 45 12 3E F5 17 F8 EF FF 2F 08 46 25 4B 21 60 .E.>...../.F%K!` 0010: EB FC 1B 4F ...O ] ] ] Algorithm: [SHA256withRSA] Signature:
doc_23537379
Any help much appreciated! :) Sub FilterSaveCases() With ActiveSheet.PageSetup .LeftHeader = "&B& &20 Doff Stock : " & Format(Now, " ddmmyyyy") On Error Resume Next Columns("H:H").AutoFilter.ShowAllData Columns("H:H").AutoFilter ActiveSheet.Range("H:H").AutoFilter Field:=1, Criteria1:=">1" Columns("C:O").EntireColumn.Hidden = True Columns("P:P").EntireColumn.Hidden = False ActiveSheet.Pictures("Picture 1").Visible = False Dim Nm As String Dim Rng As Range Set Rng = Range("A1:P198") Nm = ActiveWorkbook.FullName Nm = Left(Nm, InStrRev(Nm, ".") - 1) & Format(Now, " ddmmyyyy") & ".pdf" Rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nm, Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=True ActiveSheet.ShowAllData Columns("C:O").EntireColumn.Hidden = False Columns("M:M").EntireColumn.Hidden = True Columns("P:P").EntireColumn.Hidden = True ActiveSheet.Pictures("Picture 1").Visible = True End With End Sub A: Yes, it is possible. Add this to your code. It will ask the user to select a location to save the file. Sub download_location() Dim user As String Dim fldr As FileDialog Dim sItem As String Dim getfolder As String user = Application.UserName Set fldr = Application.FileDialog(msoFileDialogFolderPicker) With fldr .Title = "Select a Folder" .AllowMultiSelect = False .InitialFileName = Application.DefaultFilePath If .Show <> -1 Then GoTo NextCode sItem = .SelectedItems(1) End With NextCode: getfolder = sItem Set fldr = Nothing 'do something here End Sub
doc_23537380
The user should only be able to edit the hidden part of the database that is theirs. I want to use an HTTP request trigger (as it seems the most practical), but I need to be able to have the client somehow prove through either a parameter or some other method that they are a certain user. Is this possible, if so what is the best way to do this? A: callable functions. Note that firebase.auth() provides user/client authentication. So, the Firebase Functions will be talking to the data store via a service account. Callable functions are similar to other HTTP functions, with these additional features: * *With callables, Firebase Authentication and FCM tokens, when available, are automatically included in requests. *The functions.https.onCall trigger automatically deserializes the request body and validates auth tokens.
doc_23537381
var i; i++; $.ajax({ url:"http://localhost/myport.php", type: GET, success: function(response){ ...}, ... ... Here is how I make the php call in the myport.php file <?php $ch=curl_init(); $curl_setopt($ch, CURLOPT_URL, "http://localhost:7555/test?index=" //Here I need to set a value (the variable i) in the above JS If I making the call directly from js, I would do $.ajax({ url:"http://localhost:7555/test?index=" + i I am new to php and curl, I am wondering how I can pass the value of that variable so I can get a parameter for the call. A: If I understand correctly, and you just want to append the value of the variable $i to the cURL call, you'd do this: <?php $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost:7555/test?index=" . $i); Or even, curl_setopt($ch, CURLOPT_URL, sprintf("http://localhost:7555/test?index=%d", $i)); Also note hat there is no $ before a function call: it's curl_setopt() not $curl_setopt() ($ is for variables, like $ch). Edit Upon clarification of the question, it seems you need to get this i variable from JavaScript to PHP. You can pass it as a GET parameter in your AJAX call: var i; i++; $.ajax({ url:"http://localhost/myport.php?index=" + i, type: GET, success: function(response){ ...}, ... ... Then, from PHP, you can use it like this: curl_setopt($ch, CURLOPT_URL, sprintf("http://localhost:7555/test?index=%d", $_GET['index'])); You should also verify that $_GET['index'] was actually passed in: if (!isset($_GET['index'])) { die("The index was not specified!"); } A: You can pass i from JavaScript like in your last example, with ?index=, then read the value of index in php from the global variable $_GET["index"].
doc_23537382
But, something is not clear to me. I am using Prisma with and GraphQL-Yoga with Prisma bindings. I do not know how to pass params from my graphQL server to sub properties. Don't know if this is clear, but i will show it with code, thats hopefully easier :) These are my types type User { id: ID! @unique name: String! posts: [Post!]! } type Post { id: ID! @unique title: String! content: String! published: Boolean! @default(value: "false") author: User! } My schema.graphql type Query { hello: String posts(searchString: String): [Post] users(searchString: String, searchPostsTitle: String): [User] me(id: ID): User } and my users resolver: import { Context } from "../../utils"; export const user = { hello: () => "world", users: (parent, args, ctx: Context, info) => { return ctx.db.query.users( { where: { OR: [ { name_contains: args.searchString }, { posts_some: { title_contains: args.searchPostsTitle } } ] } }, info ); }, me: (parent, args, ctx: Context, info) => { console.log("parent", parent); console.log("args", args); console.log("info", info); console.log("end_________________"); return ctx.db.query.user({ where: { id: args.id } }, info); } }; and my posts resolver import { Context } from "../../utils"; export const post = { posts: (parent, args, ctx: Context, info) => { return ctx.db.query.posts( { where: { OR: [ { title_contains: args.searchString }, { content_contains: args.searchString } ] } }, info ); } }; so, now :) I am able to do the following when i am in the GraphQL playground on my prisma service: { user(where: {id: "cjhrx5kaplbu50b751a3at99d"}) { id name posts(first: 1, after: "cjhweuosv5nsq0b75yc18wb2v") { id title content } } } but i cant do it on the server, if i do something like that.. i am getting the error: "error": "Response not successful: Received status code 400" this is what i am trying: { me(id: "cjhrx5kaplbu50b751a3at99d") { id name posts(first:1) { id title content } } } does somebody know how i could do that? A: since i have a custom type of user, posts does not have params like the generated one. Either i am using the the generated one, or modifying it to look like this: type User { id: ID! name: String! posts(where: PostWhereInput, orderBy: PostOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Post!] } EDIT 2018 June 4th # import Post from './generated/prisma.graphql' type Query { hello: String posts(searchString: String): [Post] users(searchString: String, where: UserWhereInput, orderBy: UserOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [User] me(id: ID): User } type Mutation { createUser(name: String!): User createPost( title: String! content: String! published: Boolean! userId: ID! ): Post } I copied the params over from prisma.graphql manually.
doc_23537383
URLSession.shared.dataTask(with: url) { data, _, error in if let error = error { print("error.code \((error as! URLError).code)") //prints - error.code Code(rawValue: -1020) if (error as! URLError).code == .notConnectedToInternet { print("no internet") //doesn't print return } } A: error code -1020 means dataNotAllowed. It means the connection failed because data use isn’t currently allowed on the device. What you are trying to catch notConnectedToInternet error code -1009 means connection failed because the device isn’t connected to the internet. So notConnectedToInternet is not same as dataNotAllowed. In this case check your device settings.
doc_23537384
<div id="price"></div> and: document.getElementById("price").textContent = "GMGo is $5.00"; but it didn't show the text "GMGo is $5.00" A: ie8 does not support textContent, but there is a way to fake it: http://eligrey.com/blog/post/textcontent-in-ie8 if (Object.defineProperty && Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(Element.prototype, "textContent") && !Object.getOwnPropertyDescriptor(Element.prototype, "textContent").get) (function() { var innerText = Object.getOwnPropertyDescriptor(Element.prototype, "innerText"); Object.defineProperty(Element.prototype, "textContent", { // It won't work if you just drop in innerText.get // and innerText.set or the whole descriptor. get : function() { return innerText.get.call(this) }, set : function(x) { return innerText.set.call(this, x) } } ); })();
doc_23537385
There are campaigns. A phone number is associated with each campaign. Users can text to a number after which they will be subscribed. I'm building "Create a New Campaign" page. * *My current strategy is to create a separate table for each campaign (campaign_1,campaign_2,...,campaign_n) and store the subscriber data in it. *It's also possible to just create a single table and add a campaign_id column to it. Each campaign is supposed to have 5k to 25k users. Which is a better option? #1 or #2? A: Option 2 makes more sense and is widely used approach. A: I suppose it really depends on the amount of campaigns you're going to have. Let's give you some pros/cons: Pros for campaign_n: * *Faster queries *You can have each instance run with its own code and own database Cons for campaign_n: * *Database modifications are harder (you need to sync all tables) *You get a lot of tables Personally I'd go for option 2 (campaign_id field), unless you have a really good reason not to.
doc_23537386
A: You do not have the OpenSSL extension installed in your PHP instance, so the https:// wrapper is not available. From the manual: Note: HTTPS is only supported when the openssl extension is enabled. And: To use PHP's OpenSSL support you must also compile PHP --with-openssl[=DIR] . You will need to recompile PHP with the OpenSSL extension. Alternatively, as suggested by others, you can replace the https:// with http://, which for Facebook images should work just as well - indeed, it may be quicker, and will certainly be more bandwidth efficient. I would do that like this: $url = 'https://facebook.com/path/to/image.jpg'; $url = trim($url); // Get rid of any accidental whitespace $parsed = parse_url($url); // analyse the URL if (isset($parsed['scheme']) && strtolower($parsed['scheme']) == 'https') { // If it is https, change it to http $url = 'http://'.substr($url,8); } Another point about that is that passing $url directly in to getimagesize() is probably not what you want to be doing. It is unlikely that the only thing you would be doing with the image is getting it's size, you will probably be displaying it on your page or otherwise manipulating it, and if this were the case your will end up downloading it more than once. You should probably download it to a temporary directory, then work on a local copy of it. A: $newlink = str_replace('https://', 'http://', $oldlink); I guess this could help to strip https:// to http:// A: /** * Get Image Size Alternative * * @param string $url * @param string $referer * @return array */ function getImage( $url, $referer = '' ) { $default = array('width' => 0, 'height' => 0, 'mime' => NULL, 'resource' => NULL); // set headers $headers = array( 'Range: bytes=0-131072' ); if ( !empty( $referer ) ) { array_push( $headers, 'Referer: ' . $referer ); } // set curl config $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $data = curl_exec( $ch ); $http_status = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); $curl_errno = curl_errno( $ch ); curl_close( $ch ); // valid stauts if ( $http_status >= 400) { return $default; } // set stream config stream_context_set_default( [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, ], ]); $mime = (!empty(get_headers($url, 1)['Content-Type'])) ? get_headers($url, 1)['Content-Type'] : false; $mime = (is_array($mime) && $mime) ? end($mime) : $mime; // valid image types if(!$mime || !preg_match('/png|jpe?g|gif/i',$mime)){ return false; } $image_resource = imagecreatefromstring( $data ); if(!$image_resource){ return $default; } return ['width' => imagesx($image_resource), 'height' => imagesy($image_resource), 'mime' => $mime, 'resource' => $image_resource]; } // Set image url $url = 'http://pudim.com.br/pudim.jpg'; $data = getImage( $url ); // get image resource var_dump($data); // for tests #header ('Content-Type: image/jpeg'); #imagejpeg($data['resource'], null, 78); Output array (size=4) 'width' => int 640 'height' => int 480 'mime' => string 'image/jpeg' (length=10) 'resource' => resource(6, gd) A: I tested this and it worked fine. $url = "https://path/to/image.jpg"; $url = str_replace("https://", "http://", $url); $size = getimagesize($url);
doc_23537387
it is locked and cant access documents directory.How can i lock the application from accessing documents directory via organizer. A: I suppose you can access documents directory of applications that are signed with provisioning profile installed on your computer. Imo it is a handy feature for developer purposes. However it is disabled for applications downloaded from appstore so why should you worry about it?
doc_23537388
If I use any theme they look fine but if I remove the android:theme="@style/AppTheme" tag from AndroidManifest.xml Togglebuttons add an unwanted icon. Sample image here: I made a sample project with just a togglebutton with following xml layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ToggleButton android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout> and this is how it looks. I think I need to define a new theme inheriting from device default theme to override the togglebutton icon but I've had no success so far.
doc_23537389
But that file has some img sources which are not present so image is not getting loaded. I want to display a particular message like "Please login in order to view this image" instead of unloaded image if it is not loaded while if other images are loaded they should be shown as it is. It will be helpful if someone can provide any feedback. A: Here is how to test after the page has loaded window.addEventListener("load", event => { document.querySelectorAll('img').forEach(img => { const isLoaded = img.complete && img.naturalHeight !== 0; if (!isLoaded) img.outerHTML = "Please login in order to view this image" }) }) <img src="image1.jpg" /><br/> <img src="image2.jpg" /><br/> <img src="image3.jpg" /><br/> <img src="image4.jpg" /><br/> <img src="image5.jpg" /><br/> <img src="image6.jpg" /><br/> A: If I correctly understand what your're asking, you can do this by using alt within the HTML tag. For example: <img src="computer.jpg" alt="Computer Image" width="500" height="600"> If you run that snippet, you can see that since the image is not defined, text will appear.
doc_23537390
func.h: #ifndef FUNC_H_ #define FUNC_H_ #include "func2.h" #include "OrderedList.h" class func{ func2* pointer; }; #endif /* FUNC_H_ */ and func2.h: #ifndef FUNC2_H_ #define FUNC2_H_ #include "func.h" class func2{ func* joe; }; #endif /* FUNC2_H_ */ I have a project containing this and an empty main.cpp file. It compiles fine, although in my opinion it shouldn't: when func.h is pasted onto func2.h, then the preproccesor recognizes func2_h is already defined and it stops there. Then func doesn't know who func2 is since it comes first. However, if I include "func.h" in main then it doesn't compile as expected. I'm guessing that compilation ignores things that aren't used? Is this an optimization in eclipse (what I'm using) or something deeper? A: Yes, compilation ignores files which aren't included. Your compiler doesn't know anything about your project. All it knows about are the things which are passed to it on the command line, and typically, header files are not one of those things. If you take a look at the compilation command which Eclipse executes, you will most likely see main.cpp there, and no mention of your header files. Read this question for a more thorough understanding of how C++ compilation works: How does the compilation/linking process work?
doc_23537391
The project is for the Windows and Linux platform. Folder Structure root_project |─── CMakeLists.txt |─── Project 1 | |─── build | | |─── Debug | | └─── Release | |─── source | | |─── CMakeLists.txt | | └─── include | |─── resource | └─── header └─── Project 2 |─── build | |─── Debug | └─── Release |─── source | |─── CMakeLists.txt | └─── include |─── resource └─── header CMake files The first of these files is for the root project and the second one is for "Project 1" and "Project 2" as just one line is different in the second file. # Specify the minimum version for CMake cmake_minimum_required(VERSION 3.8.2) # Project's name project("root_project") set_property(GLOBAL PROPERTY USE_FOLDERS ON) IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt.") ENDIF() OPTION(BUILD_TESTS "Decides whether the unit tests will be built." ON) # C/C++ languages required. enable_language(C) enable_language(CXX) # Set the C++ Version message("!REQUIRED! -- Supported features = ${cxx_std_14}") message("Supported features = ${cxx_std_17}") set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # Only allow 64bit architecture IF(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64bit message(STATUS "Running on x86-64 platform. Proceeding...") ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32bit message(FATAL_ERROR "Running on x86 platform. This is not supported. Aborting...") ELSE() # unidentified architecture message(FATAL_ERROR "Running on unidentified architecture. This is not supported. Aborting...") ENDIF() # Abort when OpenGL is not found IF(NOT OPENGL_FOUND) message(WARNING "Could not find OpenGL library.") ENDIF() IF(NOT VULKAN_FOUND) message(WARNING "Could not find Vulkan library.") ENDIF() message(STATUS "----------------------------------------") message(STATUS "CMake Binary Dir:" ${CMAKE_BINARY_DIR}) message(STATUS "CMake Source Dir:" ${CMAKE_SOURCE_DIR}) message(STATUS "CMake CFG Dir:" ${CMAKE_CFG_INTDIR}) message(STATUS "CMake exe Dir:" ${EXECUTABLE_OUTPUT_PATH}) message(STATUS "CMake lib Dir:" ${LIBRARY_OUTPUT_PATH}) # Add the modules add_subdirectory("Project 1") add subdirectory("Project 2") The CMakeLists.txt for "Project 1" and "Project 2": # Specify the minimum version for CMake cmake_minimum_required(VERSION 3.8.2) project(Project 1) # Set the version number of the project here set(VERSION_MAJOR "0") set(VERSION_MINOR "1") set(VERSION_PATCH "0") set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(HEADERS ) set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ) set(HEADERS_WIN32 ) set(SOURCES_WIN32 ) set(HEADERS_LINUX ) set(SOURCES_LINUX ) source_group(headers FILES ${HEADERS} ${HEADERS_WIN32} ${HEADERS_LINUX}) source_group(sources FILES ${SOURCES} ${SOURCES_WIN32} ${HEADERS_LINUX}) if(WIN32) add_library(DarkEngine ${HEADERS} ${SOURCES} ${HEADERS_WIN32} ${SOURCES_WIN32} ) ELSEIF(UNIX AND NOT APPLE) add_library(DarkEngine ${HEADERS} ${SOURCES} ${HEADERS_LINUX} ${HEADERS_LINUX} ) ELSE() # The system is not supported message(FATAL_ERROR "System not supported.") ENDIF() Note: "Project 1" is a library while "Project 2" is an executable and "Project 2" will be based on Project 1. Think of it as "Project 1" is an Engine and "Project 2" is the Game. Question * *Having this setup, from which folder do I have to call CMake from to be able to open the solution "root_project" in Visual Studio 2017 which contains both projects, "Project 1" and "Project 2". cmake .. -G "Visual Studio 15 2017 Win64" *How to put the binaries into the Debug folder when compiling in Debug mode and how to put them in the Release folder when compiling in Release mode? The Release and Debug folders are there to differentiate between Release and Debug builds like Visual Studio does. A: I would try opening the root_project folder directly from the Developer Command Prompt, as per the instructions here: https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/ cd root_project devenv . This built-in support dumps your binaries somewhere under a temp directory in %APPDATA%, so I added the following in my top-level CMakeLists.txt file to dump the binaries out to a specific folder: # My understanding of what the output types mean. Check CMAKE documentation # to confirm: # ARCHIVE: Static & Import Library directory # LIBRARY: DLL directory (MODULE) # RUNTIME: DLL directory (SHARED) # If you use these lines, VS will automatically create Debug and Release dirs # under the directories you provide. set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../lib") set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../dll") # In my project I want Debug and Release to clobber each other because # I am building a DLL that I want to deploy next to an existing exe that # loads it, so I explicitly point both scenarios to the same place # (note the "_DEBUG" and "_RELEASE" suffixes to CMAKE_xxx_OUTPUT_DIRECTORY) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_LIST_DIR}/../lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_LIST_DIR}/../lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_LIST_DIR}/../dll") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../lib") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../dll")
doc_23537392
I made a function in my CustomUser to get the ID: public class MyUserDetail implements UserDetails { /* default functions */ public Integer getFullname(){ return user.getFullName(); } public Integer getId(){ return user.getId(); } } This way I could get the ID in HTML: <span>[[${#request.userPrincipal.principal.id}]]</span> However, when I tried it in a value of an input, the value was always 0. See the code below: <form action="#" th:action="@{'/myObject/save'}" th:object="${myObject}" method="post" autocomplete="off"> <table> <tr> <td>User</td> <td th:hidden="false"> <input type="number" th:field="*{fk_user}" th:value="${#request.userPrincipal.principal.id}" readonly="readonly"> </td> <td> <input type="text" th:value="${#request.userPrincipal.principal.fullname}" readonly="readonly"> </td> </tr> <!--- other fields ---> <tr> <td colspan="2"> <button type="submit">Save</button> </td> </tr> </table> </form> I also tried it with a simple number <input type="number" th:field="*{fk_user}" th:value="1" readonly="readonly">, but it was always 0, too. How can I solve this problem?
doc_23537393
df.groupby[['x','y']].apply(lambda x: (np.max(x['z'])-np.min(x['z']))).sort_values(ascending=False) And I would like to be able to present it across multiple lines but still as a one liner (without saving results to a temporary object, or defining the lambda as a function) an example of how I would like it to look: df.groupby[['x','y']] .apply(lambda x: (np.max(x['z'])-np.min(x['z']))) .sort_values(ascending=False) Is it possible to do so? (I know '_' has this functionality in python, but it doesn't seem to work with chained commands) A: Since this has the nature of a command, I would probably format it close to your example, like this: df.groupby[['x','y']] \ .apply(lambda x: np.max(x['z'])-np.min(x['z'])) \ .sort_values(ascending=False) It took me a long time to realize I could break these expressions before the dots, which is often more readable than breaking inside the parentheses (same goes for "some long string".format()). If this were more like an expression evaluation, I'd wrap the whole thing in parentheses, which is considered more "Pythonic" than line continuation markers: var = ( df.groupby[['x','y']] .apply( lambda x: np.max(x['z'])-np.min(x['z']) ) .sort_values(ascending=False) ) Update Since writing this, I've moved away from backslashes for line continuation whenever possible, including here, where it's not meaningful to chain the operations without assigning it to a variable or passing it to a function. I've also switched to using one level of indentation for each level of nesting inside parentheses or brackets, to avoid going to deep and/or getting a wiggly effect. So I would now write your expression like this: var = ( df .groupby[['x','y']] .apply( lambda x: np.max(x['z']) - np.min(x['z']) ) .sort_values(ascending=False) ) A: In python you can continue to the next line by ending your line with a reverse slash or by enclosing the expression in parenthesis. df.groupby[['x','y']] \ .apply(lambda x: (np.max(x['z'])-np.min(x['z']))) \ .sort_values(ascending=False) or (df.groupby[['x','y']] .apply(lambda x: (np.max(x['z'])-np.min(x['z']))) .sort_values(ascending=False)) A: The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. Long lines can be broken over multiple lines by wrapping expressions in parentheses. These should be used in preference to using a backslash for line continuation from https://www.python.org/dev/peps/pep-0008/#id19 So may be better: df.groupby[['x', 'y']].apply( lambda x: (np.max(x['z'])-np.min(x['z'])) ).sort_values(ascending=False) The last printed expression variable "_" is known only in the Python console, so without explicit attribution cannot be used for that purpose in a script/module.
doc_23537394
/public_html/dev/fuel/core/classes/error.php on line 177 A: This error is coming due to zlib compression being enabled in the server/site. You can get rid of this error using the below line above ob_end_clean() on the causing file. Which in your case is error.php Code should be look like this after the modification if($ob_get_status['name']!='zlib output compression') ob_end_clean(); For further read on the cause and more solutions you can visit this link [http://blog.waqasjamal.com/2014/07/how-to-solve-fatal-error-uncaught.html ]
doc_23537395
... import { Container, Header, Content, Card, Input, CardItem, Text, Right, Icon, Footer, FooterTab, Left, Body, Title, Button, Item } from 'native-base'; import DatePicker from 'react-native-datepicker'; ... <CardItem cardBody> <Left> <FontAwesome name="money" /> <Text>Rent Amount</Text> </Left> <Right> <Item> <Input value={RentalAmount} onChangeText={(text) => this.onChangeNumberFormat(text, 'RentalAmount')} style={styles.valueText} /> </Item> </Right> </CardItem> <CardItem cardBody> <Left> <FontAwesome name="calendar" /> <Text>Lease Start Date</Text> </Left> <Right> <Item> <DatePicker date={LeaseStartDate} mode="date" placeholder="select date" format="MM/DD/YYYY" confirmBtnText="Confirm" cancelBtnText="Cancel" onDateChange={(text) => this.onChangeText(text, 'LeaseStartDate')} customStyles={{ dateInput: { borderWidth: 0, alignItems: 'flex-start' }, dateText: { color: '#C0C0C0', } }} /> </Item> </Right> </CardItem> As you can see in the picture, the line under the data is shorter than the line under the Input. How can I make these lines the same size? Thanks A: you can set a width in the style prop like this: <DatePicker style={{ width: 100 }} date={LeaseStartDate} ... />
doc_23537396
Can anybody help me? A: I already solve it. In case it helps anybody this is what I did: * *Check the EC2 instance, configure it's security group to access directly and check any endpoint that should be working. *If everything is ok with the code, you should see the endpoint working. *In the Beanstalk section, in your application configure the Health to point to that endpoint. *Do the same inside in Network Tier > Load Balancing. *Wait a couple of minutes and it should be working know.
doc_23537397
But sometimes the interaction is more of a request/response behaviour for which promises seem more ideal. I am wondering if there is a way to unify these methods of communication. For example, I could have a component that has a encrypted message and needs it decrypted. I want a loose coupling between the component that is doing something with the message and the component handing the message decryption. Using promises provide a nice interaction for request/response but represents tight coupling. For example: message = ... some encrypted message ... decrypting_lib.decrypt(message).then(function(decrypted_message) { ... do something with decrypted_message ... }) But as you can see I have a tight coupling by referencing the decryption library. With events I can remove that coupling but the code seems more awkward: message = ... some encrypted message ... callback = function(decrypted_message) { if( message.id != decrypted_message.id ) return; hub.removeListener('message:decrypted', callback); ... do something with decrypted_message ... } hub.on('message:decrypted', callback); hub.emit('message:decrypt', message); In the second example, we emit a message to ask for the message to be decrypted while listening for it to be decrypted. Of course since other messages could be decrypted that may not be the message we are looking for we need to check for that. We also need to stop listening once we found the message we are interested in. As you can see we now are decoupled from whatever is doing the decryption but our code is MUCH more complicated. My ideal API would allow the EventEmitter-style interface for when our code doesn't require a request/response type interaction. But when it does have a request/response interaction it would look something like: hub.on('message:decrypt', message).then(function(decrypted_message) { ... do something with decrypted_message ... }); In this example the decryption library would decrypt the message then emit an event to indicate a message was decrypted. This would notify all parties that are interested in any message being decrypted. But it would also call the promise that was passed in which started the process. Is there any library out there that does something like this. Or perhaps someone more experienced with JS applications could provide a better way to do what I am trying to do. A: If you want to have things decoupled with events, and on the other side want to have convenient promise based interface. The only way I think it can be achieved, is via introduction of other utility that would bind both e.g. hub.registerForDecryption = function (message) { hub.emit('message:decrypt', message); return new Promise(function (resolve, reject) { hub.on('message:decrypted', function (decrypted) { if (message.id !== decrypted.id) return; resolve(decrypted); }); }); }; ... hub.registerForDecryption(message).then(function (decrypted) { .. do something with decrypted_message ... });
doc_23537398
public class ActivityChatView extends ActivityBase implements OnLoadMoreListener { private LoadMoreListView chatList; private Intent intent; private String expertName, chatId; private int offset = 0; ArrayList<History> chatHistoryList; private AdapterChatView mAdapter; private ProgressBar progressBar; private TextView progressText; private boolean isProgressNeeded = true; private String rowId; protected void setContentToLayout() { setContentView(R.layout.activity_chat_view); initChatListView(); offset = 0; } private void initChatListView() { intent = getIntent(); chatList = (LoadMoreListView) findViewById(R.id.list_chat_data); progressBar = (ProgressBar) findViewById(R.id.probar); progressText = (TextView) findViewById(R.id.loading_text); progressBar.setVisibility(View.VISIBLE); progressText.setVisibility(View.VISIBLE); chatList.setEmptyView(findViewById(android.R.id.empty)); chatList.setOnLoadMoreListener(this); expertName = intent.getStringExtra(Constants.EXPERT_NAME); chatId = intent.getStringExtra(Constants.CHAT_ID); if (isProgressNeeded) progressBar.setVisibility(View.VISIBLE); progressText.setVisibility(View.VISIBLE); serviceCall(offset); } private void serviceCall(int offset) { startService(new Intent(ActivityChatView.this, ChatService.class) .setAction(Constants.CHAT_HISTORY) .putExtra(Constants.USER_ID, expertName) .putExtra(Constants.CHAT_ID, chatId) .putExtra(Constants.OFFSET, String.valueOf(offset))); } protected void onChatHistory(ArrayList<? extends Parcelable> arrayList) { ArrayList<History> listHistory = (ArrayList<History>) arrayList; chatHistoryList = new ArrayList<History>(); for (int i = 0; i < listHistory.size(); i++) { History historyData = new History(); historyData.setFromUser(listHistory.get(i).getFromUser()); historyData.setMsgBody(listHistory.get(i).getMsgBody()); historyData.setMsgTime(listHistory.get(i).getMsgTime()); historyData.setRowId(listHistory.get(i).getRowId()); historyData.setMsgId(listHistory.get(i).getMsgId()); historyData.setToUser(listHistory.get(i).getToUser()); chatHistoryList.add(historyData); } progressBar.setVisibility(View.GONE); progressText.setVisibility(View.GONE); setValuesInAdapter(); } @Override public void onLoadMore() { LogMessage.e("number", "number"+offset); serviceCall(offset); } private void setValuesInAdapter() { if (mAdapter == null) { mAdapter = new AdapterChatView(this, chatHistoryList); chatList.setAdapter(mAdapter); } mAdapter.setExpertData(chatHistoryList); mAdapter.notifyDataSetChanged(); chatList.onLoadMoreComplete(); History e = chatHistoryList.get(chatHistoryList.size() - 1); rowId= e.getRowId(); LogMessage.e("rowId", rowId); offset = Integer.valueOf(rowId); if (chatHistoryList != null && !chatHistoryList.isEmpty()) { chatList.setVisibility(View.VISIBLE); chatList.getEmptyView().setVisibility(View.GONE); } else { chatList.getEmptyView().setVisibility(View.VISIBLE); } } } in adapter.. //setExpertData. public void setExpertData(List<History> chatHistoryList) { this.mTempData = chatHistoryList; } A: protected void onChatHistory(ArrayList<? extends Parcelable> arrayList) { ArrayList<History> listHistory = (ArrayList<History>) arrayList; //chatHistoryList = new ArrayList<History>();// (Remove this line from here) for (int i = 0; i < listHistory.size(); i++) { History historyData = new History(); historyData.setFromUser(listHistory.get(i).getFromUser()); historyData.setMsgBody(listHistory.get(i).getMsgBody()); historyData.setMsgTime(listHistory.get(i).getMsgTime()); historyData.setRowId(listHistory.get(i).getRowId()); historyData.setMsgId(listHistory.get(i).getMsgId()); historyData.setToUser(listHistory.get(i).getToUser()); chatHistoryList.add(historyData); } progressBar.setVisibility(View.GONE); progressText.setVisibility(View.GONE); setValuesInAdapter(); } and bring it in private void initChatListView() { chatHistoryList = new ArrayList<History>(); intent = getIntent(); chatList = (LoadMoreListView) findViewById(R.id.list_chat_data); progressBar = (ProgressBar) findViewById(R.id.probar); progressText = (TextView) findViewById(R.id.loading_text); progressBar.setVisibility(View.VISIBLE); progressText.setVisibility(View.VISIBLE); chatList.setEmptyView(findViewById(android.R.id.empty)); chatList.setOnLoadMoreListener(this); expertName = intent.getStringExtra(Constants.EXPERT_NAME); chatId = intent.getStringExtra(Constants.CHAT_ID); if (isProgressNeeded) progressBar.setVisibility(View.VISIBLE); progressText.setVisibility(View.VISIBLE); serviceCall(offset); }
doc_23537399
try { Class c = Class.forName("android.telecom.Call"); Method m = c.getMethod("disconnect"); m.setAccessible(true); Object o = m.invoke(c, new Object[] {}); } catch (Exception e) { Log.e("Exception of Reflection", e.getLocalizedMessage()); } A: * *You need to instantiate Class Call because you'll use the instance as a target for you method invocation. *The method getMethod ignores non-public method. You should use getDeclaredMethod to find your private method. Your code may look like this: try { Class<?> c = Class.forName("android.telecom.Call"); Object instance = c.newInstance(); Method m = c.getDeclaredMethod("disconnect"); m.setAccessible(true); m.invoke(instance, new Object[] {}); } catch (Exception e) { Log.e("Exception of Reflection", e.getLocalizedMessage()); }