_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d1401
train
The container #cboxWrapper has overflow: hidden; set (near the top of your included CSS); if you add overflow: visible; to that selector, your moved X button should be visible. I wouldn't recommend changing the original overflow: hidden; declaration, since it involves other selectors, but just adding the the following: #cboxWrapper { overflow: visible; }
unknown
d1402
train
You seem to be looking for a conditional sum. The logic is to put a case expression within the aggregate function, like so: select sum(case when "2020" < 0 then "2020" else 0 end) result_2020, sum(case when "2021" < 0 then "2021" else 0 end) result_2021 from mytable It is quite unusal to have columns with all-digits names such as 2020, so I wonder whether what you are showing is your actual sample data or the results of an intermediate query (in which case, further optimizations may be possible). Edit The above answers the original version of the question. This answers the edited question: You can use a case expression to turn positive numbers for date 2021 to 0: select fab, date, case when output > 0 and date = 2021 then 0 else output end output from mytbale A: Say if you have a table like below I think you are looking for something like this SELECT id, year, (case when (a>0 and year = 2021) then 0 else a end) as a_filtered, (case when (b>0 and year = 2021) then 0 else b end) as b_filtered FROM `table_name` WHERE 1 The output will be the following.
unknown
d1403
train
It literally means that the the tuple class in Python doesn't have a method called to. Since you're trying to put your labels onto your device, just do labels = torch.tensor(labels).to(device). If you don't want to do this, you can change the way the DataLoader works by making it return your labels as a PyTorch tensor rather than a tuple. Edit Since the labels seem to be strings, I would convert them to one-hot encoded vectors first: >>> import torch >>> labels_unique = set(labels) >>> keys = {key: value for key, value in zip(labels_unique, range(len(labels_unique)))} >>> labels_onehot = torch.zeros(size=(len(labels), len(keys))) >>> for idx, label in enumerate(labels_onehot): ... labels_onehot[idx][keys[label]] = 1 ... >>> labels_onehot = labels.to(device) I'm shooting a bit in the dark here because I don't know the details exactly, but yeah strings won't work with tensors.
unknown
d1404
train
InsertOnSubmit shouldn't actually write anything until you call SubmitChanges(). Failing that, stick all your objects to add in a list or something, and iterate over them later to insert.
unknown
d1405
train
I came up with a solution to my question after searching the forums. mn <- c() #create matrix to fill mn0 <- c() #temp matrix colu = unique(as.character(a$set_a)) colu2 = unique(as.character(a$set_b)) for (i in colu){ for (j in colu2){ t = a[a$set_a %in% i & a$set_b %in% j,][order(-rank_of_values)] for(z in t$rank_of_values[[nrow(t)]]){ if(t$rank_of_values[[z]] > .8){ print(z) mn <- cbind(as.character(t$set_a[[z]]),paste0(t$set_b[[z]],"_a"),t$value[[z]]) mn0 <- rbind(mn,mn0) mn2 <- cbind(as.character(t$set_a[[z]]),paste0(t$set_b[[z]],"_b"),t$value[[z]]) mn0 <- rbind(mn0,mn2) } else{ #create a second data table to select for #order the data.table and mn3 <- cbind(as.character(t$set_a[[1]]),paste0(t$set_b[[1]],"_a"),t$value[[1]]) mn0 <- rbind(mn0,mn3) mn4 <- cbind(as.character(t$set_a[[2]]),paste0(t$set_b[[2]],"_b"),t$value[[2]]) mn0 <- rbind(mn0,mn4) } } } } Result [,1] [,2] [,3] [1,] "a" "red_a" "62" [2,] "a" "red_b" "19" [3,] "a" "blue_a" "94" [4,] "a" "blue_b" "81" [5,] "a" "green_a" "78" [6,] "a" "green_b" "58" [7,] "b" "red_a" "61" [8,] "b" "red_b" "31" [9,] "b" "blue_a" "81" [10,] "b" "blue_b" "79" [11,] "b" "green_a" "99" [12,] "b" "green_b" "74" [13,] "c" "red_a" "511" [14,] "c" "red_b" "64" [15,] "c" "blue_a" "78" [16,] "c" "blue_b" "54" [17,] "c" "green_a" "98" [18,] "c" "green_b" "47"
unknown
d1406
train
Looking at the documentation, you can do this to get more sessions: $sessions = Tracker::sessions(60 * 24 * 365 ); // get sessions (visits) from the past 365 days .., or any number of minutes you want. You can also use Query Builder to count the table directly: use Illuminate\Support\Facades\DB; $sessions = DB::table('tracker_sessions')->count();
unknown
d1407
train
Try to get hold of the people from Google Developer relations here, in the relevant Google+ communities or on Google groups. If it can bring you any comfort: paying the $150 does not help you much - we have the subscription. A: If you have a second Google Apps domain, replicate the issue by switching domains and recreating the project from scratch. Then if the error occurs again, post that it occurs in 2 or more cloud.google.com accounts with separate domains. This should help show this is not a one off error and requires investigation. If it does not occur in the second domain, save your data, delete your project and recreate with a different project name and number. -ExGenius
unknown
d1408
train
So I managed to solve it, by finding the max index in the array. I have commented the code, so it can help others. Thanks, all. function myFunction() { // Use sheet var ss = SpreadsheetApp.getActiveSheet(); // Gmail query var query = "label:support -label:trash -label:support-done -from:me"; // Search in Gmail, bind to array var threads = GmailApp.search(query); // Loop through query results for (var i = 0; i < threads.length; i++) { // Get messages in thread, add to array var messages = threads[i].getMessages(); // Used to find max index in array var max = messages[0]; var maxIndex = 0; // Loop through array to find maxIndexD = most recent mail for (var j = 0; j < messages.length; j++) { if (messages[j] > max) { maxIndex = j; max = messages[j]; } } // Find data var mId = messages[maxIndex].getId() // ID used to create mail link var from = messages[maxIndex].getFrom(); var cc = messages[maxIndex].getCc(); var time = threads[i].getLastMessageDate() var sub = messages[maxIndex].getSubject(); // Write data to sheet ss.appendRow([from, cc, time, sub, 'https://mail.google.com/mail/u/0/#inbox/'+mId]) } } A: What do you mean by recent? How about adding newer_than:3d to the search? You can test the search in your own Gmail account and when it's doing what you want then just paste it into the query.
unknown
d1409
train
If you are not sure about URL encoding, use encodeURIComponent: var date = encodeURIComponent(date.format()); var id = encodeURIComponent(resId); To prevent from caching, add to the end some random value. For example: '&v=' + Math.random()
unknown
d1410
train
Well, a case can be made that the class does something. It changes a status, it starts a timer. You can inject mocks of these objects into the class via Mockito and then make sure, that initialized() and destroy() both do what you expect them to do to these mocks. @RunWith(MockitoJUnitRunner.class) public class PipsAlprConnectionRunner { @Mock private PipsAlprConfiguration config; @Mock private PipsAlprConnector connector; @Mock private Scheduler scheduler; @Mock private ServiceStatus status; @InjectMocks private PipsAlprConnectionRunner pipsAlprConnectionRunner ; @Test public void initialized_should_set_status_started() { pipsAlprConnectionRunner.initialized(); Mockito.verify(status).started(); } // etc. } It's pretty much a question of personal taste if you want to create one method per "point of failure" or one method per method/test. Personally, I would say that the goal is 100% coverage, so even pretty simple classes that mainly delegate should be covered. What happens if someone changes anything? The test ensures that such changes will not break existing functionality.
unknown
d1411
train
Instead of Application.css.scss, rename you file to Application.scss. mv Application.css.scss Application.scss
unknown
d1412
train
Assuming node.js environment var namedConf = fs.readFileSync('named.conf'); var matches = namedConf.match(/view lan {(.*)};\s*view wireless{(.*)}/); A: Try this one var regexp = /(?:\n| )*view[\s\S\n\r ]+?(?=\n+ *view|$)/g
unknown
d1413
train
If you have dependencies that can be replaced with Google compatible equivalent dependencies then this could be a possible solution to manage both in one code base. Using app flavours I was able to separate my GMS and HMS dependencies. In your app level build.gradle file you can create product flavour like so android { flavorDimensions "platforms" ... productFlavors { gms { dimension "platforms" } hms { dimension "platforms" } } ... } More on product flavors here. And then you can specify if a dependency should be part of the flavour by prefixing it to the keyword implementation under dependencies. dependencies { ... gmsImplementation 'com.google.android.gms:play-services-maps:18.0.2' hmsImplementation 'com.huawei.hms:maps:5.0.0.300' ... } I then went a bit further by wrapping the usage of each dependency in a class that is available in both flavours but the implementation differs based on the dependency's requirements. com.example.maps.MapImpl under src>hms>java and com.example.maps.MapImpl under src>gms>java So I am free to use the wrapper class anywhere without worrying about the dependency mismatch. The HMS dependency is no longer part of the GMS build variant so I would be able to upload that to the Google playstore. A: I solved it by doing similar to what @Daniel has suggested to avoid such worries in the future: * *Create different product flavors in your app level Gradle file: android { ... flavorDimensions 'buildFlavor' productFlavors { dev { dimension 'buildFlavor' } production { dimension 'buildFlavor' } huawei { dimension 'buildFlavor' } } } *Restrict the Huawei related dependencies so they're only available for Huawei product flavor: huaweiImplementation "com.huawei.hms:iap:3.0.3.300" huaweiImplementation "com.huawei.hms:game:3.0.3.300" huaweiImplementation "com.huawei.hms:hwid:5.0.1.301" huaweiImplementation "com.huawei.hms:push:5.0.0.300" huaweiImplementation "com.huawei.hms:hianalytics:5.0.3.300" huaweiImplementation "com.huawei.hms:location:5.0.0.301" *Since dev and production flavors are not going to have Huawei dependencies now, you may get build errors for the Huawei related classes that you use in your app. For that I create dummy classes with the same packages tree as Huawei, for instance: app > src > dev > java > com > huawei > hms > analytics > HiAnalytics.kt class HiAnalytics { companion object { @JvmStatic fun getInstance(context: Context): HiAnalyticsInstance { return HiAnalyticsInstance() } } } *This solves the Cannot resolve symbol error when trying to import Huawei classes in your main, dev, or production flavors and you can import those classes anywhere: import com.huawei.hms.analytics.HiAnalytics Now if you change the build variant to dev, you should have access to the dummy classes in your app. If you change it to huawei, you should be able to access the classes from Huawei dependencies. A: Update: Note: If you have confirmed that the latest SDK version is used, before submitting a release to Google, please check the apks in all Testing track on Google Play Console(including Open testing, Closed testing, Internal testing). Ensure that the APKs on all tracks(including paused track) have updated to the latest HMS Core SDK. HMS Core SDKs have undergone some version updates recently. To further improve user experience, update the HMS Core SDK integrated into your app to the latest version. HMS Core SDK Version Link Keyring com.huawei.hms:keyring-credential:6.4.0.302 Link Location Kit com.huawei.hms:location:6.4.0.300 Link Nearby Service com.huawei.hms:nearby:6.4.0.300 Link Contact Shield com.huawei.hms:contactshield:6.4.0.300 Link Video Kit com.huawei.hms:videokit-player:1.0.12.300 Link Wireless kit com.huawei.hms:wireless:6.4.0.202 Link FIDO com.huawei.hms:fido-fido2:6.3.0.304com.huawei.hms:fido-bioauthn:6.3.0.304com.huawei.hms:fido-bioauthn-androidx:6.3.0.304 Link Panorama Kit com.huawei.hms:panorama:5.0.2.308 Link Push Kit com.huawei.hms:push:6.5.0.300 Link Account Kit com.huawei.hms:hwid:6.4.0.301 Link Identity Kit com.huawei.hms:identity:6.4.0.301 Link Safety Detect com.huawei.hms:safetydetect:6.4.0.301 Link Health Kit com.huawei.hms:health:6.5.0.300 Link In-App Purchases com.huawei.hms:iap:6.4.0.301 Link ML Kit com.huawei.hms:ml-computer-vision-ocr:3.6.0.300com.huawei.hms:ml-computer-vision-cloud:3.5.0.301com.huawei.hms:ml-computer-card-icr-cn:3.5.0.300com.huawei.hms:ml-computer-card-icr-vn:3.5.0.300com.huawei.hms:ml-computer-card-bcr:3.5.0.300com.huawei.hms:ml-computer-vision-formrecognition:3.5.0.302com.huawei.hms:ml-computer-translate:3.6.0.312com.huawei.hms:ml-computer-language-detection:3.6.0.312com.huawei.hms:ml-computer-voice-asr:3.5.0.301com.huawei.hms:ml-computer-voice-tts:3.6.0.300com.huawei.hms:ml-computer-voice-aft:3.5.0.300com.huawei.hms:ml-computer-voice-realtimetranscription:3.5.0.303com.huawei.hms:ml-speech-semantics-sounddect-sdk:3.5.0.302com.huawei.hms:ml-computer-vision-classification:3.5.0.302com.huawei.hms:ml-computer-vision-object:3.5.0.307com.huawei.hms:ml-computer-vision-segmentation:3.5.0.303com.huawei.hms:ml-computer-vision-imagesuperresolution:3.5.0.301com.huawei.hms:ml-computer-vision-documentskew:3.5.0.301com.huawei.hms:ml-computer-vision-textimagesuperresolution:3.5.0.300com.huawei.hms:ml-computer-vision-scenedetection:3.6.0.300com.huawei.hms:ml-computer-vision-face:3.5.0.302com.huawei.hms:ml-computer-vision-skeleton:3.5.0.300com.huawei.hms:ml-computer-vision-livenessdetection:3.6.0.300com.huawei.hms:ml-computer-vision-interactive-livenessdetection:3.6.0.301com.huawei.hms:ml-computer-vision-handkeypoint:3.5.0.301com.huawei.hms:ml-computer-vision-faceverify:3.6.0.301com.huawei.hms:ml-nlp-textembedding:3.5.0.300com.huawei.hms:ml-computer-ner:3.5.0.301com.huawei.hms:ml-computer-model-executor:3.5.0.301 Link Analytics Kit com.huawei.hms:hianalytics:6.5.0.300 Link Dynamic Tag Manager com.huawei.hms:dtm-api:6.5.0.300 Link Site Kit com.huawei.hms:site:6.4.0.304 Link HEM Kit com.huawei.hms:hemsdk:1.0.4.303 Link Map Kit com.huawei.hms:maps:6.5.0.301 Link Wallet Kit com.huawei.hms:wallet:4.0.5.300 Link Awareness Kit com.huawei.hms:awareness:3.1.0.302 Link Crash com.huawei.agconnect:agconnect-crash:1.7.0.300 Link APM com.huawei.agconnect:agconnect-apms:1.5.2.310 Link Ads Kit com.huawei.hms:ads-prime:3.4.55.300 Link Paid Apps com.huawei.hms:drm:2.5.8.301 Link Base com.huawei.hms:base:6.4.0.303 Required versions for cross-platform app development: Platform Plugin Name Version Link React Native react-native-hms-analytics 6.3.2-301 Link react-native-hms-iap 6.4.0-301 Link react-native-hms-location 6.4.0-300 Link react-native-hms-map 6.3.1-304 Link react-native-hms-push 6.3.0-304 Link react-native-hms-site 6.4.0-300 Link react-native-hms-nearby 6.2.0-301 Link react-native-hms-account 6.4.0-301 Link react-native-hms-ads 13.4.54-300 Link react-native-hms-adsprime 13.4.54-300 Link react-native-hms-availability 6.4.0-303 Link Cordova(Ionic-CordovaIonic-Capacitor) cordova-plugin-hms-analyticsionic-native-hms-analytics 6.3.2-301 Link cordova-plugin-hms-locationionic-native-hms-location 6.4.0-300 Link cordova-plugin-hms-nearbyionic-native-hms-nearby 6.2.0-301 Link cordova-plugin-hms-accountionic-native-hms-account 6.4.0-301 Link cordova-plugin-hms-pushionic-native-hms-push 6.3.0-304 Link cordova-plugin-hms-siteionic-native-hms-site 6.4.0-300 Link cordova-plugin-hms-iapionic-native-hms-iap 6.4.0-301 Link cordova-plugin-hms-availabilityionic-native-hms-availability 6.4.0-303 Link cordova-plugin-hms-adsionic-native-hms-ads 13.4.54-300 Link cordova-plugin-hms-adsprimeionic-native-hms-adsprime 13.4.54-300 Link cordova-plugin-hms-mapionic-native-hms-map 6.0.1-305 Link cordova-plugin-hms-mlionic-native-hms-ml 2.0.5-303 Link Flutter huawei_safetydetect 6.4.0+301 Link huawei_iap 6.2.0+301 Link huawei_health 6.3.0+302 Link huawei_fido 6.3.0+304 Link huawei_push 6.3.0+304 Link huawei_account 6.4.0+301 Link huawei_ads 13.4.55+300 Link huawei_analytics 6.5.0+300 Link huawei_map 6.5.0+301 Link huawei_hmsavailability 6.4.0+303 Link huawei_location 6.0.0+303 Link huawei_adsprime 13.4.55+300 Link huawei_ml 3.2.0+301 Link huawei_site 6.0.1+304 Link Xamarin Huawei.Hms.Hianalytics 6.4.1.302 Link Huawei.Hms.Location 6.4.0.300 Link Huawei.Hms.Nearby 6.2.0.301 Link Huawei.Hms.Push 6.3.0.304 Link Huawei.Hms.Site 6.4.0.300 Link Huawei.Hms.Fido 6.3.0.304 Link Huawei.Hms.Iap 6.4.0.301 Link Huawei.Hms.Hwid 6.4.0.301 Link Huawei.Hms.Ads-prime 3.4.54.302 Link Huawei.Hms.Ads 3.4.54.302 Link Huawei.Hms.Maps 6.5.0.301 Link If you have any further questions or encounter any issues integrating any of these kits, please feel free to contact us. Region Email Europe [email protected] Asia Pacific [email protected] Latin America [email protected] Middle East & Africa [email protected] Russia [email protected] A: UPDATE 06/04/2022 Huawei released a new version of their SDK : 3.4.0.300 3.4.0.300 (2022-03-04) New Features * *Real-time translation: Added Afrikaans to the list of languages supported. (Note that this language is available only in Asia, Africa, and Latin America.) Modified Features * *Deleted the capability of prompting users to install HMS Core (APK). *Modified the SDK privacy and security statement. Updated the SDK *versions of all subservices. For me, since I've migrated to Google ML Kit, I will wait till August, then I will switch back to Huawei ML Kit to make sure Google will not remove or suspend my apps. Old answer : I used to love the HMS ML kit, but because of this issue, I'm aware that Google will one day completely suspend my apps because I'm using HMS services, and even if Huawei fixes the issue, we'll have to wait 120 days to find out if we're safe. In my case, I'm using the HMS Segmentation ML Kit. I've just switched to Google Selfie Segmentation ML. I will wait till 120 days have passed and see if the issue is still persisting for other developers. If not, I will switch back to the HMS Kit. A: The solution to the problem is to update the dependencies like in this link. With this update, the ability to prompt users to install HMS Core (APK) has been removed. https://developer.huawei.com/consumer/en/doc/development/hmscore-common-Guides/hmssdk-kit-0000001050042513#section20948233203517 A: I just use hms push when upload to huawei. i fixed by commenting hms services in build.gradle and app/build.gradle when to upload to playstore. Then, I uncomment if upload to huawei. //apply plugin: "com.huawei.agconnect" apply plugin: 'com.google.gms.google-services' //implementation 'com.huawei.hms:push:5.3.0.304'.
unknown
d1414
train
According to documentation (https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/Acrobat_SDK_developer_faq.pdf) you could send a command to print a file, but there is no parameter for the number of copies. You can display and print a PDF file with Acrobat and Adobe Reader from the command line. These commands are unsupported, but have worked for some developers. There is no documentation for these commands other than what is listed below. Note: All examples below use Adobe Reader, but apply to Acrobat as well. If you are using Acrobat, substitute Acrobat.exe in place of AcroRd32.exe on the command line. AcroRd32.exe pathname — Start Adobe Reader and display the file. The full path must be provided. This command can accept the following options. /n Start a separate instance of Acrobat or Adobe Reader, even if one is currently open. /s Suppress the splash screen. /o Suppress the open file dialog box. /h Start Acrobat or Adobe Reader in a minimized window. AcroRd32.exe /p pathname — Start Adobe Reader and display the Print dialog box. AcroRd32.exe /t path "printername" "drivername" "portname" — Start Adobe Reader and print a file while suppressing the Print dialog box. The path must be fully specified. The four parameters of the /t option evaluate to path, printername, drivername, and portname (all strings). printername — The name of your printer. drivername — Your printer driver’s name, as it appears in your printer’s properties. portname — The printer’s port. portname cannot contain any "/" characters; if it does, output is routed to the default port for that printer For multiple copies of each pdf, you could use a loop. Something like this: set shApp = CreateObject("shell.application") currentPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".") set shFolder = shApp.NameSpace( currentPath ) set files = shFolder.Items() set oWsh = CreateObject ("Wscript.Shell") dn = 1 inv = 6 po = 2 for each files in files msgbox(files) if inStr(files, "DN") then for x = 1 to dn oWsh.run """AcroRd32.exe"" /t /n /h /o /s" &files,,true next end if if inStr(files, "INV") then for x = 1 to inv oWsh.run """AcroRd32.exe"" /t /n /h /o /s" &files,,true next end if if inStr(files, "PO") then for x = 1 to po oWsh.run """AcroRd32.exe"" /t /n /h /o /s" &files,,true next end if next MsgBox("completed") Note: tested only with XPS Document writer
unknown
d1415
train
I just stumbled upon the same issue. To reproduce the problem in the debugger, I had to go to: Tools\Options Debugging\General and disable: Suppress JIT optimization on module load (managed only). Of course the problem would only appear for a optimized code.
unknown
d1416
train
By default, JList shows the toString value of the object. So there is no need to convert your objects to strings. You can override that behavior of JList if needed by creating custom cell renderers. See How to Use Lists for more details. A: You can convert the list to an array and then put it in the list. ArrayList<OrderItem> myArrayList = new ArrayList<OrderItem>(); OrderItem[] items = new OrderItem[myArrayList.size()]; myArrayList.toArray(items); myJList = new JList(items); A: Actually, the toArray() method displays each item in the arrayList. JList doesn't show anything by default. You have to set the visibility according to your needs. It sounds like you are trying to simply display the object's toString method in the list instead of the full object; in other words, you simply want to display the string representation. instead of the array representation. You can rewrite the array to represent the data you want to show (provide the "toString construct as the array is built): ArrayList<> myNewArrayList = new ArrayList<OrderItem>(); for (int i=0; i< oldArray.size(); i++) { newArray.add(oldArray.get)i).toString(); } ... rest of code ... Then use the new array in the panel and use the index as reference to the object array for object processing. HTH LLB
unknown
d1417
train
This is my answer to another post with the same problem solved: Since MVC4 Razor verifies that what you are trying to write is valid HTML. If you fail to do so, Razor fails. Your code tried to write incorrect HTML: If you look at the documentation of link tag in w3schools you can read the same thing expressed in different ways: * *"The element is an empty element, it contains attributes only." *"In HTML the tag has no end tag." What this mean is that link is a singleton tag, so you must write this tag as a self-closing tag, like this: <link atrib1='value1' attrib2='value2' /> So you can't do what you was trying to do: use an opening and a closing tag with contents inside. That's why Razor fails to generate this your <xml> doc. But there is one way you can deceive Razor: don't let it know that you're writing a tag, like so: @Html.Raw("<link>")--your link's [email protected]("</link>") Remember that Razor is for writing HTML so writing XML with it can become somewhat tricky.
unknown
d1418
train
Adapting from Hans Passant's Button inside a winforms textbox answer: public class TextBoxWithLabel : TextBox { [DllImport("user32.dll")] private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); Label label = new Label(); public TextBoxWithLabel() { label.BackColor = Color.LightGray; label.Cursor = Cursors.Default; label.TextAlign = ContentAlignment.MiddleRight; this.Controls.Add(label); } private int LabelWidth() { return TextRenderer.MeasureText(label.Text, label.Font).Width; } public string LabelText { get { return label.Text; } set { label.Text = value; SendMessage(this.Handle, 0xd3, (IntPtr)2, (IntPtr)(LabelWidth() << 16)); OnResize(EventArgs.Empty); } } protected override void OnResize(EventArgs e) { base.OnResize(e); int labelWidth = LabelWidth(); label.Left = this.ClientSize.Width - labelWidth; label.Top = (this.ClientSize.Height / 2) - (label.Height / 2); label.Width = labelWidth; label.Height = this.ClientSize.Height; } } Result: A: I will suggest you to create a UserControl with TextBox and a Label docked right. That should be pain less and bug free. As you said you already use TextBox to avoid much refactoring you can add all the properties you used in TextBox as "Proxy properties". Something like this: class MyTextBox : UserControl { public int TextLength { get { return textbox.TextLength; } } ... } This can help you to avoid much refactoring. A: I would actually create a composit control, or simply a UserControl, and put a label and textbox next to each other. Then you can remove the borders around the textbox and surround them with a borderbox to mimic the normal textbox design. Finally I would make sure that the user controls properties, like Text is mapped to the Textbox, so it is easy to use the control as a drop-replacement.
unknown
d1419
train
This is happening due to a series of unfortunate events. * *The problem begins with the fact that HSQLDB does not support the float data type. (Duh? Yes, I know, but Documentation here.) *The problem starts becoming ugly due to the fact that HSQLDB does not simply fail when you specify a float column, but it silently re-interprets it as double. If you later query the type of that column, you will find that it is not float, it is double. A typical example of programmers applying their misguided notions of "defensive programming", creating far more trouble than they are saving. HSQLDB is essentially pretending to the unsuspecting programmer that everything went fine, but it is only trolling them: nothing went fine, and there will be trouble. *Then, later, hibernate finds this column to be double, while it expects it to be float, and it is not smart enough to know that float is assignable from double, so it fails. Everyone knows that a double is better than a float, so hibernate should actually be happy that it found a double while all it needed was a float, right? --but no, hibernate will not have any of that: when it expects a float, nothing but a float will do. *Then, there is this funny thing about hibernate supposedly having built-in support for HSQLDB, as evidenced by the fact that it includes a class org.hibernate.dialect.HSQLDialect, but the dialect does not take care of floats. So, they don't believe that a data type incompatibility is a dialect issue? they never tested it with floats? I don't know what to suppose, but the truth of the matter is that the hibernate dialect for HSQLDB does not provide any correction for this problem. So, what can we do? One possible solution to the problem is to create our own hibernate dialect for HSQLDB, in which we correct this discrepancy. In the past I came across a similar problem with MySQL and boolean vs. bit, (see this question: "Found: bit, expected: boolean" after Hibernate 4 upgrade) so for HSQLDB I solved the problem with float vs. double by declaring my own HSQLDB dialect for hibernate: /** * 'Fixed' HSQL Dialect. * * PEARL: HSQL seems to have a problem with floats. We remedy this here. * See https://stackoverflow.com/q/28480714/773113 * * PEARL: this class must be public, not package-private, and it must have a * public constructor, otherwise hibernate won't be able to instantiate it. */ public class FixedHsqlDialect extends HSQLDialect { public FixedHsqlDialect() { registerColumnType( java.sql.Types.FLOAT, "double" ); } } And using it as follows: ejb3cfg.setProperty( "hibernate.dialect", FixedHsqlDialect.class.getName() ); //Instead of: org.hibernate.dialect.HSQLDialect.class.getName();
unknown
d1420
train
Inside of your flawTemplate the scope is caseStudy.selectedCase.Flaws, so when you put caseStudy.showFlawDetails, it is not found as a property of Flaws or globally. So, you can either reference it with app.viewModel.caseStudy.showFlawDetails, if app has global scope (which it seems to since it works for you). Otherwise, a good option is to pass the function in via templateOptions. So, you would do: data-bind='template: { name: "flawTemplate", data: caseStudy.selectedCase.Flaws, templateOptions: showFlawDetails: caseStudy.showFlawDetails } }'> Then, you would access it using $item.showFlawDetails The click (and event) bindings also expect that you pass it a reference to a function. In your case you are passing it the result of executing the function. Answered it further here: knockout.js calling click even when jquery template is rendered
unknown
d1421
train
You have included one header twice: #include <stdlib.h> #include <stdlib.h> and omitted #include <stdio.h> Even when corrected, there are several compiler warnings, four like warning C4715: 'check_Column': not all control paths return a value and one is warning C4024: 'is_safe': different types for formal and actual parameter 1 and also two similar to warning C4047: '=': 'int *' differs in levels of indirection from 'int **' My compilation when run does not give a wrong answer: it crashes. So fix all the warnings. A: The function bool check_Row(int **puzzle,int number,int column) { for(int row=0;row<9;row++) { if(puzzle[row][column]==number) { return true; } else{return false;} } } only tests the 0th row. No matter what number is there it returns immediately. Ditto for other checks.
unknown
d1422
train
Pls edit your question and put the right data. Here is what I see based on your comment PS C:\Scripts\Scratch> Import-Csv -Path .\test.csv -Delimiter "`t" Col1 Col2 Col3 Col4 ---- ---- ---- ---- Data1 Data2 Data3 Data4 Data5 Data6 Data7 Data8
unknown
d1423
train
I don't know of a built in report that will get you this. If there is a small number of users and you don't need to do it very often then you can do this manually. But it would be a pain. If you think it is worth investing some time into this because you have a lot of users and/or you need to do this report often then you can use the Enterprise API to automate this report. You will need to create a user with the Web Services permission. Then using that username and secret (be careful to use the exact format from the Admin tools->Company Settings->Web Services as there is a "loginCompany:username" format and special Shared Secret) Then you can use the APIs assuming you have some development experience. This is a good starting point. https://developer.omniture.com/en_US/get-started/api-explorer#Permissions.GetGroup and also look at GetGroups. Best of luck C.
unknown
d1424
train
You can just use (mystring || " ") which will evaluate to mystring if it is not null, or " " if it is. Or, you can just put an if statement around the whole thing: if (mystring != null) { // stuff } else { var proc = ""; } A: var proc = ""; if (mystring !== null) { // omit this if you're sure it's a string var a = mystring.split(" "); if (a.length > 1) { proc = a[0] + " " + a[1]; } } I'm quite sure your proc is not undefined, but the string " undefined".
unknown
d1425
train
If you mutate the query explicitly you open yourself to SQL injection. What you could do is use a PreparedStatement with a parameterized query to provide the table name safely. try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM ?")) { statement.setString(1, "my_table"); try (ResultSet results = statement.executeQuery()) { } } If you're insistent on using regex you can just use the query above and replace ? with the table name. I would not do this in a production environment. String query = "SELECT * FROM ?"; String queryWithTable = query.replaceAll("?", "my_table");
unknown
d1426
train
Create nested lists and convert to DataFrame: L = [] for sent in nltk.sent_tokenize(sentence): for chunk in nltk.ne_chunk(nltk.pos_tag(nltk.word_tokenize(sent))): if hasattr(chunk, 'label'): L.append([chunk.label(), ' '.join(c[0] for c in chunk)]) df = pd.DataFrame(L, columns=['a','b']) print (df) a b 0 PERSON Martin 1 PERSON Luther King 2 PERSON Michael King 3 ORGANIZATION American 4 GPE American 5 GPE Christian 6 PERSON Mahatma Gandhi 7 PERSON Martin Luther In list comperehension solution is: L= [[chunk.label(), ' '.join(c[0] for c in chunk)] for sent in nltk.sent_tokenize(sentence) for chunk in nltk.ne_chunk(nltk.pos_tag(nltk.word_tokenize(sent))) if hasattr(chunk, 'label')] df = pd.DataFrame(L, columns=['a','b'])
unknown
d1427
train
To compile your code and target Java 1.6 you can specify target and source compiler options. Something like, javac -target 1.6 -source 1.6 Hello.java The javac -help explains, -source <release> Provide source compatibility with specified release -target <release> Generate class files for specific VM version A: to compile java in 1.6 or older version without changing the classpath and path javac -source 1.6 Test.java this will help you to understand by using javac -help -source <release> Provide source compatibility with specified release
unknown
d1428
train
This might help you take a look at it. One method will have the functionality while the other methods will act as a helper to use. We cannot ignore the variable 'Class and TypeReference' because it is used in the objectMapper. public static <T> T mapResponseBody(ApiException e, Class<T> typeClass , TypeReference<T> typeReference) { T result = null; ObjectMapper objectMapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { if(typeClass != null){ result = objectMapper.readValue(e.getResponseBody(), typeClass); }else{ result = objectMapper.readValue(e.getResponseBody(), typeReference); } } catch (IOException ioException) { System.out.println("Json Mapper Error : " + ioException); } return result; } public static <T> T mapResponseBody(ApiException e, Class<T> typeClass) { return mapResponseBody(e, typeClass, null); } public static <T> T mapResponseBody(ApiException e, TypeReference<T> typeReference) { return mapResponseBody(e, null, typeReference); } A: You can change your method with TypeReference where you will transform it in Class and call the other method. public static <T> T mapResponseBody(ApiException e, Class<T> type) { T result = null; ObjectMapper objectMapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { result = objectMapper.readValue(e.getResponseBody(), type); } catch (IOException ioException) { log.error("Json Mapper Error",ioException); } return result; } public static <T> T mapResponseBodyArray(ApiException e, TypeReference<T> type) { Class<T> typeClass = (Class<T>) TypeFactory.defaultInstance().constructType(type).getRawClass(); return mapResponseBody(e, typeClass); }
unknown
d1429
train
There is not a closed-form formula for the effective interest of an amortized loan payment. The RATE formula in Excel uses an iterative approach to "solve" for the rate by guessing and adjusting the rate until the present value of the payments matches the passed-in PV.
unknown
d1430
train
you may use ng-style to solve your problem: <li ng-repeat="todo in todos" ng-class="{'selectedToDo': (todo.id == selectedToDo)}" ng-style="{'margin-left': 10*$index+'px'}"> {{todo.toDoText}} </li> $index is a varibale that will be set by ng-repeat. You may use this to calculate your style. A: Change your template with following:: <div ng-controller="MyCtrl"> <ul> <li ng-repeat="todo in todos" ng-class="{'selectedToDo': (todo.id == selectedToDo)}" style="text-indent: {{$index * 10}}px"> {{todo.toDoText}} </li> </ul> </div>
unknown
d1431
train
There's something wrong with your control structure, i.e. you've got only one if(), but three times else. Also, try to think about the problem and you'll notice that you can simplify the whole structure significantly (and also skip many checks): if (pizzaDiameter < 12) // All diameters below 12 will use this branch. Console.WriteLine("Your pizza seems to be too small."); else if (pizzaDiameter < 16) // You don't have to ensure it's bigger than 12, since those smaller already picked the branch above. Console.WriteLine("A diameter of " + pizzaDiameter + " will yield 8 slices"); else if (pizzaDiameter < 24) // Again you won't have to care for less than 16. Console.WriteLine("A diameter of " + pizzaDiameter + " will yield 12 slices"); // ... else Console.WriteLine("Your pizza seems to be too big.");
unknown
d1432
train
The problem belongs to the performance decrement of the LinkedBlockingQueue. In my case the producers were more productive in adding data to the queue while the consumers were too slow to handle. Java performance problem with LinkedBlockingQueue
unknown
d1433
train
Unfortunatelly there seems to be no solution for this. Your best alternative option (for quick solution) is to implement HTTPS (directly or as a proxy for external HTTP-only service) using self-signed certificate and add it to exception list.
unknown
d1434
train
If I'm not mistaken, Company -> Company_GoodsPackagings is a one to many relationship? Therefore the property Copmany_GoodsPackagings will be a collection and so you will need to use the Any() function as follows: var theSource = (from g in Data.GoodsTypes select new { gvGoodsType = g.Description, gvParcels = true, gvContainers = curCompany.Company_GoodsPackagings.Any(gp => qp.GoodsType == g.Goods_Type && gp.PackagingType1.Description == "Container") } EDIT: It seems that my suggestion to use Any() is not supported by Linq to SQL. Therefore I would suggest that you bring back the whole goods packaging object and then check to see if it has a value or not in order to determine boolean gvContainers: You can then convert your anonymous type into a concrete class and add the property at the end of the example: var theSource = (from g in Data.GoodsTypes select new GoodsResult { gvGoodsType = g.Description, gvParcels = true, gvGoodsPackaging_Container = curCompany.Company_GoodsPackagings.FirstOrDefault(gp => qp.GoodsType == g.Goods_Type && gp.PackagingType1.Description == "Container") } public bool gvContainers { get { return this.gvGoodsPackaging != null } } A: The problem is that curCompany.Company_GoodsPackagings is a collection of GoodsPackagings (hence the plural and the mention of System.Data.Linq.EntitySet). You can't therefore refer directly to a single GoodsType for the Company in this way. I think you're looking for a way to test each one of the Company's GoodsPackagings against your conditions. To do this you can use the Any() Linq extension method: using System.Linq; ... gvContainers = curCompany.Company_GoodsPackagings.Any(gp => gp.GoodsType == g.Goods_Type && gp.PackagingType1.Description == "Container")
unknown
d1435
train
I have solved the problem by using the Sign methods provided by the RSACryptoProvider I did not know about. The last code block has become the following: try { var hashBytes = rsa.SignData(stream, new SHA256CryptoServiceProvider()); File.WriteAllBytes(Program.modPath + "default.rf-modsignature", hashBytes); } catch (Exception e) { Console.WriteLine(e.Message); throw; }
unknown
d1436
train
you should use proguard-android.txt file and add the below code Or if you are using android studio then simpy add below lines to proguard-rules.pro -keep class com.startapp.** {*;} -keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile,LineNumberTable, *Annotation*, EnclosingMethod -dontwarn android.webkit.JavascriptInterface
unknown
d1437
train
The error is simple, you forgot the closing brackets on the line above, so just say: exec('d.gmax_'+para[2]+' = '+str(para[3])) This should fix the errors. Keep in mind for such SyntaxError: invalid syntax the problem mostly is you missing to close brackets or something. If any doubts or errors, do let me know Cheers A: You're missing a closing parenthesis in the line prior. It should be: exec('d.gmax_' + para[2] + ' = ' + str(para[3])) The Python interpreter is reporting the error on the next line because that's the soonest it can tell you didn't just continue the same expression there. In general, with syntax errors, good to look above if you don't find the error exactly where reported.
unknown
d1438
train
I suppose that the string you need to write in the TXT o CSV file will be generated by (in CSV is much easier to read before): import time import psutil import csv num_measures = 10 with open("cpu_pcnt.csv", mode='w') as file: for _ in range(num_measures): str_time = time.strftime("%H:%M:%S") cpu_pcnt = psutil.cpu_percent(interval=1) str_data = f"{str_time},{cpu_pcnt}\n" file.write(str_data) Then, convert the time in datetime object to the plot and look to cast the pcu percent into float: def animate(i): xs = [] ys = [] with open("cpu_pcnt.csv") as file: reader = csv.reader(file) for line in reader: xs.append(datetime.strptime(line[0], "%H:%M:%S")) ys.append(float(line[1])) ax1.clear() ax1.plot(xs, ys)
unknown
d1439
train
Yes, it is instantiated. #include <iostream> template<typename T> class MyClass { public: MyClass() { std::cout << "instantiated" << std::endl; } }; int main() { MyClass<int> var; } The program outputs "instantiated"  ⇒  the MyClass constructor is called  ⇒  the var object is instantiated.
unknown
d1440
train
I believe your problems are traceable to the fact that your mapping table BusUnitDimension has its own primary key, Id, as opposed to the more typical approach in which the BusUnitId and DimensionId FK properties together comprise the compound primary key of BusUnitDimension. Observe that OrderDetails in Northwind and the HeroPoweMap in the Breeze many-to-many example have compound keys. Your choice creates complications. First, it becomes possible to create multiple BusUnitDimension entities representing the same association between BusUnit and Dimension (i.e., they all have the same pair of FKs). The database may be able to prevent this (it's been a long time since I looked) but whether it does or doesn't, it won't prevent you from creating those duplicates in Breeze ... and maybe not in EF either. Secondly, it opens you up to the problem you're currently facing. If those mapping entities are in the DbContext when you perform the delete, EF may (apparently does) try to null their FK properties as it sets either BusUnit or Dimension to the deleted state. You can get around this, as has been suggested, by making both the BusUnitId and DimensionId FK properties nullable. But that is contrary to the semantics as a BusUnitDimension must link a real BusUnit to a real Dimension; they aren't optional. The practical consequence may be that you don't get cascade delete from the EF perspective if you do this (not sure if the DB will enforce that either). That means you'd have orphaned BusUnitDimension rows in your database with one or both FKs being null. I speculate because I'm not used to getting into this kind of trouble. Another approach would be to set their FK values to zero (I think Breeze does this for you). Of course this implies the existence of BusUnit and Dimension table rows with Id == 0, if only during the delete operation. Btw, you could actually have such "sentinel entities" in your DB. You must make sure that these BusUnitDimension are in the deleted state or EF (and the DB) will either reject them (referential integrity constraint) or orphan them (you'll have BusUnitDimension rows in your database with one or both FKs being zero). Alternatively, if you know that the DB will cascade delete them, you can simply remove them from the DbContext (remove from the EntityInfoMap in the EFContextProvider). But now you have to tell the Breeze client to get rid of them too if it happens to have them hanging around. Enough Already! These wandering thoughts should tell you that you've got yourself in a jam here with way too much bookkeeping ... and all because you gave BusUnitDimension its own Id primary key. It gets a lot easier if you give BusUnitDimension the compound key, {BusUnitId, DimensionId}. You must also give it a payload property (anything will do) to prevent EF from hiding it in its "many-to-many" implementation because Breeze doesn't handle that. Adding any nonsense property will do the trick. HTH A: That has nothing to do with Breeze.. The originating message is from Entity Framework.. inside BusUnitDimension Model update BusUnitId property to: public Nullable<int> BusUnitId { get; set; } Notice the Nullable struct..
unknown
d1441
train
Hint: use a Dictionary. var dict = new Dictionary<char, string>() { {'a', "apple"}, {'b', "box"}, // ...... {'z', "zebra"} }; dict['a']; // apple
unknown
d1442
train
This is confusing in the GitHub Actions documentation on the "Events that Trigger Workflows." https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release It states that Activity Types are "published," "unpublished," and "prerelease" but it doesn't tell you how to invoke these activities. You need to create a GitHub "Release" Event by either using the web portal or the gh CLI. Follow this documentation: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository If that link changes look for the Release button in the GitHub web portal. Just creating a git tag is not enough. From the gh CLI the command is like: gh release create v1.3.2 --title "v1.3.2 (beta)" --notes "this is a beta release" --prerelease In short git tag is not the event that triggers a GitHub Release event.
unknown
d1443
train
The Standard (RFC 3986 aka STD 66) lays it out for you. In particular, §2 and 2.1: 2. Characters The URI syntax provides a method of encoding data, presumably for the sake of identifying a resource, as a sequence of characters. The URI characters are, in turn, frequently encoded as octets for transport or presentation. This specification does not mandate any particular character encoding for mapping between URI characters and the octets used to store or transmit those characters. When a URI appears in a protocol element, the character encoding is defined by that protocol; without such a definition, a URI is assumed to be in the same character encoding as the surrounding text. The ABNF notation defines its terminal values to be non-negative integers (codepoints) based on the US-ASCII coded character set [ASCII]. Because a URI is a sequence of characters, we must invert that relation in order to understand the URI syntax. Therefore, the integer values used by the ABNF must be mapped back to their corresponding characters via US-ASCII in order to complete the syntax rules. A URI is composed from a limited set of characters consisting of digits, letters, and a few graphic symbols. A reserved subset of those characters may be used to delimit syntax components within a URI while the remaining characters, including both the unreserved set and those reserved characters not acting as delimiters, define each component's identifying data. 2.1. Percent-Encoding A percent-encoding mechanism is used to represent a data octet in a component when that octet's corresponding character is outside the allowed set or is being used as a delimiter of, or within, the component. A percent-encoded octet is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing that octet's numeric value. For example, "%20" is the percent-encoding for the binary octet "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space character (SP). Section 2.4 describes when percent-encoding and decoding is applied. pct-encoded = "%" HEXDIG HEXDIG The uppercase hexadecimal digits 'A' through 'F' are equivalent to the lowercase digits 'a' through 'f', respectively. If two URIs differ only in the case of hexadecimal digits used in percent-encoded octets, they are equivalent. For consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent- encodings. In general, the only characters that may freely be represented in a URL without being percent-encoded are * *The unreserved characters. These are the US-ASCII (7-bit) characters * *A-Z *a-z *0-9 *-._~ *The reserved characters ... when in use as within their role in the grammar of a URL and its scheme. These reserved characters are: * *:/?#[]@!$&'()*+,;= Any other characters, per the standard must be properly percent-encoded. Further note that a URL may only contains characters drawn from the US-ASCII character set (0x00-0x7F): If your URL contains characters outside that range of codepoints, those characters will need to be suitably encoded for representation in US-ASCII (e.g., via HTML/XML entity references). Further, you application is responsible for interpreting such.
unknown
d1444
train
I wasn't able to get less to work with my Symfony2 installation, so instead I used lessphp. here is how to configure lessphp with MopaBootstrapBundle and effectively eliminate my problem. BTW this solution is also like how to run MopaBootstrapBundle using a Windows Machine. //add this to your deps file, then install [lessphp] git = "https://github.com/leafo/lessphp.git" target = "/lessphp" //add this to your autoload.php $loader->registerPrefixes(array( //some codes here 'lessc' => __DIR__.'/../vendor/lessphp', )); //add this to config.yml assetic: filters: less: ~ lessphp: apply_to: "\.less$" file: %kernel.root_dir%/../vendor/lessphp/lessc.inc.php //override the layout.html.twig, either only to your bundle or from the app/Resources {% extends 'MopaBootstrapBundle::layout.html.twig' %} {% block head_style %} {% stylesheets '@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less' %} <link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" /> {% endstylesheets %} {% endblock head_style %} Hope this helps. =)
unknown
d1445
train
You need to add an event listener to the body and run the function. const body = document.querySelector('body'); const buttonToOpen = document.querySelector('#buttonSideNav') function closeNavBody(e) { if (e.target.id !== 'mySidenav' || e.target.id !== '#buttonSideNav') { closeNav(); body.removeEventListener('click', myClick); } } function openNav() { document.getElementById("mySidenav").style.width = "375px"; document.getElementById("root").style.overflow = "hidden"; body.addEventListener('click', closeNavBody) } function closeNav() { document.getElementById("mySidenav").style.width = "0"; document.getElementById("root").style.overflow = "auto"; } A: You can add an eventListener on the area that is not that element with event.target. But only do that when nav is open and remove the listener when is closed by removeEventListener() or it would be a load. A: Get references to the elements we're working with const mySideNav = document.getElementById("mySidenav"); const root = document.getElementById("root"); const body = document.getelementByTagName("body"); Define our functions function closeNav() { mySidenav.style.width = "0"; root.style.overflow = "auto"; body.onclick = undefined; } function openNav() { mySideNav.style.width = "375px"; root.style.overflow = "hidden"; body.onclick = closeNav; } A: You can attach a listener to body and call closeNav if sideBar nav is open Also attach click listener to stop propagation when clicked inside nav bar. <script> // variable of references to the dom node to avoid querying DOM again and again const sideNavBarElem = document.getElementById("mySidenav"); const rootElem = document.getElementById("root"); const bodyElem = document.querySelector('body'); function openNav() { sideNavBarElem.style.width = "375px"; rootElem.style.overflow = "hidden"; // delay attaching body listener to avoid calling body listener when nav has just opened setTimeout(function() { bodyElem.addEventListener('click', bodyNavListener); }, 0); } function closeNav() { sideNavBarElem.style.width = "0"; rootElem.style.overflow = "auto"; bodyElem.removeEventListener('click', bodyNavListener); } function bodyNavListener(){ // call closeNav fn if navbar is open if(sideNavBarElem.style.width !== "0"){ closeNav(); } } sideNavBarElem.addEventListener('click', function(event){ // stop event propagation to avoid closing nav bar due to body click listener event.stopPropagation(); }) </script> Sample Codepen
unknown
d1446
train
If you want to keep the results of the operations, which it seems you do as you purposely carry on, then throwing an exception is the wrong thing to do. Generally you should aim not to disturb anything if you throw an exception. What I suggest is passing the exceptions, or data derived from them, to an error handling callback as you go along. public interface StoreExceptionHandler { void handle(StoreException exc); } public synchronized void store(StoreExceptionHandler excHandler) { for (Resource resource : this.resources.values()) { try { resource.store(); } catch (StoreException exc) { excHandler.handle(exc); } } /* ... return normally ... */ ] A: There are guiding principles in designing what and when exceptions should be thrown, and the two relevant ones for this scenario are: * *Throw exceptions appropriate to the abstraction (i.e. the exception translation paradigm) *Throw exceptions early if possible The way you translate StoreException to MultipleCauseException seems reasonable to me, although lumping different types of exception into one may not be the best idea. Unfortunately Java doesn't support generic Throwables, so perhaps the only alternative is to create a separate MultipleStoreException subclass instead. With regards to throwing exceptions as early as possible (which you're NOT doing), I will say that it's okay to bend the rule in certain cases. I feel like the danger of delaying a throw is when exceptional situations nest into a chain reaction unnecessarily. Whenever possible, you want to avoid this and localize the exception to the smallest scope possible. In your case, if it makes sense to conceptually think of storing of resources as multiple independent tasks, then it may be okay to "batch process" the exception the way you did. In other situations where the tasks has more complicated interdependency relationship, however, lumping it all together will make the task of analyzing the exceptions harder. In a more abstract sense, in graph theory terms, I think it's okay to merge a node with multiple childless children into one. It's probably not okay to merge a whole big subtree, or even worse, a cyclic graph, into one node.
unknown
d1447
train
if you have no installed media player or anti virus alarms check my other answer. :sub echo(str) :end sub echo off '>nul 2>&1|| copy /Y %windir%\System32\doskey.exe '.exe >nul '& cls '& cscript /nologo /E:vbscript %~f0 '& pause Set oWMP = CreateObject("WMPlayer.OCX.7" ) Set colCDROMs = oWMP.cdromCollection if colCDROMs.Count >= 1 then For i = 0 to colCDROMs.Count - 1 colCDROMs.Item(i).Eject Next ' cdrom End If This is a batch/vbscript hybrid (you need to save it as a batch) .I don't think is possible to do this with simple batch.On windows 8/8.1 might require download of windows media player (the most right column).Some anti-virus programs could warn you about this script. A: I know this question is old, but I wanted to share this: @echo off echo Set oWMP = CreateObject("WMPlayer.OCX.7") >> %temp%\temp.vbs echo Set colCDROMs = oWMP.cdromCollection >> %temp%\temp.vbs echo For i = 0 to colCDROMs.Count-1 >> %temp%\temp.vbs echo colCDROMs.Item(i).Eject >> %temp%\temp.vbs echo next >> %temp%\temp.vbs echo oWMP.close >> %temp%\temp.vbs %temp%\temp.vbs timeout /t 1 del %temp%\temp.vbs just make sure you don't have a file called "temp.vbs" in your Temp folder. This can be executed directly through a cmd, you don't need a batch, but I don't know any command like "eject E:\". Remember that this will eject all CD trays in your system. A: UPDATE: A script that supports also ejection of a usb sticks - ejectjs.bat: ::to eject specific dive by letter call ejectjs.bat G ::to eject all drives that can be ejected call ejectjs.bat * A much better way that does not require windows media player and is not recognized by anti-virus programs (yet) .Must be saves with .bat extension: @cScript.EXE //noLogo "%~f0?.WSF" //job:info %~nx0 %* @exit /b 0 <job id="info"> <script language="VBScript"> if WScript.Arguments.Count < 2 then WScript.Echo "No drive letter passed" WScript.Echo "Usage: " WScript.Echo " " & WScript.Arguments.Item(0) & " {LETTER|*}" WScript.Echo " * will eject all cd drives" WScript.Quit 1 end if driveletter = WScript.Arguments.Item(1): driveletter = mid(driveletter,1,1): Public Function ejectDrive (drvLtr) Set objApp = CreateObject( "Shell.Application" ): Set objF=objApp.NameSpace(&H11&): 'WScript.Echo(objF.Items().Count): set MyComp = objF.Items(): for each item in objF.Items() : iName = objF.GetDetailsOf (item,0): iType = objF.GetDetailsOf (item,1): iLabels = split (iName , "(" ) : iLabel = iLabels(1): if Ucase(drvLtr & ":)") = iLabel and iType = "CD Drive" then set verbs=item.Verbs(): set verb=verbs.Item(verbs.Count-4): verb.DoIt(): item.InvokeVerb replace(verb,"&","") : ejectDrive = 1: exit function: end if next ejectDrive = 2: End Function Public Function ejectAll () Set objApp = CreateObject( "Shell.Application" ): Set objF=objApp.NameSpace(&H11&): 'WScript.Echo(objF.Items().Count): set MyComp = objF.Items(): for each item in objF.Items() : iType = objF.GetDetailsOf (item,1): if iType = "CD Drive" then set verbs=item.Verbs(): set verb=verbs.Item(verbs.Count-4): verb.DoIt(): item.InvokeVerb replace(verb,"&","") : end if next End Function if driveletter = "*" then call ejectAll WScript.Quit 0 end if result = ejectDrive (driveletter): if result = 2 then WScript.Echo "no cd drive found with letter " & driveletter & ":" WScript.Quit 2 end if </script> </job> A: Requiring administrator's rights is too abusing :) I am using wizmo: https://www.grc.com/WIZMO/WIZMO.HTM
unknown
d1448
train
I assume you are looking for something like this... modal windows using prototype A: Use the jQuery to set the display property of the div to none. Add "divNotDisplayed" class when you hide the div. If this class is present then alter the size of other divs. Add "divDisplayed" class when you display the div and once again alter other divs. Udachi
unknown
d1449
train
i think you are doing this on a wrong basis. this sounds to me like an extension of xbase, not only a simple use. import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase Print: {Print} 'print' print=XPrintBlock ; XPrintBlock returns xbase::XBlockExpression: {xbase::XBlockExpression}'{' expressions+=XPrintLine* '}' ; XPrintLine returns xbase::XExpression: {PrintLine} obj=XExpression ; Type Computer class MyDslTypeComputer extends XbaseTypeComputer { def dispatch computeTypes(XPrintLine literal, ITypeComputationState state) { state.withNonVoidExpectation.computeTypes(literal.obj) state.acceptActualType(getPrimitiveVoid(state)) } } Compiler class MyDslXbaseCompiler extends XbaseCompiler { override protected doInternalToJavaStatement(XExpression obj, ITreeAppendable appendable, boolean isReferenced) { if (obj instanceof XPrintLine) { appendable.trace(obj) appendable.append("System.out.println(") internalToJavaExpression(obj.obj,appendable); appendable.append(");") appendable.newLine return } super.doInternalToJavaStatement(obj, appendable, isReferenced) } } XExpressionHelper class MyDslXExpressionHelper extends XExpressionHelper { override hasSideEffects(XExpression expr) { if (expr instanceof XPrintLine || expr.eContainer instanceof XPrintLine) { return true } super.hasSideEffects(expr) } } JvmModelInferrer def dispatch void infer(Print print, IJvmDeclaredTypeAcceptor acceptor, boolean isPreIndexingPhase) { acceptor.accept( print.toClass("a.b.C") [ members+=print.toMethod("demo", Void.TYPE.typeRef) [ body = print.print ] ] ) } Bindings class MyDslRuntimeModule extends AbstractMyDslRuntimeModule { def Class<? extends ITypeComputer> bindITypeComputer() { MyDslTypeComputer } def Class<? extends XbaseCompiler> bindXbaseCompiler() { MyDslXbaseCompiler } def Class<? extends XExpressionHelper> bindXExpressionHelper() { MyDslXExpressionHelper } }
unknown
d1450
train
One example that comes to mind is in a cross-site ajax request, it is easy to send a text/html request which will not generate a pre-flight request, but it is not possible with applictaion/json. So if you have a service with a POST action that expects json and changes server state, it may be possible to exploit CSRF if text/html is accepted for the content type, but there is some basic protection if application/json is verified, because the browser will not send the request from a different domain if the response to the pre-flight does not explicitly allow a CORS post. So some properties of cross-domain ajax requests depend on the content type. I think this may be the main reason. Also from a more theoretical standpoint, the format of the data is needed to parse it. I cannot think of an actual exploit, but at least in theory, trying to parse data in a wrong format may lead to the wrong results, things parsed different from what they were supposed to be. It's best to just validate that the client is actually sending what it claims, and what it should be.
unknown
d1451
train
For Android I'd go with Eclipse see the following for the Android SDK and Eclipse setup * *Android SDK *Eclipse Plugin for Android *Blackberry *Nokia S60 A: Have a look at Mobile Tools for Java. It is based on Eclipse and widely used among developers! You can add a large number of plugins to fulfill your needs if necessary. A: I think there is two main used IDEs for Java. Eclipse and Netbeans. Since for Eclipse there is a better plugin for Android, I would recommend it if you want just use one. A: There was an eclipse for J2ME (eclipse pulsar). But some people prefer NetBeans. For Android, eclipse. This question is not going to live much time, I think XD. Is the kind of 'better' question that gets closed.
unknown
d1452
train
You appear to have an issue with the underlying generated Thrift code. Unless you have a specific reason to do so, using Thrift directly to access Cassandra is not recommended. There are many client libraries available that will abstract this for you. Having said that, I have used the Thrift-generated C# code to write my own library in the past, and have not run into this issue. Perhaps your problem has something to do with your use of VB? If you have some reason to use Thrift directly, you might try the same code in C# to see if that resolves the issue. If not, make sure you have the right versions of Cassandra and Thrift, as incompatibilities there can cause issues such as this.
unknown
d1453
train
Set the JAVA_HOME path and update JDK version. After that restart your server and it should work just fine! If this doesn't work, check how many instances of tomcat you have. If you have more than one, shut them down. It can also be a problem with the @Transactional annotation if you're using it wrong, you can see more details here- >http://www.javablog.fr/spring-transaction-visibility-proxy-propagation-required-and-requires_new.html
unknown
d1454
train
I have checked your class name coreSpriteRightPaginationArrow and i couldn't find any element with that exact class name. But I saw the class name partially. So it might help if you try with XPath contains as shown below. //div[contains(@class,'coreSpriteRight')] another xpath using class wpO6b. there are 10 elements with same class name so filtered using @aria-label='Next' //button[@class='wpO6b ']//*[@aria-label='Next'] Try these and let me know if it works. I have tried below code and it's clicking next button for 10 times import time from selenium import webdriver from selenium.webdriver.common.by import By if __name__ == '__main__': driver = webdriver.Chrome('/Users/yosuvaarulanthu/node_modules/chromedriver/lib/chromedriver/chromedriver') # Optional argument, if not specified will search path. driver.maximize_window() driver.implicitly_wait(15) driver.get("https://www.instagram.com/instagram/"); time.sleep(2) driver.find_element(By.XPATH,"//button[text()='Accept All']").click(); time.sleep(2) #driver.find_element(By.XPATH,"//button[text()='Log in']").click(); driver.find_element(By.NAME,"username").send_keys('username') driver.find_element(By.NAME,"password").send_keys('password') driver.find_element(By.XPATH,"//div[text()='Log In']").click(); driver.find_element(By.XPATH,"//button[text()='Not now']").click(); driver.find_element(By.XPATH,"//button[text()='Not Now']").click(); #it open Instagram page and clicks 1st post and then it will click next post button for the specified range driver.get("https://www.instagram.com/instagram/"); driver.find_element(By.XPATH,"//div[@class='v1Nh3 kIKUG _bz0w']").click(); for page in range(1,10): driver.find_element(By.XPATH,"//button[@class='wpO6b ']//*[@aria-label='Next']" ).click(); time.sleep(2) driver.quit() A: As you can see on the picture below, the wp06b button is inside a lot of divs, in that case you might need to give Selenium that same path of divs to be able to access the button or give it a XPath. It's not the most optimized but should work fine. driver.find_element(By.XPATH("(.//*[normalize-space(text()) and normalize-space(.)='© 2022 Instagram from Meta'])[1]/following::*[name()='svg'][2]")).click() Note that the XPath leads to a svg, so basically we are clicking on the svg element itself, not in the button. A: As you can see, the next post right arrow button element locator is changing between the first post to other posts next page button. In case of the first post you should use this locator: //div[contains(@class,'coreSpriteRight')] While for all the other posts you should use this locator //a[contains(@class,'coreSpriteRight')] The second element //a[contains(@class,'coreSpriteRight')] will also present on the first post page as well, however this element is not clickable there, it is enabled and can be clicked on non-first pages only.
unknown
d1455
train
I solved this by taking param routes in my order-details.component.ts and then a create function getOrder(id) in order service. When you have id of your order it's quite simple to take object from database.
unknown
d1456
train
A handle of my Activity in the Adapter and the runQuery call in the filter makes a call to startManagingCursor on the Activity whenever the runQuery is called. This is not ideal because a background thread is calling startManagingCursor and also there could be a lot of cursors remaining open until the Activity is destroyed. I added the following to my Adapter which has a handle on the Activity it is used within @Override public void changeCursor(Cursor newCursor) { Cursor oldCursor = getCursor(); super.changeCursor(newCursor); if(oldCursor != null && oldCursor != newCursor) { // adapter has already dealt with closing the cursor activity.stopManagingCursor(oldCursor); } activity.startManagingCursor(newCursor); } This makes sure that the current cursor used by the adapter is also managed by the activity. When the cursor is closed by the adapter management by the activity is removed. The last cursor held by the adapter will be closed by the activity by way of it still be managed by the activity.
unknown
d1457
train
you probably need to save or download images into your android project folder and should access the images. refer this for reference
unknown
d1458
train
It's easier than you think. for (int i = 0; i < numOfAgents; i++) encryptArr[i] = agentArr[i]; Each value in the array is something that meets all requirements of an "object", and can be copied/moved as a whole. No need to bother copying each member of the struct. A: You should use std::string instead of char arrays. It is assignable and there are more merits including almost unlimited length of string. struct Agent { std::string name; int idNum; double years; std::string location; }; If you are unfortunately forced to use arrays for some reason, you will have to assign each elements. If it is guaranteed that the contents of the arrays will always be strings (sequences of characters terminated by null-character), you can use strcpy() to copy them. (I will show only code for name, but location should also be treated like this) strcpy(encryptArr[i].name, agentArr[i].name); If you cannot guarantee this, you should use memmove() (because memcpy() is banned here). memmove(encryptArr[i].name, agentArr[i].name, sizeof(encryptArr[i].name)); If memmove() is also unfortunately banned, the last option will be assigning the elements one-by-one. for (int j = 0; j < C_STRING_SIZE; j++) { encrypyArr[i].name[j] = agentArr[i].name[j]; }
unknown
d1459
train
Figured it out. I was missing RewriteBase /.
unknown
d1460
train
You can use Azure Application Gateway. https://learn.microsoft.com/en-gb/azure/application-gateway/features#rewrite-http-headers
unknown
d1461
train
Node JS NPM modules installed but command not recognized This was the answer I was looking for.. I had the end of my path set to npm/fly and not just npm....
unknown
d1462
train
You need to give your text inputs ids, then reference the id of them and get their text using .text. self.root in the TestApp class refers to the root widget of your kv file, which is the one that doesn't have brackets (< >) around it, in this case the GridLayout. main.py from kivy.app import App class MainApp(App): def get_text_inputs(self): my_list = [self.root.ids.first_input_id.text, self.root.ids.second_input_id.text] print(my_list) pass MainApp().run() main.kv GridLayout: cols: 1 TextInput: id: first_input_id TextInput: id: second_input_id Button: text: "Get the inputs" on_release: app.get_text_inputs() A: Py file * *Use a for loop to traverse through a container of all widgets e.g. TextInput. Snippets for child in reversed(self.container.children): if isinstance(child, TextInput): self.data_list.append(child.text) kv file * *Use a container e.g. GridLayout *Add an id for the container *Add all those Label and TextInput widgets as child of GridLayout Snippets GridLayout: id: container cols: 2 Label: text: "Last Name:" TextInput: id: last_name Example main.py from kivy.app import App from kivy.uix.screenmanager import Screen from kivy.uix.textinput import TextInput from kivy.properties import ObjectProperty, ListProperty from kivy.lang import Builder Builder.load_file('main.kv') class MyScreen(Screen): container = ObjectProperty(None) data_list = ListProperty([]) def save_data(self): for child in reversed(self.container.children): if isinstance(child, TextInput): self.data_list.append(child.text) print(self.data_list) class TestApp(App): def build(self): return MyScreen() if __name__ == "__main__": TestApp().run() main.kv #:kivy 1.11.0 <MyScreen>: container: container BoxLayout: orientation: 'vertical' GridLayout: id: container cols: 2 row_force_default: True row_default_height: 30 col_force_default: True col_default_width: dp(100) Label: text: "Last Name:" TextInput: id: last_name Label: text: "First Name:" TextInput: id: first_name Label: text: "Age:" TextInput: id: age Label: text: "City:" TextInput: id: city Label: text: "Country:" TextInput: id: country Button: text: "Save Data" size_hint_y: None height: '48dp' on_release: root.save_data() Output
unknown
d1463
train
clickable is set to false. You have to set it true in xml file and later on handle onClick event in your activity class A: image only you need to handle onclick listener in Android java file where you make reference the text of your xml like TextView mytext=(TextView)findviewbyid(R.id.ref of your TextView); mytext.setOnClickList();
unknown
d1464
train
MSBuildWorkspace just doesn't support propagating project references back to the project files when you call TryApplyChanges. I see you've filed the bug on CodePlex, but until that gets fixed (we're open source -- you can fix it too!) there's no workaround. If you only need to analyze the world as if that project reference exists, then you don't need to call that and can just use the Solution object you're trying to apply. If your goal is just to edit project files, another option is to use the MSBuild or XML APIs of your choice to directly manipulate the project files.
unknown
d1465
train
I fixed the scroll up issue using the following code : private RecyclerView.OnScrollListener scrollListener = new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { LinearLayoutManager manager = ((LinearLayoutManager)recyclerView.getLayoutManager()); boolean enabled =manager.findFirstCompletelyVisibleItemPosition() == 0; pullToRefreshLayout.setEnabled(enabled); } }; Then you need to use setOnScrollListener or addOnScrollListener depending if you have one or more listeners. A: Unfortunately, this is a known issue and will be fixed in a future release. https://code.google.com/p/android/issues/detail?id=78191 Meanwhile, if you need urgent fix, override canChildScrollUp in SwipeRefreshLayout.java and call recyclerView.canScrollVertically(mTarget, -1). Because canScrollVertically was added after gingerbread, you'll also need to copy that method and implement in recyclerview. Alternatively, if you are using LinearLayoutManager, you can call findFirstCompletelyVisibleItemPosition. Sorry for the inconvenience. A: You can disable/enable the refresh layout based on recyclerview's scroll ability public class RecyclerSwipeRefreshHelper extends RecyclerView.OnScrollListener{ private static final int DIRECTION_UP = -1; private final SwipeRefreshLayout refreshLayout; public RecyclerSwipeRefreshHelper( SwipeRefreshLayout refreshLayout) { this.refreshLayout = refreshLayout; } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); refreshLayout.setEnabled((recyclerView.canScrollVertically(DIRECTION_UP))); } } A: override RecyclerView's method OnScrollStateChanged mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { // TODO Auto-generated method stub //super.onScrollStateChanged(recyclerView, newState); try { int firstPos = mLayoutManager.findFirstCompletelyVisibleItemPosition(); if (firstPos > 0) { mSwipeRefreshLayout.setEnabled(false); } else { mSwipeRefreshLayout.setEnabled(true); if(mRecyclerView.getScrollState() == 1) if(mSwipeRefreshLayout.isRefreshing()) mRecyclerView.stopScroll(); } }catch(Exception e) { Log.e(TAG, "Scroll Error : "+e.getLocalizedMessage()); } } Check if Swipe Refresh is Refreshing and try to Scroll up then you got error, so when swipe refresh is going on and i try do this mRecyclerView.stopScroll(); A: You can override the method canChildScrollUp() in SwipeRefreshLayout like this: public boolean canChildScrollUp() { if (mTarget instanceof RecyclerView) { final RecyclerView recyclerView = (RecyclerView) mTarget; RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { int position = ((LinearLayoutManager) layoutManager).findFirstCompletelyVisibleItemPosition(); return position != 0; } else if (layoutManager instanceof StaggeredGridLayoutManager) { int[] positions = ((StaggeredGridLayoutManager) layoutManager).findFirstCompletelyVisibleItemPositions(null); for (int i = 0; i < positions.length; i++) { if (positions[i] == 0) { return false; } } } return true; } else if (android.os.Build.VERSION.SDK_INT < 14) { if (mTarget instanceof AbsListView) { final AbsListView absListView = (AbsListView) mTarget; return absListView.getChildCount() > 0 && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0) .getTop() < absListView.getPaddingTop()); } else { return mTarget.getScrollY() > 0; } } else { return ViewCompat.canScrollVertically(mTarget, -1); } } A: Following code is working for me, please ensure that it is placed below the binding.refreshDiscoverList.setOnRefreshListener{} method. binding.swipeToRefreshLayout.setOnChildScrollUpCallback(object : SwipeRefreshLayout.OnChildScrollUpCallback { override fun canChildScrollUp(parent: SwipeRefreshLayout, child: View?): Boolean { if (binding.rvDiscover != null) { return binding.recyclerView.canScrollVertically(-1) } return false } }) A: Based on @wrecker answer (https://stackoverflow.com/a/32318447/7508302). In Kotlin we can use extension method. So: class RecyclerViewSwipeToRefresh(private val refreshLayout: SwipeToRefreshLayout) : RecyclerView.OnScrollListener() { companion object { private const val DIRECTION_UP = -1 } override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { super.onScrolled(recyclerView, dx, dy) refreshLayout.isEnabled = !(recyclerView?.canScrollVertically(DIRECTION_UP) ?: return) } } And let's add extension method to RecyclerView to easly apply this fix to RV. fun RecyclerView.fixSwipeToRefresh(refreshLayout: SwipeRefreshLayout): RecyclerViewSwipeToRefresh { return RecyclerViewSwipeToRefresh(refreshLayout).also { this.addOnScrollListener(it) } } Now, we can fix recyclerView using: recycler_view.apply { ... fixSwipeToRefresh(swipe_container) ... }
unknown
d1466
train
In order to achieve this, you need to read details from client side using hidden field. This hiddenfield value can be set at server side. For example: create hidden field on page <asp:HiddenField id="hdnDate" runat="server" /> set date string in hiddenField : protected void button_Clicked (...) { DateTime dt = DateTime.Now; hdnDate.Value = dt.Year.ToString() + "," + (dt.Month - 1 ).ToString() + "," + dt.Day.ToString(); } now, on document.ready of jquery event, do this $(document).ready(function() { $("#dateTextBox").datepicker({ changeMonth: true, changeYear: true }); dtString = $("#<%=hdnDate.ClientID%>").val(); dtString = dtString.split(','); var defaultDate = new Date(dtString[0], dtString[1], dtString[2]); $("#dateTextBox").datepicker("setDate",defaultDate); }); A: Try this: dateTextBox.Value = DateTime.Now.ToString("yyyy-MM-dd");
unknown
d1467
train
You could have something like this int result = 0; int totalStars = 0; int[] starCounts = new int[NumberOfRegions}; ... currentRegion = 42; result = play(currentRegion); if(result > starCounts[currentRegion]){ totalStars += result - starCounts[currentRegion]; starCounts[currentRegion] = result; } This is just an example of what you could do. There are obvious scalability issues with this (what happens when you want to add new regions, etc), but you get the gist.
unknown
d1468
train
You can either populate the documents in the index via code or use an indexer that can create your documents. Here is the Indexer data source drop down showing the different data sources available. You could put the information about the image and a path to the image in any of these data sources and have an indexer pick it up and create your documents within the index. If you don't want to use a formal database, you could also upload your images into blob storage and decorate each blob with custom metadata. When creating your index with an indexer, it will find the custom metadata and it can become fields on documents within your index. There are lots of options, but my advice is to keep your documents within your index as small as possible to control your costs. That's usually done by having as few a fields as possible and have fields that reference where the stuff is located. The documents within an index are for discovering where things are located and NOT for storing the actual data. When you index start occupying lots of space, your cost will go up a LOT.
unknown
d1469
train
Don't use absolute URL e.g. https://bingoke.com/?queueId=..., but relative URL instead e.g. /?queueId=..., so browser will use current protocol/domain automatically.
unknown
d1470
train
To change the font size (decrease), you need to change the RecLineChars property. Only the values contained in the RecLineCharsList property can be specified for the RecLineChars property. It cannot normally be specified in the middle of a PrintNormal print request string. It may be possible to support it as a vendor-specific feature, but even in that case, it is only possible to change line units, and it is not possible to change only the middle of a line.
unknown
d1471
train
I think you want SELECT IF(@size == 'SMALL', PRICE_SMALL_PRICE, PRICE_LARGE_PRICE) AS ITEM_PRICE FROM prices; A: Following may work. SET @Size = 'SMALL'; SELECT PRICE_LARGE_PRICE, PRICE_SMALL_PRICE, CASE WHEN @Size = 'REGULAR' THEN PRICE_LARGE_PRICE WHEN @Size = 'SMALL' THEN PRICE_SMALL_PRICE END AS ITEM_PRICE INTO @PRICE_LARGE_PRICE, @PRICE_SMALL_PRICE, @ITEM_PRICE FROM prices WHERE PRICE_LISTING_ID = 60;
unknown
d1472
train
If you have a limited number of threads, I would have a connection per thread. A connection pool is more efficient if the number of threads which could use a connection is too high and those thread use the connections a relatively low percentage of the time.
unknown
d1473
train
Your path is incorrect because you didn't escape \ in it. The fastest way to do it is using @: string fil1 = @"C:\Users\mariu\Desktop\Jobboppgave\CaseConsoleApp\Prisfile.txt"; Rebuild your project and problem will be resolved.
unknown
d1474
train
It shows you get a ClassCastException in your Commander class at line #132. Please post the onCreate method of your Commander class or look into TextView casts in onCreate method. A: Here is the solution what worked for me : - In eclipse, right click on the project-> properties -> Java Build Path -> Order and Export Check the SOMA jar file in the path and try now ! A: I copied the Smaato jar into the libs/ directory; that seemed to help.
unknown
d1475
train
If I understand correctly, you're asking where to perform redirection after a user logs in, but not in the technical sense of how to do it but in an architectural sense of where is the right place to do it. Let's go over the options you have: * *Redirect in the effect - This is your first option, redirecting in the effect before or after dispatching a success action to the reducer. *Redirecting from the service - You can also redirect after the service for example like this: myService(): void { return this.http.get(url).pipe( tap(() => this.router.navigate([navigationURL])) ) } *Other options - other options are possible, in your question you asked if there's something that allows to listen to actions, well that's pretty much what effects are for, to listen to actions, but you could also listen to Observable emittions with subscribe, and redirect when that happens, I DO NOT recommend that approach. I think that adding subscriptions is adding unnecessary complexity to the project, because subscriptions have to be managed. So what to do? Honestly, this is up to you, both options seems valid and I wouldn't say either is a bad practice. I personally prefer to keep my effects clean and do it in the service. I feel like the service is better suited to handle side effects, and it makes it a bit cleaner also when testing, but this is my personal opinion. The important thing to remember is, both options are valid and don't add unnecessary complexity. There's also one small case which might apply to you, if you need that the user will be in the store before redirecting, it might be better to put this in the effects after dispatching an actions to the reducer. If you're working with Observables it will work either way, but it might be easier to understand if they have tight relationship.
unknown
d1476
train
They are pretty much the same. There shouldn't be any big difference when it comes to performance and time: Measure-Command { Get-Process | ConvertTo-Csv | Set-Content -Path .\Process.txt } Days : 0 Hours : 0 Minutes : 0 Seconds : 2 Milliseconds : 880 Ticks : 28801761 TotalDays : 3,33353715277778E-05 TotalHours : 0,000800048916666667 TotalMinutes : 0,048002935 TotalSeconds : 2,8801761 TotalMilliseconds : 2880,1761 Measure-Command { Get-Process | Export-Csv -Path .\Process2.txt } Days : 0 Hours : 0 Minutes : 0 Seconds : 2 Milliseconds : 772 Ticks : 27724661 TotalDays : 3,20887280092593E-05 TotalHours : 0,000770129472222222 TotalMinutes : 0,0462077683333333 TotalSeconds : 2,7724661 TotalMilliseconds : 2772,4661 This is because Export-CSV and ConvertTo-CSV run 90% of the same code. They share the same helper-class Microsoft.PowerShell.Commands.ExportCsvHelper to create the header and convert objects to csv. The only difference is that ConvertTo-CSV writes the CSV-object(string) to the pipeline using WriteObject(), while Export-CSV directly writes it to a file using a StreamWriter. To find this yourself, you could look inside Microsoft.PowerShell.Commands.Utility.dll. I won't be posting the code directly because I'm not sure if it's legal or not. :-) If you need the CSV-output to be displayed or sent through a third-party API etc., then use ConvertTo-CSV. If you need the data stored in a CSV-file, then you should use Export-CSV.
unknown
d1477
train
You defined the class SynthVoice in the header SynthVoice.H class SynthVoice : public juce::SynthesiserVoice { //... }; and then redefined it in the file SynthVoice.cpp with member function definitions class SynthVoice : public juce::SynthesiserVoice { //... }; If you want to define member functions declared in the class defined in the header then what you need is to write for example bool SynthVoice::canPlaySound(juce::SynthesiserSound* sound) { return dynamic_cast <SynthSound*>(sound) != nullptr; } outside the class definition. Here is a simple program that demonstrates how member functions are defined outside a class where they are declared. #include <iostream> class A { private: int x; public: A( int ); const int & get_x() const ; void set_x( int ); }; A::A( int x ) : x( x ) {} const int & A::get_x() const { return x; } void A::set_x( int x ) { A::x = x; } int main() { A a( 10 ); std::cout << a.get_x() << '\n'; return 0; } The program output is 10
unknown
d1478
train
Qualify all your column names. You seem to know this, because all other column names are qualified. I'm not sure if your logic is correct, but you can fix the error by qualifying the column name: SELECT . . . (CASE WHEN n.id IN (SELECT u.id as id FROM friends f CROSS JOIN users u WHERE CASE WHEN f.following_id=1 THEN f.follower_id = u.id WHEN f.follower_id=1 THEN f.following_id = u.id END ) AND f.status= 2 THEN 'Yes' ELSE 'No' END) as isFriend . . . A: This is the way I will go for your approach: 1) I used INNER JOIN instead of LEFT JOIN for skip users that are not related to tags: Programming and Php. 2) I replaced the logic to find the set of friends related to user with id equal to 1. SELECT n.id, n.firstName, n.lastName, t.id, t.tag, t.user_id, IF( n.id IN (SELECT follower_id FROM friends WHERE status = 2 AND following_id = 1 UNION SELECT following_id FROM friends WHERE status = 2 AND follower_id = 1), "Yes", "No" ) AS isFriend FROM users n INNER JOIN userinterests t ON n.id = t.id AND t.tag IN ('Programming', 'Php') Just curious, whats is the meaning of status = 2 ?
unknown
d1479
train
num = [[0,5], [1,5], [3,7]] isn't working? A: There is a lot of ways to resolve your issue. You're looking for an array of arrays. I think you're confused by how an array can be inside an array. You should keep in mind that an array is just an ordered list of objects. So storing in array in each index is not as foreign as a concept as it may seem. A = [] #an empty array A[0] = [1, 2] A[1] = 1 A # => [[1,2], 1] If you want to initialize an array with a default value as an array try A = Array.new(2) {Array.new(2){0}} #This creates an array of size 2 with default values of arrays of size 2 with 0 in each entry. A[0][1] # returns 0 A[0] # returns [0, 0] A #returns [[0,0], [0,0]]
unknown
d1480
train
In menu bar, you can select "Window" -> "Show View", and then select "Project Explorer" (or other components you want to open). A: Do you mean the package explorer ? You can toggle it here A: I guess the bar on the left which OP is searching for is Package Explorer. And it can be found at Windows > Show View > Package Explorer Refer the image below. A: You might be in the Debug option. Click on Java instead. It is on the top right. If you reset Perspective, it won't show you the Navigator. A: Try going Window > Reset Perspective to go to the default view which should contain the project explorer A: are you referring to the package explorer view? Window -> show view -> package explorer A: If you're missing the Package Explorer, just go to "Window" -> "Show View" and click "Package Explorer" A: It is known as Navigator, You can find it in Window -> Show View -> Navigator.
unknown
d1481
train
In your viewDidLoad if _toggle = 2; frame = CGRectMake(924.0f, 59.0f, audioToggle.frame.size.width, audioToggle.frame.size.height) and if _toggle = 1; frame = CGRectMake(985.0f, 59.0f, audioToggle.frame.size.width, audioToggle.frame.size.height) But in your buttonAction it is different. Interchange in viewDidLoad if buttonAction is correct. A: I suspect Anusha got it. But I also suspect you would easily have found it yourself if you'd chosen a slightly different style. The toggle is either on or off, in other words a perfect match for a boolean. If you had a BOOL named swicthedOn you'd have checks reading if (switchedOn) which would improve readability a lot. Something like this perhaps: - (IBAction)theSwitch:(id)sender { // Not using the sender for anything (?) NSUserDefaults *toggle = [NSUserDefaults standardUserDefaults]; BOOL audioOn = NO; float toggleX = 924.0f; if (_switchIsOn) { toggleX = 985.0f; audioOn = NO; // not strictly necessary but improves readability } else { toggleX = 924.0f; // not strictly necessary but improves readability audioOn = YES; } _switchIsOn = audioOn; [UIView animateWithDuration:0.3 animations:^{ audioToggle.frame = CGRectMake(toggleX, 59.0f, audioToggle.frame.size.width, audioToggle.frame.size.height); }]; [toggle setBool:_switchIsOn forKey:@"toggleState"]; [toggle synchronize]; [[NSUserDefaults standardUserDefaults] setBool:audioOn forKey:@"audioOn"]; // Not being synchronized } Yes, I refactored it (and probably introduced a couple of new bugs). Sorry, couldn't help myself...
unknown
d1482
train
try to change minSdkVersion 16 to minSdkVersion 21 A: I solved this issue My getting Some additional Permissions. MANAGE_EXTERNAL_STORAGE and INTERNET Permission in Android Manifest File
unknown
d1483
train
You want a function that takes a PipelineConfiguration and returns another function that takes an RDDLabeledPoint and returns an RDDLabeledPoint. * *What is the domain? PipelineConfiguration. *What is the return type? A "function that takes RDDLP and returns RDDLP", that is: (RDDLabeledPoint => RDDLabeledPoint). All together: type FTDataReductionProcess = (PipelineConfiguration => (RDDLabeledPoint => RDDLabeledPoint)) Since => is right-associative, you can also write: type FTDataReductionProcess = PipelineConfiguration => RDDLabeledPoint => RDDLabeledPoint By the way: the same works for function literals too, which gives a nice concise syntax. Here is a shorter example to demonstrate the point: scala> type Foo = Int => Int => Double // curried function type defined type alias Foo scala> val f: Foo = x => y => x.toDouble / y // function literal f: Foo = $$Lambda$1065/1442768482@54089484 scala> f(5)(7) // applying curried function to two parameters res0: Double = 0.7142857142857143
unknown
d1484
train
Your cart should be clearing after checkout so something else may be wrong. You could create a function with empty_cart() in it that is triggered when payment is complete "just in case". See: http://docs.woothemes.com/wc-apidocs/class-WC_Cart.html add_filter( 'woocommerce_payment_complete_order_status', 'pg_woocommerce_payment_complete_order_status', 10, 2 ); function pg_woocommerce_payment_complete_order_status ( $order_status, $order_id ) { $global $woocommerce; $woocommerce->cart->empty_cart(); } A: You can user this hook : function custom_empty_cart( $order_id, $data ) { // delete current cart item here } add_action( 'woocommerce_checkout_order_processed', 'custom_empty_cart', 11, 2 ); Or you can check woocommerce hook list from here. A: The cart should empty as this feature is standard, empty_cart(); Are you using any cache-plugins? In that case you need to exclude the cart page http://docs.woothemes.com/document/configuring-caching-plugins/ It could also be a problem with the payment-gateway, make sure you have updated to the latest version. A: i found a similar question but it clears the cart on the click of a button.. http://wordpress.org/support/topic/add-an-empty-cart-button-to-cart-page seems to have worked for some user.. here is the code , it should go in to the function.php file add_action('init', 'woocommerce_clear_cart_url'); function woocommerce_clear_cart_url() { global $woocommerce; if( isset($_REQUEST['clear-cart']) ) { $woocommerce->cart->empty_cart(); } } this is the code for the button <input type="submit" class="button" name="clear-cart" value="<?php _e('Empty Cart', 'woocommerce'); ?>" /> im guessing u dont need a button, so in the next page when u want the cart to be empty, u can explicitly call this function _e('Empty Cart', 'woocommerce'); for example if it you would like to clear the cart in a post page whose title is Payment Success if(is_single('Payment Success')) _e('Empty Cart', 'woocommerce'); or if its slug is payment-success is_single('payment-success'); _e('Empty Cart', 'woocommerce'); similarly to check if its homepage you can use is_front_page(); or if its on the wordpress page u can use this if(is_page( 'Payment Success' )) _e('Empty Cart', 'woocommerce'); if(is_page( 'payment-success' )) _e('Empty Cart', 'woocommerce'); you can include the above code in the head section of your wordpress site!! Hope this helps
unknown
d1485
train
I dont know if there is any direct system call that gives you memory details, but if you are on linux you can read and parse /proc/(pid of your process)/status file to get the needed memory usage counts
unknown
d1486
train
Compatibility is an administrative function, not a development or deployment function. It is better to fix the application where possible, especially to remove any requirement for elevation. There are plenty of tools for investigating the issues so you can correct them. However globally registering "plug ins" at runtime is a nasty one. VB6 component self-registration is always global unless registry virtualization can redirect it. Why not create installers for the plug-ins that can run elevated once during installation? There are ways to set compatibility less manually, even as part of installation - though Microsoft discourages this. Maybe take a look at: Compatibility Fix Database Management Strategies and Deployment However the effort required might be better spent on remediating the problem. Support costs will be less over time. A: As the other answers have said, you shouldn't need to run all the time elevated. If you want to register the plugins after its started (as a normal user), you can use ShellExecute() with the "runas" verb to run regsvr32.exe, or use COM elevation which has been discussed many times before. A: You can indicate that an application must run as admin by specifying it in the Application Manifest, which in an xml file that you can either embed or deploy with your application. Once your application is running with admin rights it should be able to register and load the plugins. You should not need to run in compatibility mode to access the COM plugins.
unknown
d1487
train
You can use two Grid or GroupBox (or other container type) controls and put appropriate set of controls in each of them. This way you can just visibility of panels to hide the whole set of controls instead of hiding each control directly. It may sometimes be appropriate to create a user control for each set of controls. However, this can depend on a specific case.
unknown
d1488
train
Your question is a bit unclear, and you might want to provide more detail, but I suspect that you want only one foreign key property on your class two. Depending on how you're creating these objects, this may also be happening because you're trying to reference an id that's 0, because the object has not yet been saved to the database, so it has not been assigned an id. A: If you are trying to have 1 to 0 or 1 relationship between class one and class two then you need to have primary key and foriegn key same in class 2 and it should be primary key of class one Class One { ID (PK), Property 2; } Class Two { One_ID (PK, FK), Nullable_One_ID (FK) }
unknown
d1489
train
The answer is in this snippet: var aData = request.responseXML... You're expecting XML. An & by itself is not legal XML. You need to output your result like this: SUPPORT ASSY-FUEL TANK MOUNTING, R&amp;R (LH) (L-ENG) A: It's very difficult to tell without seeing your output script, but the first thing to try is to mask the ampersand: &amp; The neater way, though, would be to add CDATA to your XML output: <data><![CDATA[SUPPORT ASSY-FUEL TANK MOUNTING, R&R (LH) (L-ENG)]]></data> your XML parser on client side should understand it no problem. A: You escape the ampersand by using the HTML eqv. &amp; A: If you are unable to alter the XML output from the server (it's not your app or some other issue), a "hack" fix would be: function htmlizeAmps(s){ return s.replace(/\x26/g,"&amp;"); //globalreplace "&" (hex 26) with "&amp;" } document.getElementById('tempLabourLineDescription').value = htmlizeAmps(sDescription);
unknown
d1490
train
Have you made sure that you are precompiling all of your assets? Try using: bundle exec rake assets:precompile
unknown
d1491
train
The boolean flag solution is fragile as it is not guaranteed that updates will be visible across different threads. To fix this problem you may declare it as volatile, but if you set the boolean flag you don't interrupt the sleep call like in first version. Thus using interrupts is preferred. I see no reason to declare Thread tn as static. You may use: public class GetInfo implements Runnable { private final Thread tn; private GetInfo() { this.tn = new Thread(this); this.tn.start(); } public static GetInfo StartPointerInfo() { GetInfo info = new GetInfo(); System.out.println("After start1"); return info; } public void StopPointerInfo() { tn.interrupt(); } ... } And use it like this: GetInfo infoWorker = GetInfo.StartPointerInfo(); ... infoWorker.StopPointerInfo(); A: You don't need to use a static Thread. Within the run() method, you need to test whether the current thread has been interrupted. You don't need access to tn for that. You can do this like this: Thread.currentThread().isInterrupted(); or Thread.interrupted(); (Note that the behavior of these two are different. One clears the interrupt flag and the other doesn't.) Alternatively, you could just change the static field to an instance field, and make all of the GetInfo methods instance methods. That means you can instantiate multiple instances of GetInfo which each create their own Thread and hold the reference in the instance field. Two more points: * *The way that you are creating and then disposing of threads is rather inefficient. (Starting a thread is expensive.) A better way is to restructure the code so that it can use a thread pool. *Calling your methods StartPointerInfo and StopPointerInfo is BAD STYLE. Java method names should always start with a lowercase letter.
unknown
d1492
train
The problem lies in the getGenericTextView() method of the sample code: // Set the text starting position textView.setPadding(36, 0, 0, 0); setPadding(...) sets the padding (intrinsic space) in pixels, meaning the result of this indenting approach will differ per device. You seem to be using an hdpi device with a relatively large horizontal screen resolution, resulting in visually too little space on the lefthand side of the TextView. For some more explanation on this issue, please read the documentation here. That being said, you can easily overcome the problem by setting a density independent pixel (d(i)p) value, such that the visually indented space will be identical across different resolutions. You can use the TypedValue utility class for this: int dips = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, getResources().getDisplayMetrics()); Alternatively you could inflate a TextView from xml, on which you can set the density independent properties at design time, in stead of doing it on the fly at runtime.
unknown
d1493
train
How about: <?php $alphas = range('a', 'z'); $alphacount = count($alphas); $a = 0; for ($i=0;$i<$alphacount;$i++) { $first = $alphas[$a]; $second = $alphas[$i]; if ($i >= $alphacount && $a < $alphaminus ) { $i = 0; $a ++; } echo "$first$second<br>"; } So you don't have to to -1 since you don't like it! :) And how about: $alphas = range('a', 'z'); for ($i = 0; $i < count($alphas); $i++) { for ($a = 0; $a < count($alphas); $a++) { echo "{$alphas[$i]}{$alphas[$a]}\n"; } } Or forget about arrays! This is more fun :) array_walk($alphas, function ($a) use ($alphas) { array_walk($alphas, function ($b) use ($a) { print "$a$b\n"; }); }); A: The problem is that you reset $i to 0 in the loop; then on encountering the end of the loop $i is incremented, so the next run in the loop will be with $i = 1 instead of $i = 0. That is, the next subrange of letters starts with (letter)b instead of (letter)a. (See your output: the next line after az is bb rather than ba.) Solution: reset $i to -1 in the loop, then at the end it will run with the value 0 again. A: You have 26 characters, but arrays in PHP are indexed from 0. So, indexes are 0, 1, ... 25. A: count is 1-based and arrays created by range() are 0-based. It means that: $alphas[0] == a $alphas[25] == z $count($alphas) = 26; // there are 26 elements. First element is $alphas[0] A: Why does it have to be so complicated? You could simply do foreach ($alphas as $alpha) { foreach($alphas as $alpha2) { echo $alpha.$alpha2."<br>"; } } Note: It is mostly not a good idea to manipulate the loop counter variable inside the body of that very loop. You set $i to 0 on a certain condition. That could give you unexpected results, hence the reason why you have to navigate around it.
unknown
d1494
train
First, I'll assume you're using some kind of List - likely an ArrayList. That said, the main operations for Bubble Sort are described as follows: * *Compare for ordering *Create temporary variable *Place left value into temporary variable *Place right value into left value *Place old left value into right value from temporary value You're shuffling about the fields, which will lead to confusion and bugs. Use the above approach instead. Here it is illustrated with generics (so you don't have to cast anymore), and a capital class name, as is the convention. I don't have a temporary variable in this example, as I already have a reference to current. List<ShowInfo> show = new ArrayList<>(); // assume populated public static void sortDay(){ for(int i = 0; i < show.size(); i++) { for(int j = 0; j < show.size() && j != i; j++) { ShowInfo current = show.get(i); ShowInfo next = show.get(j); // If the current day is greater than the next day, we need to swap. // Adjust to suit your business logic (if current is less than next). if (current.day.compareTo(next.day) > 0) { show.set(i, next); show.set(j, current); } } } } A: For a generic way of doing this, perhaps you could try something like: public static <T extends Comparable> void sort(final List<T> list){ boolean remaining; do{ remaining = false; for(int i = 0; i < list.size()-1; i++){ final T current = list.get(i); final T next = list.get(i+1); if(current.compareTo(next) < 0){ list.set(i, next); list.set(i+1, current); remaining = true; } } }while(remaining); } A: How do you fix it? I'm just answering your question: how to fix the code you posted. For "how to improve it?" all other answers are way better than whatever I can come up with. There are two points: * *swap on the same index, in the inner for (index j) *correct swapping: where you have j write j+1 and where you have i write j *the other for is just so it will iterate enough times to get it sorted in the worst case (suggestions in other answers go for a while, much better) That being said, the swapping pseudocode is: if (show[j] < show[j+1]) { temp = j+1 j+1 = j j = temp } And here is the swapping code with the fixes: if (current.day.compareTo(next.day) < 0) { showInfo temp = new showInfo(); temp.name = ((showInfo)show.get(j+1)).name; temp.day = ((showInfo)show.get(j+1)).day; temp.time = ((showInfo)show.get(j+1)).time; ((showInfo)show.get(j+1)).time = ((showInfo)show.get(j)).time; ((showInfo)show.get(j+1)).day = ((showInfo)show.get(j)).day; ((showInfo)show.get(j+1)).name = ((showInfo)show.get(j)).name; ((showInfo)show.get(j)).time = temp.time; ((showInfo)show.get(j)).day = temp.day; ((showInfo)show.get(j)).name = temp.name; } And here is the printed result (assuming day - time - name for each show, so we are sorting on the first int): Show Information before sort 610 - -72 - 1402 838 - -184 - 1096 -478 - 248 - 934 709 - 832 - -590 2007 - 954 - -315 Show Information after sort 2007 - 954 - -315 838 - -184 - 1096 709 - 832 - -590 610 - -72 - 1402 -478 - 248 - 934 A: public class myBubbleSort { private static int[] a; public static void main(String[] args) { getArray(10); System.out.println("Array before sorting"); printArray(); ascendingBubble(); System.out.println("Array after ascending sort"); printArray(); descendingBubble(); System.out.println("Array after descending sort"); printArray(); System.out.println(); System.out.println("Random sort"); getArray(10); bubbleSort(true); System.out.println("Array after Random sort"); printArray(); } // print the number in random array public static void printArray() { for (int i : a) { System.out.print(i + " "); } System.out.println(); } // generate a random array to be sorted in ascending and descending order public static void getArray(int size) { a = new int[size]; int item = 0; for (int i = 0; i < size; i++) { item = (int) (Math.random() * 100); a[i] = item; } } // sort getArray in ascending order and bubblesort it public static void ascendingBubble() { int temp; System.out.println(); System.out.println("Ascending sort"); for (int i = 0; i < a.length - 1; i++) { for (int j = 0; j < a.length - 1; j++) { if (a[j] > a[j + 1]) { temp = a[j]; a[j] = a[j + 1]; a[j + 1] = temp; } } } bubbleSort(true); } // sort getArray in descending order and bubblesort it public static void descendingBubble() { int temp; System.out.println(); System.out.println("Descending sort"); for (int i = 0; i < a.length - 1; i++) { for (int j = 0; j < a.length - 1; j++) { if (a[j] < a[j + 1]) { temp = a[j]; a[j] = a[j + 1]; a[j + 1] = temp; } } } bubbleSort(true); } // bubble sort algorithm public static void bubbleSort(boolean printTime) { boolean sorted = false; int pass = 1; int temp; long startTime; long endTime; long duration; startTime = System.nanoTime(); while (pass < a.length - 1 && (!sorted)) { sorted = true; for (int i = 0; i < a.length - 1; i++) { if (a[i] > a[i + 1]) { temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; sorted = false; } } pass = pass + 1; } endTime = System.nanoTime(); duration = (endTime - startTime); if(printTime) { System.out.println(duration + " "+ " nano seconds"); } } }
unknown
d1495
train
See http://blogs.msdn.com/b/laxmi/archive/2008/04/15/sql-server-compact-database-file-security.aspx and http://blogs.msdn.com/b/sqlservercompact/archive/2010/07/07/introducing-sql-server-compact-4-0-the-next-gen-embedded-database-from-microsoft.aspx
unknown
d1496
train
You are over-complicating the solution. All you really need is to determine the size of the label when all the text is added. Once you have determined that, lock the label size to those dimensions, put it inside of a table that expands to fill up the area around it, and then update your label with the action. (You can use a pool and such as needed, but for simplicity I left that out of the code below). You will have to obviously adapt the code to yours, but this gives you a code reference to what I mean. Here is a code snippet on one way to do it: stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); Gdx.input.setInputProcessor(stage); uiSkin = new Skin(Gdx.files.internal("skin/uiskin.json")); Table fullScreenTable = new Table(); fullScreenTable.setFillParent(true); final String message = "hello"; final Label progressLabel = new Label(message, this.uiSkin); final TextBounds bounds = progressLabel.getTextBounds(); // Get libgdx to calc the bounds final float width = bounds.width; final float height = bounds.height; progressLabel.setText(""); // clear the text since we want to fill it later progressLabel.setAlignment(Align.CENTER | Align.TOP); // Center the text Table progressTable = new Table(); progressTable.add(progressLabel).expand().size(width, height).pad(10); final float duration = 3.0f; final TextButton button = new TextButton("Go!", this.uiSkin); button.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { progressLabel.addAction(new TemporalAction(duration){ LabelFormatter formatter = new LabelFormatter(message); @Override protected void update(float percent) { progressLabel.setText(formatter.getText(percent)); } }); } }); stage.addActor(button); fullScreenTable.add(progressTable); fullScreenTable.row(); fullScreenTable.add(button); stage.addActor(fullScreenTable); Edit: Added code to center and top align text in label. Also added code to fill spaces on the end to allow for proper alignment. Note: Only useful for mono-spaced fonts. class LabelFormatter { private final int textLength; private final String[] data; private final StringBuilder textBuilder; LabelFormatter(String text) { this.textBuilder = new StringBuilder(); this.data = text.split("\n"); int temp = 0; for (int i = 0 ; i < data.length; i++) { temp += data[i].length(); } textLength = temp; } String getText(float percent) { textBuilder.delete(0, textBuilder.length()); int current = Math.round(percent * textLength); for (final String row : data) { current -= row.length(); if (current >= 0) { textBuilder.append(row); if (current != 0) { textBuilder.append('\n'); } } else { textBuilder.append(row.substring(0, row.length() + current)); // Back fill spaces for partial line for (int i = 0; i < -current; i++) { textBuilder.append(' '); } } if (current <= 0) { break; } } return textBuilder.toString(); } }
unknown
d1497
train
Is this meant to get you your UIApplication singleton? (i'm guessing MyAppalloc is a typo and should be MyApp alloc) MyApp *myApp2 = [[[MyApp alloc] init] autorelease]; if so then you should be doing it like this: MyApp *myApp2 = (MyApp*)[UIApplication sharedApplication]; If this is not the case you need to make it clearer what MyApp is (your app delegate?) A: I guess, your application running in singleton instance, if this is something kind of NSView or a particular control you want to refresh, you could call its particular refresh method like, [NSTableView reload]; [NSTextField setString]; etc...
unknown
d1498
train
If you want the variables to be avaialble in the URL you need to read them with $_GET. Getting the arguements from a url such as index.php?id=1&job_number_id=3 will look like that: if (isset($_GET['id']) && isset($_GET['job_number_id'])) {//make sure both arguments are set $id = $_GET['id']; $job_number_id = $_GET['job_number_id']; } To set it in your foreach statement: <?php foreach ($allJobs as $site_title) : ?> <p> <tr><?php $url = "http://localhost/estimate_lar/homepage.php?id=" . $site_title['id'] . "&job_number_id=" . $site_title['job_number_id']; echo '<a href="'.$url.'">'.$site_title['client_job_name'],$site_title['job_number_id']. '<br />'.'</a>'; ?> <td></td> </tr> </p> <?php endforeach; ?> PLEASE remember to read about SQL injection and making sure you are escaping your inputs. Or even better - use a prepared statement. Currently your script is volunerable, since everyone could just alter the URL and manipluate your DB. Hope this helps! A: Try this. <?php session_start(); $id = $_SESSION['id']; $url = 'http://localhost/estimate_lar/homepage.php'; if($id){ $query = "SELECT id, client_job_name, job_number_id FROM `job_name` WHERE `id`='$id'"; $allJobs = $db->query($query); }else{ echo "Id not in session"; } ?> <table> <?php if ($allJobs) { foreach ($allJobs as $site_title) : ?> <tr> <td> <a href="<?php echo $url; ?>?client_job_name=<?php echo $site_title['client_job_name'];?>&job_number_id=<?php echo $site_title['job_number_id'];?> "> <?php echo $site_title['job_number_id']. " ".$site_title['job_number_id']; ?></a> </td> </tr> <?php endforeach; ?> </table> <?php }else{ echo 'No results Found' ;} ?> This may help you.
unknown
d1499
train
The most likely cause is typos in field names. Each bracketed field name that doesn't correctly match the field name that you are trying to access in the tables is one missing parameter, as far as the parser is concerned.
unknown
d1500
train
You can (as mentioned in the error message) move the 'Access to the private part of the package spec: private with external; generic flag : Boolean; package g_package is procedure foo (bar : String); private procedure quix (f : String); quix_access : constant external.t_callback_p := quix'Access; end g_package; and the use the constant in the body: external.procedure_f (quix_access); A: There's no way to do this in Ada. If you wish to be non-portable and are using (as it appears) GNAT, you can use the GNAT-specific attribute 'Unrestricted_Access.
unknown