Posts

How can I manage the height of android spinner items? -

I have an Android spinner that uses a array adapter to populate the list of strings and it works fine, However, in the way the spinner is displayed I am running in a display height problem with the list item. At first glance, it seems that the ArrayEdapter can use a layout to display the option which leads me to the problem. When displaying the current item in the spinner (when the user is not selecting a new item from the list) the spinner pad the text so that the spinner is a proper size to click. However, when the user brings a list to tap on it and select a new item, that list item is a short height-wise way. If I use an item layout which presents list items at a reasonable height, then the spinner itself grows awkward due to the item's own padding of the item. How can I manage the height of these two items display the detection modes effectively so that they can show the same height values ​​rather than the height of the spinner, which is higher than the list item perf...

optimization - Efficient algorithm for creating an ideal distribution of groups into containers with potential overflow? -

I have groups of students who need to be allocated in a certain capacity (say, 100 chairs each) in classes. is. Each group should be allocated in only one class, even if it is more than capacity (i.e. overflow, with students standing) I have an algorithm Requirement allocation with minimum overflow and under-capacity classes. In order to allocate, a naïve algorithm is very slow slow, when ~ 200 groups occur, half of these are distributed less than 20% of the class Thank you. Class = "post-text" itemprop = "text"> It's the same, which is NP complete. It is difficult to find the fastest optimal algorithm but it is possible to find almost the optimum algorithm fast. You can start using a greedy approach - you can fit by placing the largest groups first and putting them in the smallest distance.

c# - Regex expression is too greedy -

I am writing a regular expression to match the data from the IMDB soundtrack data file. My rezepses are mostly working, although they are in places sticking a lot of text in my named groups. For example, take the following reggae: "Displayed"? (? & Lt; artist & gt;; *) ('? \ (Qv \))? $ " In the artist group with string ' (qv) Only the name of the artist is included. Unfortunately, because records are not constantly formatted, some artists are surrounded by single quotation marks while others are not. This means that they are alternatively optional as far as regex is concerned. Did I the last group? & Gt; Trying to mark a greedy group using the group specifier, but there was no effect on the results of the result. I can improve the results by changing the artist group to match a small number of artists, but it reduces the possibility of parse the name correctly. Besides, if I only To remove the apostrophe character, I would not be able ...

python - How to make django test framework read from live database? -

I have a similar question here, but it has a different perspective: I have a dynamic app that can be used on data Indexes with queries; I would like to write unit tests for the search component of this app, and of course, I'll need the Django settings module and all the connections will be active with the database, so the test runner Joe Django is ideal. However , the Django testing framework creates an dummy database and I hate to dump all my data into a crop and then index it (tests always Will take for ); My data is not in danger because the test is done only by read database, so, how can it be obtained? -I am new to this whole unit test, so a new solution to write test runner I have read in similar questions, at least I do not reveal anything without some details. To read / test cases for Dzepians I actually found very interesting facts: Use the set up method for what these people do. Tests classes: They create an object and then use the update method for the inde...

Apache Virtual Host in Windows - how do I deal with Symbolic links? -

I'm trying to run a virtual host on the WAPP stack. I FollowSymLinks is the option, but in Windows, the .lnk extension in all those symbolic links (I am using the shortcut and I think this may be the problem) So if I'm trying to reach settings.html then Apache can not find it because I'm sitting there because settings.html.lnk is. Apologies if my question is not clear Apache shortcut does not understand that you need to use the appropriate symlink in the window, this command line tool mklink . See for more information.

android - setting wallpaper through code -

I was trying to create an app with the user he wants to he set was to choose wallpaper. I call the gallery effect previews for the user by setting've managed it once user Cvivr after selecting a specific image, the image data path is brought back to me, which is the image preview. The problem occurs when the size of the image (and / or resolution) is higher than Android's. This is the result of the failure of my module. And as if this was not enough, the user Some other wallpaper tries to select (and also in the case of my test "other" wallpaper size> 700kb) app "Autofmmeri Apeshn "" ... Help me out here guys! Gallery effect I use: effect intended = new intent (for); intent.setType ( "image / *"); intent.setAction (Intent.ACTION_GET_CONTENT); StartActivityForResult (Intent.createChooser (effect, select "picture"), SELECT_IMAGE); I Wallpaper To use: InputStream = getContentResolver (). OpenInputStream (Uri.pars...

c# - Am I using passing my argument correctly with ref? -

SMSCOMMS SMSEngine = नया SMSCOMMS ("COM6"); कोड COM6 का एक मान्य रिफ़ स्ट्रिंग के रूप में मेरा तर्क नहीं लेता है। मैं इसे कैसे हल कर सकता हूं? सार्वजनिक वर्ग SMSCOMMS {सार्वजनिक SMSCOMMS (रेफ़ स्ट्रिंग कमम्पोरेट) {SMSPort = new SerialPort (); SMSPort.PortName = COMMPORT; SMSPort.BaudRate = 9600; एसएमस्पोर्ट.पारिटी = समता। एक; SMSPort.DataBits = 8; एसएमएसपीआरटी। बंदरगाह = बंद करो। एक; एसएमस्पोर्ट। हंडशेक = हैंडशेक। अनुरोध टीओएसेंड; SMSPort.DtrEnable = true; SMSPort.RtsEnable = true; SMSPort.NewLine = System.Environment.NewLine; ReadThread = नया थ्रेड (नया सिस्टम। थ्रेडिंग। थ्रेडस्टार्ट (रीपोर्ट पोर्ट)); } आप ref के साथ एक अस्थायी पास नहीं कर सकते , क्योंकि कॉल विधि को कॉलर के वेरिएबल को निर्दिष्ट करने में सक्षम होना चाहिए। आप इसे शुरू करने के लिए क्यों प्रयोग कर रहे हैं? आप COMMPORT को कभी भी असाइन नहीं करते हैं। क्यों न केवल: सार्वजनिक SMSCOMMS (स्ट्रिंग COMMPORT)