_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d2901
train
did it with a second ".contentbox"-div and some helper classes and jQuery click event and i chosed to fade the readmore-text in the contentbox itself above the centered heading. html: <div class="col-lg-3 col-sm-6 col-xs-12 fw"> <div class="contentbox readmore bgr flex-col"> <h2>example</h2> </div> <div class="contentbox expand bgr flex-col"> <span aria-hidden="true" class="pull-right closebox">&times;</span> <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata.</p> <p><a href="#" class="btn btn-default">read more</a></p> </div> </div> css: .contentbox { padding: 15px 30px 15px 30px; text-align: center; display: block; height: auto; min-height: 160px; /* Only for my layout */ } .readmore { cursor: pointer; /* So your complete box seems clickable */ } .expand { position: absolute; top: 0; /* You can switch these values to whatever values wished */ left: 0; /* It will then slide from the direction you chose */ right: 0; /* but remember to put the chosen direction to 0 again on .expanded */ bottom: 0; /* for me, the fadeeffect was the most elegant way */ font-size: 15px; opacity: 0; visibility: hidden; transition: all .75s ease-in-out; } .expanded { top: 0; opacity: 1; visibility: visible; cursor: default; transition: all .75s ease-in-out; } .closebox { font-size: 24px; position: absolute; right: 10px; top: 0px; cursor: pointer; } js within document ready: $(".readmore").click(function(){ $(this).next(".expand").addClass("expanded"); }); $(".closebox").click(function(){ $(this).parent(".expanded").removeClass("expanded"); });
unknown
d2902
train
To find k-th element in TF you need tf.nn.top_k. If you need smallest you search not in X, but in -X. In your case you do not even need it. If your matrix is a distance, the diagonal is always 0 and this screws things up for you. So just create change the diagonal of your matrix with tf.matrix_set_diag, where your diagonal is a vector of size of your X, where each value is tf.reduce_max. Writing a code for this is trivial.
unknown
d2903
train
message.channel returns a channel object, you're trying to get the id. You can replace message.channel with message.channel.id to get the channel id. Then the code will work.
unknown
d2904
train
You need to use the ExecuteNonQuery() method of your MySqlCommand object, which will return the row(s) affected - which i suspect you are looking for. A DELETE statement will not return a resultset, only the records affected. using(MySqlConnection c = new MySqlConnection("Server=**;Database=***;Uid=**;Pwd=**;")) { using (MySqlCommand cmd = new MySqlCommand("DELETE FROM users WHERE username = @name")) { var userParam = new MySqlParameter(); userParam.Name = "@name"; userParam.Value = textbox1.Text; cmd.Parameters.Add(userParam); c.Open(); var recordsAffected = cmd.ExecuteNonQuery(); c.Close(); if (recordsAffected == 1) { MessageBox.Show("Benutzer erfolgreich entfernt, Sir!"); } } }
unknown
d2905
train
:foo)); else client_helper(pA, 5010, pT, std::mem_fn(&A::foo1)); } the question is: what signature should D::client_helper() have? A: Since both A::foo and A::foo1 have the same signature, there's no need for std::mem_fn, or another abstraction, just have client_helper take a plain pointer to member function of A. void client_helper(A* pA, int i, T* pT, void(A::*memfn)(int, T*)) { (pA->*memfn)(i, pT); } And call it as void client_foo(A* pA, bool b, T* pT) { if (b) client_helper(pA, 1050, pT, &A::foo); else client_helper(pA, 5010, pT, &A::foo1); } Live demo A: For passing functions as arguments, you have std::function. A: I've used std::function<ret_type(arg_1)> and std::bind instead of std::mem_fn e.g. client function: void client_helper(std::function<void (T*)> fnFoo, T* pT) { nfFoo(pT); } call of the function: usign namespace std::placeholders; A* pA; T* pT; client_helper(std::bind(&A::foo, pA, 1050, _1), pT);
unknown
d2906
train
Following code is facing the same problem so permissions could be the reason or elsewise change the method to GET it will be working. <?php $url = "http://sea-summit.com/T_webservice/get_appointments_by_id.php"; $data = array('user_id'=> 1); $options = array( 'http' => array( 'method' => 'POST', 'content' => json_encode( $data ), 'header'=> "Content-Type: application/json\r\n" . "Accept: application/json\r\n" )); $context = stream_context_create( $options ); $result = file_get_contents( $url, false, $context ); $response = json_decode( $result ); var_dump($response); ?> A: you forgot to upload Current_User.txt A: Did you check the write permission of your Current_User.txt file? What File System are you using on your Server? If you have access: Check your PHP error_log on the Server to get more valueable answers, or change the error_reportings.
unknown
d2907
train
This line if ((Numeros[Indice] + Acumulador) > 4000000) is checking for the sum being greater than 4MM. You need to check that the term (Numeros[Indice]) is greater than 4MM. So changing that to this... if (Numeros[Indice] > 4000000) is probably a good place to start. A: And also man your test condition in for loop is useless.. i wil never reach the value of 4000000. simply a while(1){ //code } will also do, no need of i as u never use it
unknown
d2908
train
Once you've sorted the list, duplicate elements (if any) will be next to one another, so you can simply iterate over the list removing any duplicate elements, no searching required. (We iterate backwards to avoid the awkwardness of deciding whether to increment the loop counter after removing an element.) Collections.sort(list); for (int i = list.size()-1; i >= 0; --i) if (list.get(i).equals(list.get(i+1))) list.remove(i); But a more convenient way to ensure uniqueness is to create a Set holding the contents of your list, then create a new list from the set. The new list will contain the unique elements of the input list in the set's iteration order, so we can sort at the same time by using a TreeSet. (Using a HashSet to create the list, then calling Collections.sort(list) may or may not be faster, and the above solution may be faster still -- if it matters to you, profile to ensure it's a problem, then benchmark.) list = new ArrayList<>(new TreeSet<>(list)); If reusing the input list is important (either as an arbitrary homework requirement or to minimize memory use/churn), you can do something like Set<T> set = new TreeSet<>(list); list.clear(); list.addAll(set); A: Since the new Java is out, I might as well post this to help "future seekers". ArrayList<String> newList = oldList.stream().distinct().collect(Collectors.toCollection(ArrayList::new));
unknown
d2909
train
You can do the following: var app = express(); var routes = require('./routes/index'); app.set('base', '/qae'); then you need to add route app.use('/qae', routes); Hope this helps :) A: You should change your rooting to this: app.use('/qae',require('./routes')) and in routes/index.js you can have all declarations of your routes. In routes.js export default function(app) { // Insert routes below app.use('/qae', require('./api')); app.use('/auth', require('./auth')); app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); }); // All undefined asset or api routes should return a 404 app.route('/:url(api|auth|components|app|bower_components|assets)/*') .get(errors[404]); // All other routes should redirect to the index.html app.route('/*') .get((req, res) => { res.sendFile(path.resolve(app.get('appPath') + '/index.html')); }); } create file index.js in api const express = require('express') const router = express.Router() router.use('/api/cpd', require('./cpd')); router.use('/api/categories', require('./category')); router.use('/api/terms', require('./term')); router.use('/api/qae', require('./qae')); router.use('/api/stats', require('./stat')); router.use('/api/tags', require('./tag')); router.use('/api/questions', require('./question')); router.use('/api/things', require('./thing')); router.use('/api/users', require('./user')); module.exports = router That way all your api routes will look like /qae/api/*. If you need auth also after this prefix you need to do it same way. Best solution is to have i app.use('/',...) including routers from subfolders. A: If your ./routes module returned a router instead of taking an app object, then you could do this to make it available in / route: app.use(require('./routes')); or this to use /qae prefix: app.use('/qae', require('./routes')); but since you pass the app object to the function exported by ./routes then it is the ./routes module that actually registers the routes and since you didn't include its code it's hard to give you a specific example. I can only say that you will need to change the routes definitions in ./routes for a different prefix, and you'd need to return a router instead of taking app argument for the above examples to work. Tthen you ./routes would have to look like this: let express = require('express'); let router = express.Router(); router.get('/xxx', (req, res) => { // ... }); router.get('/yyy', (req, res) => { // ... }); module.exports = router; and only then you'll be able to use: app.use('/qae', require('./routes')); in the main code. A: Folder Structure bin/ www server/ routes/ index.js book.js views/ index.ejs app.js router.js error.js public/ package.json app.js var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); // uncomment after placing your favicon in /public //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); require('./router')(app); require('./errors')(app); module.exports = app; route.js var index = require('./routes/index'); var books = require('./routes/books'); var base = '/api'; module.exports = function (app) { app.use(base+'/', index); app.use(base+'/books', books); }; error.js module.exports = function (app) { app.use(function (req, res, next) { var err = new Error('Not Found'); err.status = 404; next(err); }); // development error handler // will print stacktrace if (app.get('env') === 'development') { app.use(function (err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: err }); }); } // production error handler app.use(function (err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: {} }); }); }; index.js var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { res.render('index', { title: 'Express' }); }); module.exports = router;
unknown
d2910
train
@ECHO OFF SETLOCAL rem The following settings for the source directory, destination directory, target directory, rem batch directory, filenames, output filename and temporary filename [if shown] are names rem that I use for testing and deliberately include names which include spaces to make sure rem that the process works using such names. These will need to be changed to suit your situation. SET "destdir=u:\your results" SET "outfile=%destdir%\outfile.txt" ( FOR /f "tokens=1delims= " %%b IN ('devcon findall *^|find "USB\VID"') DO ( ECHO "@%%b" ) )>>"%outfile%" GOTO :EOF Not really sure why your code is so complex or why you haven't posted a small sample of your DevicesExist.txt file. This code executes devcon and appends the processed extracted data to a destination file. Use > in place of >> to replace any existing content of the destination file with the output from this batch.
unknown
d2911
train
You had it almost right. Try this (for an incrementing series): SELECT day::date FROM generate_series(CURRENT_DATE - interval '30 days', CURRENT_DATE, interval '1 week') day Or if you really want to go backward: SELECT day::date FROM generate_series(CURRENT_DATE, CURRENT_DATE - interval '30 days', -interval '1 week') day
unknown
d2912
train
SAS tech support told me that this won't work and that I'll need to convert the .xls SAS output into a .xlsx file: Unfortunately, the MSOffice2K destination creates an HTML file even though it uses the .XLS extension here which allows the file to be opened with excel. You can use VBScript to convert the file to .XLSX, however, there is no way to do this using the MSoffice2K destination. A: The error message tells you the problem. found b'<html xm' Your file is an HTML file and not an XLS file. This was commonly done with "old" SAS since it did not support writing XLS files, but Excel did support reading HTML files.
unknown
d2913
train
Build number #1 SUCCESS Console output: <console link> Job B: Build number #1 FAILED Console output: <console link> Job C: Build number #1 SUCCESS Console output: <console link> A: You can use Email-ext plugin for sending emails. The advantage of this plugin is we can write our own mail templates using groovy. You can find some examples here and also some more examples from plugin source itself.
unknown
d2914
train
<target name="blah"> <property environment="env"/> <exec executable="cmd" failonerror="true"> <arg value="/C"/> <arg value="${cpp.compiler.path}/vsvars32.bat"/> <arg value="&amp;&amp;"/> <arg value="${env.ANT_HOME}/bin/ant.bat"/> <arg value="-f" /> <arg value="cpp-build.xml" /> <arg value="make-cpp-stuff" /> </exec> </target> Addition You can create an external batch file that will run the vsvars and the ant, and then you will have only one process to create. I believe the && is not working as you expect it to: run-ant-vs.bat: ....\vsvars32.bat %ANT_HOME\bin\ant.bat -f cpp-build.xml make-cpp-stuff A: I'm not sure if this could help you. Is Java client execution using a parameter you pass when you execute ant build, you can try to adapt this example (exec is more generic than java task, but is a similar concept) Ant task example: <target name="run"> <java classname="my.package.Client" fork="true" failonerror="true"> <arg line="-file ${specific.file}"/> </java> </target> Invocation example: ant run -Dspecific.file=/tmp/foo.txt
unknown
d2915
train
yes i was also looking through the same thing.. the generic version of the HttpResponseMessage was remove recently.. because it was not type safe A: Searching for the answer i found this article and it states that the generic version has been removed so now just mention the return type to be of type HttpresponseMessage and when actually returning the response use Request.CreateResponse<T>(params);
unknown
d2916
train
The EKEventStore provides access to the calendar/reminder resources that are available to the OS that are configured by the user. It is not possible to configure a separate event store for private developer use. Reminders can be made local so they are not synced in the cloud. However, if the device has reminder lists that are synced to the cloud, then it is no longer possible to access the local reminders either by your app or the Reminders app. This same behavior seems to apply to local Calendars where I answered a question about their availability at Local EKCalendar saved with not errors, disappears. The question at Unable to create local EKCalendar (Reminders) if iCloud is set to not sync Reminders seems to support my conclusions and suggests this behavior has been present for at least a couple of years.
unknown
d2917
train
The best solution I've found is the following: master.kid: <html> <head py:match="item.tag == 'head'"> <title>My Site</title> </head> <body py:match="item.tag == 'body'"> <h1>My Site</h1> <div py:replace="item[:]"></div> <p id="footer">Copyright Blixt 2010</p> <div py:if="defined('body_end')" py:replace="body_end()"></div> </body> </html> mypage.kid: <html> <head></head> <body> <p>Hello World!</p> <div py:def="body_end()" py:strip="True"> <script type="text/javascript">alert('Hello World!');</script> </div> </body> </html> The master.kid page checks for a variable defined as body_end, and if there is such a variable, it will call it, replacing the contents of the element before </body> (otherwise it will output nothing). Any page that needs to output content before </body> will define the body_end function using py:def="body_end()". The py:strip="True" is there to remove the wrapping <div>.
unknown
d2918
train
The StoryReporter code below should do what you are looking for. It keeps track of each scenario and the pass/fail status of each step in the scenario. If any step fails, then the scenario is failed. If any scenario fails, then the story is marked as failed. At the end of the story it logs the results. public class MyStoryReporter implements org.jbehave.core.reporters.StoryReporter { private Story runningStory; private boolean runningStoryStatus; private String runningScenarioTitle; private boolean runningScenarioStatus; private List<ScenarioResult> scenarioList; private Log log = LogFactory.getLog(this.getClass()); private class ScenarioResult { public String title; public boolean result; public ScenarioResult(String title, boolean result) { this.title = title; this.result = result; } } public void beforeStory(Story story, boolean b) { runningStory = story; runningStoryStatus = true; scenarioList = new ArrayList<>(); } public void afterStory(boolean b) { String storyPrefix = runningStoryStatus ? "PASS: STORY: " : "FAIL: STORY: "; log.info(storyPrefix + runningStory.getName() + "."); String scenarioPrefix; for (ScenarioResult scenario : scenarioList) { scenarioPrefix = scenario.result ? " PASS: SCENARIO: " : " FAIL: SCENARIO: "; log.info(scenarioPrefix + scenario.title + "."); } } public void beforeScenario(String s) { runningScenarioTitle = s; runningScenarioStatus = true; } public void afterScenario() { scenarioList.add(new ScenarioResult(runningScenarioTitle, runningScenarioStatus)); runningStoryStatus = runningStoryStatus && runningScenarioStatus; } public void failed(String s, Throwable throwable) { runningScenarioStatus = false; }
unknown
d2919
train
You have a jwt.php file in your config folder (config/jwt.php). In there please replace the JWT_SECRET with your generated jwt secret key on your .env file In jwt.php file 'secret' => env('JWT_SECRET', 'PLACE YOUR JWT KEY HERE'), Hope this will solve your problem
unknown
d2920
train
I would use neither of your examples. I don't think that part of the I/O is the performance bottleneck. The vbuf is an area for the input routine to place data before putting it into your destination. It could be used as a cache or as a preformatting buffer. Most of the time, I/O bottlenecks are related to the quantity of data fetched and the number of fetches. For example, reading one byte at a time is less efficient than reading a block of bytes. Another I/O related bottleneck is the duration between input requests. I/O devices prefer to keep streaming data, non-stop. Some input devices, like hard drives, have an overhead time between when the request is received and when the data starts transmitting. For hard drives, this would be the disk speed up time. Your best performance is not to waste development time messing with the C or C++ libraries. You need to use hardware assist. Some platforms have a device called a Direct Memory Access controller (DMA). This device can take data from an input source and deliver it to memory without using the CPU. The CPU can be executing instructions while the DMA is transferring data. In order to use hardware assistance, you need to write code at the OS driver level, or access the OS drivers directly. The C and C++ I/O libraries are designed for a platform independent concept called streams. There may be execution overhead associated with this (such as extra buffering). If you don't care about different platforms, then access the OS drivers directly. Don't waste your time messing with the C and C++ libraries. Not much performance gain there. More performance lies in accessing the OS drivers directly (or using your own). How and when you access the I/O will show bigger performance gains than tweaking the C and C++ libraries. Lastly, using the processors data cache effectively will gain you performance too.
unknown
d2921
train
Defined one more property in your Location model called distance. which is distance from user's current location. var distance: Double { get { return CLLocation(latitude: latitude , longitude: longitude).distance(from: userLocation) } } This returns distance in CLLocationDistance, but you can use it as Double, because it makes easy while sort. Now you can sort locations in ascending array like this and Reload data var locations = [Location]() locations.sort { $0.distance < $1.distance } self.tableView.reloadData()
unknown
d2922
train
A recent usability study suggests taking the opposite approach and indicating which fields are optional rather than required. Furthermore, try to ask for only what you really need in order to reduce the number of optional fields. The reason is that users tend to assume all fields are required anyway. They may not understand or pay attention to the asterisk, whereas they readily understand clearly labeled optional fields. Link to the study (see Guideline 5): https://www.cxpartners.co.uk/our-thinking/web_forms_design_guidelines_an_eyetracking_study/ A: Just put a * in front on the mandatory fields. It's simple, yet effective. I think most people will know what this means. Also, when they try to submit and it fails, because some mandatory field was not filled in correctly, then you let the user know which field they need to change (by using those red borders, for instance). I think this is what most people are accustomed to. Edit: I saw that you didn't want to use an asterisk by the way. I still think this is the best option, simply because I think most people will recognize it right away and know what to do :) A: I do it this way. Mark the left-border of the element with 2px Red color. A: you can also change background color of textbox.. A: It depends on your design, of course, but I prefer something simpler like the labels of the input being bold. The red outline, while clear, does have an "error" connotation associated with it, which might be misleading to the user. Bolding the labels is subtle, but easy to understand without being an eyesore. A: I like the jquery 'example' plugin for text input fields. A subtle grey inlay for instructions or sample input. See demo page here for an, ahem, example. http://mucur.name/system/jquery_example/ Depending on how many fields you have, it might be too cluttered, but light-colored, italicized text like: first name (required) last name (required) might work for your app. HTH
unknown
d2923
train
DISTINCT can be used within aggregate expressions too: SELECT "user".id, name, array_agg(DISTINCT email) emails, array_agg(DISTINCT phone) phones FROM "user" LEFT JOIN user_email ON user_email.user_id = "user".id LEFT JOIN user_phone ON user_phone.user_id = "user".id GROUP BY "user".id ORDER BY "user".id; Note: if you only need comma separated lists, you may want to use string_agg() instead of array_agg(). SQLFiddle A: Either DISTINCT SELECT DISTINCT user.id, user.name, array_agg(user_email.email), array_agg(user_phone.phone) FROM user LEFT JOIN user_email ON user_email.user_id = user.id LEFT JOIN user_phone ON user_phone.user_id = user.id GROUP BY user.id ORDER BY user.id Or INNER Joins SELECT user.id, user.name, array_agg(user_email.email), array_agg(user_phone.phone) FROM user INNER JOIN user_email ON user_email.user_id = user.id INNER JOIN user_phone ON user_phone.user_id = user.id GROUP BY user.id ORDER BY user.id Or both SELECT DISTINCT user.id, user.name, array_agg(user_email.email), array_agg(user_phone.phone) FROM user INNER JOIN user_email ON user_email.user_id = user.id INNER JOIN user_phone ON user_phone.user_id = user.id GROUP BY user.id ORDER BY user.id
unknown
d2924
train
Instead of trying to make your app import the read-only data on first launch (forcing the user to wait while the data is imported), you can import the data yourself, then add the read-only .sqlite file and data model to your app target, to be copied to the app bundle. For the import, specify that the persistent store should use the rollback journaling option, since write-ahead logging is not recommended for read-only stores: let importStoreOptions: [NSObject: AnyObject] = [ NSSQLitePragmasOption: ["journal_mode": "DELETE"],] In the actual app, also specify that the bundled persistent store should use the read-only option: let readOnlyStoreOptions: [NSObject: AnyObject] = [ NSReadOnlyPersistentStoreOption: true, NSSQLitePragmasOption: ["journal_mode": "DELETE"],] Since the bundled persistent store is read-only, it can be accessed directly from the app bundle, and would not even need to be copied from the bundle to a user directory. A: Leaving aside whether loading a JSON at the first startup is the best option and that this question is four years old, the solution to your two questions is probably using notifications. They work from all threads and every listening class instance will be notified. Plus, you only need to add two lines: * *The listener (your view controller or test class for question 2) needs to listen for notifications of a specific notification name: NotificationCenter.default.addObserver(self, selector: #selector(ViewController.handleMySeedNotification(_:)), name: "com.yourwebsite.MyCustomSeedNotificationName", object: nil) where @objc func handleMySeedNotification(_ notification: Notification) is the function where you are going to implement whatever should happen when a notification is received. *The caller (your database logic) the sends the notification on successful data import. This looks like this: NotificationCenter.default.post(name: "com.yourwebsite.MyCustomSeedNotificationName", object: nil) This is enough. I personally like to use an extension to Notification.Name in order to access the names faster and to prevent typos. This is optional, but works like this: extension Notification.Name { static let MyCustomName1 = Notification.Name("com.yourwebsite.MyCustomSeedNotificationName1") static let MyCustomName2 = Notification.Name("CustomNotificationName2") } Using them now becomes as easy as this: NotificationCenter.default.post(name: .MyCustomSeedNotificationName1, object: nil) and even has code-completion after typing the dot!
unknown
d2925
train
Use the tinymce onActivate event in case of focus. A cursor location change is possible, but it is expensive to detect, because you will have to check on each key-action if the cursor is still on the previous spot or not.
unknown
d2926
train
I ran into this same problem and after banging my head against all the hard surfaces in my office I discovered that I need to rename the css classes to match the fade example he provided here. So for example the mfp-zoom-out animation: .mfp-zoom-out .mfp-with-anim should be .mfp-zoom-out.mfp-bg .mfp-zoom-out.mfp-bg stays the same .mfp-zoom-out.mfp-ready .mfp-with-anim should be .mfp-zoom-out.mfp-ready .mfp-content .mfp-zoom-out.mfp-ready.mfp-bg should be .mfp-zoom-out.mfp-bg.mfp-ready .mfp-zoom-out.mfp-removing .mfp-with-anim should be .mfp-zoom-out.mfp-removing .mfp-content .mfp-zoom-out.mfp-removing.mfp-bg should be .mfp-zoom-out.mfp-bg.mfp-removing A: You can also make great use of animate.css (http://daneden.github.io/animate.css/). Once you initialize the popup make sure you add animate class along with the desired animation class from the library. For example animate fadeIn. A: Check i have code for Fade-zoom animation for first dialog and Fade-move animation for second dialog. You can get magnific-popup.css and magnific-popup.min.js files in the dist folder...Files can be downloaded from https://github.com/dimsemenov/Magnific-Popup <html lang="en"> <head> <title><!-- Insert your title here --></title> <link rel="stylesheet" href="magnific-popup.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="jquery.magnific-popup.min.js"></script> </head> <body> <div class="example gc3"> <h3>Dialog with CSS animation</h3> <div class="html-code"> <a class="popup-with-zoom-anim" href="#small-dialog" >Open with fade-zoom animation</a><br/> <a class="popup-with-move-anim" href="#small-dialog" >Open with fade-slide animation</a> <!-- dialog itself, mfp-hide class is required to make dialog hidden --> <div id="small-dialog" class="zoom-anim-dialog mfp-hide"> <h1>Dialog example</h1> <p>This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.</p> </div> </div> <script type="text/javascript"> $(document).ready(function() { $('.popup-with-zoom-anim').magnificPopup({ type: 'inline', fixedContentPos: false, fixedBgPos: true, overflowY: 'auto', closeBtnInside: true, preloader: false, midClick: true, removalDelay: 300, mainClass: 'my-mfp-zoom-in' }); $('.popup-with-move-anim').magnificPopup({ type: 'inline', fixedContentPos: false, fixedBgPos: true, overflowY: 'auto', closeBtnInside: true, preloader: false, midClick: true, removalDelay: 300, mainClass: 'my-mfp-slide-bottom' }); }); </script> <style type="text/css"> /* Styles for dialog window */ #small-dialog { background: white; padding: 20px 30px; text-align: left; max-width: 400px; margin: 40px auto; position: relative; } /** * Fade-zoom animation for first dialog */ /* start state */ .my-mfp-zoom-in .zoom-anim-dialog { opacity: 0; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; -webkit-transform: scale(0.8); -moz-transform: scale(0.8); -ms-transform: scale(0.8); -o-transform: scale(0.8); transform: scale(0.8); } /* animate in */ .my-mfp-zoom-in.mfp-ready .zoom-anim-dialog { opacity: 1; -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); -o-transform: scale(1); transform: scale(1); } /* animate out */ .my-mfp-zoom-in.mfp-removing .zoom-anim-dialog { -webkit-transform: scale(0.8); -moz-transform: scale(0.8); -ms-transform: scale(0.8); -o-transform: scale(0.8); transform: scale(0.8); opacity: 0; } /* Dark overlay, start state */ .my-mfp-zoom-in.mfp-bg { opacity: 0.001; /* Chrome opacity transition bug */ -webkit-transition: opacity 0.3s ease-out; -moz-transition: opacity 0.3s ease-out; -o-transition: opacity 0.3s ease-out; transition: opacity 0.3s ease-out; } /* animate in */ .my-mfp-zoom-in.mfp-ready.mfp-bg { opacity: 0.8; } /* animate out */ .my-mfp-zoom-in.mfp-removing.mfp-bg { opacity: 0; } /** * Fade-move animation for second dialog */ /* at start */ .my-mfp-slide-bottom .zoom-anim-dialog { opacity: 0; -webkit-transition: all 0.2s ease-out; -moz-transition: all 0.2s ease-out; -o-transition: all 0.2s ease-out; transition: all 0.2s ease-out; -webkit-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg ); -moz-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg ); -ms-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg ); -o-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg ); transform: translateY(-20px) perspective( 600px ) rotateX( 10deg ); } /* animate in */ .my-mfp-slide-bottom.mfp-ready .zoom-anim-dialog { opacity: 1; -webkit-transform: translateY(0) perspective( 600px ) rotateX( 0 ); -moz-transform: translateY(0) perspective( 600px ) rotateX( 0 ); -ms-transform: translateY(0) perspective( 600px ) rotateX( 0 ); -o-transform: translateY(0) perspective( 600px ) rotateX( 0 ); transform: translateY(0) perspective( 600px ) rotateX( 0 ); } /* animate out */ .my-mfp-slide-bottom.mfp-removing .zoom-anim-dialog { opacity: 0; -webkit-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg ); -moz-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg ); -ms-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg ); -o-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg ); transform: translateY(-10px) perspective( 600px ) rotateX( 10deg ); } /* Dark overlay, start state */ .my-mfp-slide-bottom.mfp-bg { opacity: 0.01; -webkit-transition: opacity 0.3s ease-out; -moz-transition: opacity 0.3s ease-out; -o-transition: opacity 0.3s ease-out; transition: opacity 0.3s ease-out; } /* animate in */ .my-mfp-slide-bottom.mfp-ready.mfp-bg { opacity: 0.8; } /* animate out */ .my-mfp-slide-bottom.mfp-removing.mfp-bg { opacity: 0; } </style> </div> </body> </html> A: In case anyone interested in the .mfp-move-from-top animation below is the code: .mfp-move-from-top .mfp-content{ vertical-align:bottom; } .mfp-move-from-top .mfp-with-anim{ opacity: 0; transition: all 0.2s; transform: translateY(-100px); } .mfp-move-from-top.mfp-bg { opacity: 0; transition: all 0.2 } .mfp-move-from-top.mfp-ready .mfp-with-anim { opacity: 1; transform: translateY(0); } .mfp-move-from-top.mfp-bg.mfp-ready { opacity: 0.8; } .mfp-move-from-top.mfp-removing .mfp-with-anim { transform: translateY(-50px); opacity: 0; } .mfp-move-from-top.mfp-removing.mfp-bg { opacity: 0; } A: I had the same problem. found the solution here: just change beforeOpen: function() { this.st.mainClass = this.st.el.attr('data-effect'); } to this (adds a space and then the class, in case option is being used): into beforeOpen: function() { this.st.mainClass += ' ' + this.st.el.attr('data-effect'); }
unknown
d2927
train
first, replace all \ with / and then add the executable filename in the file location: driver = webdriver.Chrome(r'C:/Users/User/AppData/Local/Programs/Python/Python37-32/Lib/site-packages/selenium/webdriver/chrome/chromedriver.exe')
unknown
d2928
train
You are not calling _stprintf_s correctly. The second argument should be the size of the destination string. _stprintf_s(info_temp, MAX_PATH, _T("\r\n%s"), infoBuf);
unknown
d2929
train
This is definitely doable in Plotly using annotations. There don't have to be y-values for the operations DataFrame because you can use the corresponding y-value from the stock data at the operations x-values. To plot the red markers, you can plot the operations_df and set the marker attributes as you like. Then you can loop through the operations_df and place an annotation on the scatterplot based on the date of the entry, and its corresponding y-value on the stocks portfolio. Here is an example with some made up data, so you may need to tweak this code for your DataFrames. import numpy as np import pandas as pd import plotly.graph_objs as go ## create some random data np.random.seed(42) df = pd.DataFrame( data=500*np.random.randint(0,1000,24), columns=['price'], index=pd.date_range(start='12/1/2020', end='12/1/2020 23:00:00', freq='H') ) operations_df = pd.DataFrame( data=['Buy','Sell','Buy'], columns=['Operation_type'], index=pd.to_datetime(['12/1/2020 08:00:00', '12/1/2020 12:00:00', '12/1/2020 16:00:00']) ) fig = go.Figure(data=[go.Scatter( x=df.index, y=df.price )]) fig.add_trace(go.Scatter( x=operations_df.index, y=[df.loc[date, 'price'] for date in operations_df.index], mode='markers', marker=dict( size=16, color="red") )) for date, row in operations_df.iterrows(): # print(date, df.loc[date, 'price'], row['Operation_type']) fig.add_annotation( x=pd.to_datetime(date), y=df.loc[date, 'price'], xref="x", yref="y", font=dict( size=16, color="red" ), text=row['Operation_type'], bordercolor="red", width=80, height=60, arrowcolor="red", ax=0, ay=-150 ) fig.update_layout(showlegend=False) fig.show()
unknown
d2930
train
execute() is a method of AsyncTask. If you want to invoke then you need to create an instance of Asynctask. If you want to execute a method of a class you need to instantiate and then call the appropriate methods. task.excute(); will give you NUllPointerException. task = new MyAsyncTask(); task.execute(); You may also want to check http://docs.oracle.com/javase/tutorial/java/javaOO/objectcreation.html Look at the public methods as suggested by prosper k it is not a static method http://developer.android.com/reference/android/os/AsyncTask.html A: Java is not RAII. You always need to create an instance of a class, because you cannot execute methods on a class directly unless the method is static. But then still the syntax would be different. What you can do is more like this: private MyAsyncTask task; … private void foo() { task = new MyAsyncTask(); … task.execute(); } A: This is a matter of Java not Android. In java, something like: MyAsynkTask task; doesn't create an object. In this step you have only declared a variable. To use any method of your object (e.g. task.execute()) you have to instantiate an object (i.e. actually create one); like: task = new MyAsyncTask(); A: Check this link for basics of "new" keyword. Basically it is use for Instantiating a Class.The new operator instantiates a class by allocating memory for a new object and returning a reference to that memory. The new operator also invokes the object constructor. Hope this helps you.
unknown
d2931
train
You have to prepare array of data. We way you prepare it doesn't really matter. You can use $pos++ and set column markers in the data array. and then output in in the template like this: <? foreach ($DATA as $row): ?> <? if($row['ul']): ?> <div class="row"> <ul class="ul"> <? endif ?> <li><a href="<?=$row['url']?>"><img src="<?=$row['src']?>"></a></li> <? if($row['/ul']): ?> </ul> </div> <? endif ?> or you can use array_chunk and then use nested foreaches: <? foreach ($DATA as $arr): ?> <div class="row"> <ul class="ul"> <? foreach ($arr as $row): ?> <li><a href="<?=$row['url']?>"><img src="<?=$row['src']?>"></a></li> <? endforeach ?> </ul> </div> <? endforeach ?> The latter one looks neat, I have to admit A: you can do for ($i=0 ; $i < 5; $i++){ echo '<div class="row"> <ul class="ul">'; for ($j=0;$j<3;$j++){ echo '<li><a href="#"><img src=....></a></li>'; } echo '</ul> </div>'; }
unknown
d2932
train
please go through this answer which shows how you can manage Navigation bar title when collapsed and when it's large. It won't give you an exact answer but it will definitely help you in achieving what you want. Other then that please go through this answer which will help you understand how give x,y positions to right bar button item. Just a quick overview how you can achieve what you want by the combination of this two answers:- * *Set the position of the right bar button item according to the position or height of the navigation bar which you wanted to do. Link number 2 will help you in doing that. *Observe your navigation bar when the height of your navigation bar is increased or decreased you can change the position of your right bar button item. and Done. By using this you can manage the position of your bar button item at both the item when your Navigation bar is Enlarged at that time you can show button at different position and when the Navigation Bar is collapsed you can show button at different position so that it doesn't look vice-versa of your question after changing position of your button. A: I've done something similar in my app - not exactly what you are looking for, but should give you enough to go on: func setupNavBar() { let rightButton = UIButton() rightButton.setTitle("Leave", for: .normal) rightButton.addTarget(self, action: #selector(rightButtonTapped(button:)), for: .touchUpInside) navigationController?.navigationBar.addSubview(rightButton) rightButton.tag = 97 rightButton.frame = CGRect(x: self.view.frame.width, y: 0, width: 120, height: 20) let targetView = self.navigationController?.navigationBar let trailingConstraint = NSLayoutConstraint(item: rightButton, attribute: .trailingMargin, relatedBy: .equal, toItem: targetView, attribute: .trailingMargin, multiplier: 1.0, constant: -16) let bottomConstraint = NSLayoutConstraint(item: rightButton, attribute: .bottom, relatedBy: .equal, toItem: targetView, attribute: .bottom, multiplier: 1.0, constant: -6) rightButton.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([trailingConstraint, bottomConstraint]) } I also created this function to remove it (hence the tag use above): func removeRightButton(){ guard let subviews = self.navigationController?.navigationBar.subviews else{ log.info("Attempt to remove right button but subviews don't exist") return } for view in subviews{ if view.tag == 97 { view.removeFromSuperview() } } }
unknown
d2933
train
First thing that I would do is to figure out where the problem lies. Is the text created? Where does it actually appear? Run the game, and look at the game object view to see what is happening for these objects. My second observation is that you probably want the text to be parented to the border. This allows the border to adequately manage the text, and how it laid out. They should go together. Lastly, take a look at LayoutGroups. If your border has a layout group, then it should adjust it's size (Or adjust the size of it's children) to match the text as you want it to be.
unknown
d2934
train
If you can't redesign your database to use something more efficient, this will get the answer. You'll obviously want to parameterize it. It says find either the desired date, or the earliest end date where the hire interval doesn't overlap an existing booking: Select min(startdate) From ( select cast('2013-10-27 12:00' as datetime) startdate from dual union all select enddate from booking where enddate > cast('2013-10-27 12:00' as datetime) and item = 42 ) b1 Where not exists ( select 'x' from booking b2 where item = 42 and b1.startdate < b2.enddate and b2.startdate < date_add(b1.startdate, interval 24 hour) ); Example Fiddle A: SELECT startfree,secondsfree FROM ( SELECT @lastenddate AS startfree, UNIX_TIMESTAMP(startdate)-UNIX_TIMESTAMP(@lastenddate) AS secondsfree, @lastenddate:=enddate AS ignoreme FROM (SELECT startdate,enddate FROM bookings WHERE item=42) AS schedule, (SELECT @lastenddate:=NOW()) AS init ORDER BY startdate ) AS baseview WHERE startfree>='2013-10-27 12:00:00' AND secondsfree>=86400 ORDER BY startfree LIMIT 1 ; Some explanation: The inner query uses a variable to move the iteration into SQL, the outer query finds the needed row. That said, I would not do this in SQL, if the DB structure is like the given. You could reduce the iteration count by using some smort WHERE in the inner query to a sane timespan, but chances are, this won't perform well. EDIT A caveat: I did not check, but I assume, this won't work, if there are no prior reservations in the list - this should not be a problem, as in this case your first reservation attempt (original time) will work. EDIT SQLfiddle A: Searching for overlapping date ranges generally yields poor performance in SQL. For that reason having a "Calendar" of available slots often makes things a lot more efficient. For example, the booking 2013-10-25 16:00 => 2013-10-27 12:00 would actually be represented by 44 records, each one hour long. The "gap" until the next booking at 2013-10-27 14:00 would then be represented by 2 records, each one hours long. Then, each record could also have the duration (in time, or number of slots) until the next change. slot_start_time | booking | item | remaining_duration ------------------+---------+------+-------------------- 2013-10-27 10:00 | 1 | 42 | 2 2013-10-27 11:00 | 1 | 42 | 1 2013-10-27 12:00 | NULL | 42 | 2 2013-10-27 13:00 | NULL | 42 | 1 2013-10-27 14:00 | 2 | 42 | 28 2013-10-27 15:00 | 2 | 42 | 27 ... | ... | ... | ... 2013-10-28 17:00 | 2 | 42 | 1 2013-10-28 18:00 | NULL | 42 | 39 2013-10-28 19:00 | NULL | 42 | 38 Then your query just becomes: SELECT * FROM slots WHERE slot_start_time >= '2013-10-27 12:00' AND remaining_duration >= 24 AND booking IS NULL ORDER BY slot_start_time ASC LIMIT 1 A: OK this isn't pretty in MySQL. That's because we have to fake rownum values in subqueries. The basic approach is to join the appropriate subset of the booking table to itself offset by one. Here's the basic list of reservations for item 42, ordered by reservation time. We can't order by booking_id, because those aren't guaranteed to be in order of reservation time. (You're trying to insert a new reservation between two existing ones, eh?) http://sqlfiddle.com/#!2/62383/9/0 SELECT @aserial := @aserial+1 AS rownum, booking.* FROM booking, (SELECT @aserial:= 0) AS q WHERE item = 42 ORDER BY startdate, enddate Here is that subset joined to itself. The trick is the a.rownum+1 = b.rownum, which joins each row to the one that comes right after it in the booking table subset. http://sqlfiddle.com/#!2/62383/8/0 SELECT a.booking_id, a.startdate asta, a.enddate aend, b.startdate bsta, b.enddate bend FROM ( SELECT @aserial := @aserial+1 AS rownum, booking.* FROM booking, (SELECT @aserial:= 0) AS q WHERE item = 42 ORDER BY startdate, enddate ) AS a JOIN ( SELECT @bserial := @bserial+1 AS rownum, booking.* FROM booking, (SELECT @bserial:= 0) AS q WHERE item = 42 ORDER BY startdate, enddate ) AS b ON a.rownum+1 = b.rownum Here it is again, showing each reservation (except the last one) and the number of hours following it. http://sqlfiddle.com/#!2/62383/15/0 SELECT a.booking_id, a.startdate, a.enddate, TIMESTAMPDIFF(HOUR, a.enddate, b.startdate) gaphours FROM ( SELECT @aserial := @aserial+1 AS rownum, booking.* FROM booking, (SELECT @aserial:= 0) AS q WHERE item = 42 ORDER BY startdate, enddate ) AS a JOIN ( SELECT @bserial := @bserial+1 AS rownum, booking.* FROM booking, (SELECT @bserial:= 0) AS q WHERE item = 42 ORDER BY startdate, enddate ) AS b ON a.rownum+1 = b.rownum So, if you're looking for the starting time and ending time of the earliest twelve-hour slot you can use that result set to do this: http://sqlfiddle.com/#!2/62383/18/0 SELECT MIN(enddate) startdate, MIN(enddate) + INTERVAL 12 HOUR as enddate FROM ( SELECT a.booking_id, a.startdate, a.enddate, TIMESTAMPDIFF(HOUR, a.enddate, b.startdate) gaphours FROM ( SELECT @aserial := @aserial+1 AS rownum, booking.* FROM booking, (SELECT @aserial:= 0) AS q WHERE item = 42 ORDER BY startdate, enddate ) AS a JOIN ( SELECT @bserial := @bserial+1 AS rownum, booking.* FROM booking, (SELECT @bserial:= 0) AS q WHERE item = 42 ORDER BY startdate, enddate ) AS b ON a.rownum+1 = b.rownum ) AS gaps WHERE gaphours >= 12 A: here is the query, it will return needed date, obvious condition - there should be some bookings in table, but as I see from question - you do this check: SELECT min(enddate) FROM ( select a.enddate from table4 as a where a.item=42 and DATE_ADD(a.enddate, INTERVAL 1 day) <= ifnull( (select min(b.startdate) from table4 as b where b.startdate>=a.enddate and a.item=b.item), a.enddate) and a.enddate>=now() union all select greatest(ifnull(max(enddate), now()),now()) from table4 ) as q you change change INTERVAL 1 day to INTERVAL ### hour A: If I have understood your requirements correctly, you could try self-JOINing book with itself, to get the "empty" spaces, and then fit. This is MySQL only (I believe it can be adapted to others - certainly PostgreSQL): SELECT book.*, TIMESTAMPDIFF(MINUTE, book.enddate, book.best) AS width FROM ( SELECT book.*, MIN(book1.startdate) AS best FROM book JOIN book AS book1 USING (item) WHERE item = 42 AND book1.startdate >= book.enddate GROUP BY book.booking ) AS book HAVING width > 110 ORDER BY startdate LIMIT 1; In the above example, "110" is the looked-for minimum width in minutes. Same thing, a bit less readable (for me), a SELECT removed (very fast SELECT, so little advantage): SELECT book.*, MIN(book1.startdate) AS best FROM book JOIN book AS book1 ON (book.item = book1.item AND book.item = 42) WHERE book1.startdate >= book.enddate GROUP BY book.booking HAVING TIMESTAMPDIFF(MINUTE, book.enddate, best) > 110 ORDER BY startdate LIMIT 1; In your case, one day is 1440 minutes and SELECT book.*, MIN(book1.startdate) AS best FROM book JOIN book AS book1 ON (book.item = book1.item AND book.item = 42) WHERE book1.startdate >= book.enddate GROUP BY book.booking HAVING TIMESTAMPDIFF(MINUTE, book.enddate, best) >= 1440 ORDER BY startdate LIMIT 1; +---------+------+---------------------+---------------------+---------------------+ | booking | item | startdate | enddate | best | +---------+------+---------------------+---------------------+---------------------+ | 2 | 42 | 2013-10-27 14:00:00 | 2013-10-28 18:00:00 | 2013-10-30 09:00:00 | +---------+------+---------------------+---------------------+---------------------+ 1 row in set (0.00 sec) ...the period returned is 2, i.e., at the end of booking 2, and until "best" which is booking 3, a period of at least 1440 minutes is available. An issue could be that if no periods are available, the query returns nothing -- then you need another query to fetch the farthest enddate. You can do this with an UNION and LIMIT 1 of course, but I think it would be best to only run the 'recovery' query on demand, programmatically (i.e. if empty(query) then new_query...). Also, in the inner WHERE you should add a check for NOW() to avoid dates in the past. If expired bookings are moved to inactive storage, this could be unnecessary.
unknown
d2935
train
Just recreate the accordion when you add new data to it: $("#accordion").append(html).accordion('destroy').accordion(); A: The only critical HTML is the main structure: <div id="accordion"> <h3>Section 1</h3> <div></div> <h3>Section 2</h3> <div></div> </div> You can put anything you want inside the DIV content panels. WHen you add a a new set of h3 and div, destroy and recreate the accordion: var newPanel='<h3>New section</h3><div>New content</div>'; $('#accordion').append(newPanel).accordion('destroy').accordion( /* options */ );
unknown
d2936
train
I just ran into this problem (it's fixed in iOS 5). My solution was to add a 4-point padding to the width: [textField_ sizeToFit]; textField_.frame = CGRectMake(textField_.frame.origin.x, textField_.frame.origin.y, CGRectGetWidth(textField_.frame) + 4, CGRectGetHeight(textField_.frame)); A bit tedious but got the job done for me.
unknown
d2937
train
Once you inflate PageFragment's layout you need to get a reference of the TextView so you can display the position on it via the Bundle you are passing using setArguments(). Use your view variable inside onCreateView() to get a reference of the TextView. (i.e. view.findViewById()). Then use getArguments() in your PageFragment to retrieve the Bundle with that has position, and set the TextView to that value. A: this is a good example for what you want. A: Just create a function in your page fragment class to configure elements and modify onCreateView to attach childs. public class PageFragment extends Fragment { TextView tv1 ; // ... @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = getActivity().getLayoutInflater().inflate(R.layout.fragment_page, null); /// Attach your childs tv1 = view.findViewById(R.id.textView1); return view; } public void configure(int position) { tv1 .setText("This is "+ position); } } Then just call the function configure in getItem function @Override public Fragment getItem(int position) { PageFragment fr = new PageFragment(); fr.configure(position + 1); return fr; }
unknown
d2938
train
No, the 32-bit OS can't make 64-bit UEFI calls. I hesitate to say anything can't be done in software, but this is about as close to impossible as you can get. You can't make 64-bit UEFI calls without switching to 64-bit mode, which would be extremely difficult to do the after the 32-bit OS boots. One possible approach would be to change GRUB to read the variables and save them and provide a 32-bit interface for the OS to retrieve them. Since GRUB doesn't generally persist after the OS boots, this would be a significant change. A: I was able to boot a 32-bit Ubuntu on 64-bit EFI machine with help of package grub-efi-amd64-signed, installed via chroot. See the HowTo here (in German): https://wiki.ubuntuusers.de/Howto/Installation_von_32-Bit_Ubuntu_auf_EFI-System/ Anyway I sometimes have trouble, when GRUB gets updated.
unknown
d2939
train
A common reason you have NoneType where you don't expect it is the assignment of an in-place operation on a mutable object. For example: mylist = mylist.sort() The sort() method of a list sorts the list in-place, that is, mylist is modified. But the actual return value of the method is None and not the list sorted. So you've just assigned None to mylist. If you next try to do, say, mylist.append(1), Python will give you this error. A: You can try to create a function in the second script which takes your data as an argument and call it in the first script. from script2 import view class Window2: def __init__(self, data): # init should take self, it is an instance of class self.data = data window_2 = Window2('some data') # creating instance view(window_2.data) # call function from script2 # script2 def view(data): print(data) # > 'some data'
unknown
d2940
train
First of all, the literal answer: if a subquery you use as an expression returns more than one row, modify it so that it returns at most one row. I'm going to take a wild guess and say that you want to find workers that earn less than the average salary. The solution would be: SELECT -- add DISTINCT if needed w.cname FROM works w WHERE w.salary < (SELECT AVG(w2.salary) FROM works w2) Note that the subquery here (SELECT AVG(w2.salary) FROM works w2) will always return a single value, since there is no GROUP BY clause. (Also, since this instance of the works table has nothing to do with the other one, because you're getting something completely unrelated out of it, it's good practice (and required by some DBMS or another) to use a different table alias — hence w2.) Note that, since you can reference your original table in subqueries, you can use the data in the outer query's FROM clause to filter the subquery. For instance, if you want to return every instance of people earning less than their own average salary: SELECT DISTINCT w.cname, w.salary FROM works w WHERE w.salary < (SELECT AVG(w2.salary) FROM works w2 WHERE w2.cname = w.cname) Note how the different table aliases (w and w2) matter here. Also, this subquery still returns only one row, because the filter by name is in the WHERE clause — it returns the average of all salary rows matching that particular name, not the average of all salary rows grouped by name. The former is one value (for one particular person), the latter is one value per person (and thus an error).
unknown
d2941
train
Maybe $_POST['ProductAccountName'] is not set, so following code $ProductAccountName = $_POST['ProductAccountName']; $NewDirectory = "/var/www/html/ProductVideos/" . $ProductAccountName; causes $ProductAccountName to be empty. Make sure you add <input type="text" name="ProductAccountName" value="[email protected]"> inside your HTML form. A: I think there is no / after $ProductAccountName in creating $NewDirectory variable. Try rewerite location like this: $location = $NewDirectory . '/' . $file_name;
unknown
d2942
train
You can do something like this. //Display LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext()); linearLayoutManager.setStackFromEnd(true); linearLayoutManager.setReverseLayout(true); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(firebaseRecyclerAdapter); firebaseRecyclerAdapter.startListening(); firebaseRecyclerAdapter.notifyDataSetChanged();
unknown
d2943
train
you might move your System.loadLibrary(Core.NATIVE_LIBRARY_NAME); to a static block so the dll gets loaded before any instruction of opencv .
unknown
d2944
train
The following would do the trick: class TrackOrder extends StatefulWidget { const TrackOrder({Key? key}) : super(key: key); @override State<TrackOrder> createState() => _TrackOrderState(); } class _TrackOrderState extends State<TrackOrder> { static const darkGreyColor = Colors.grey; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Center(child: Text('Track Order')), ), body: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ const SizedBox(height: 50), const Text( 'orderID', style: TextStyle( color: darkGreyColor, fontSize: 18, fontWeight: FontWeight.bold), ), const SizedBox(height: 50), const Text('Sat, 12 Mar 2022', style: TextStyle( color: darkGreyColor, fontSize: 18, fontWeight: FontWeight.bold)), const SizedBox( height: 15, ), const Text('Estimated Time: 07 Days', style: TextStyle(fontSize: 23, fontWeight: FontWeight.bold)), const SizedBox(height: 30), SizedBox( width: 200, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const OrderStatusBar(title: "Received", status: true), dottedLine(), const OrderStatusBar(title: "Shipped", status: false), dottedLine(), const OrderStatusBar(title: "Delivering", status: false), dottedLine(), const OrderStatusBar(title: "Delivered", status: false), ], ), ), const SizedBox( height: 40, ), const Center( child: Text('deliveryAddress.address', style: TextStyle( color: Colors.grey, fontSize: 18, fontWeight: FontWeight.bold)), ), Padding( padding: const EdgeInsets.all( 18.0, ), child: ElevatedButton(child: const Text("Done"), onPressed: () => {}), ), Padding( padding: const EdgeInsets.only(top: 18.0), child: GestureDetector( child: const Text( 'Back to Home', style: TextStyle( // color: mainColor, fontSize: 23, fontWeight: FontWeight.bold), ), onTap: () => {}, ), ) ], ), ); } } class OrderStatusBar extends StatefulWidget { const OrderStatusBar({Key? key, required this.title, required this.status}) : super(key: key); final String title; final bool status; @override State<OrderStatusBar> createState() => _OrderStatusBarState(); } class _OrderStatusBarState extends State<OrderStatusBar> { @override Widget build(BuildContext context) { return Row( children: [ widget.status ? dottedCircleWithCheckMark() : dottedCircle(), const SizedBox(width: 30), Text( widget.title, style: TextStyle( fontSize: 20, fontWeight: widget.status ? FontWeight.bold : null, ), ), ], ); } } const size = 25.0; const strokeWidth = 1.0; const checkedColor = Color.fromRGBO(232, 113, 65, 1); Widget dottedLine() { return const Padding( padding: EdgeInsets.only(left: 27 / 2), child: SizedBox( height: size, child: DottedLine( dashColor: Colors.black, direction: Axis.vertical, lineLength: size, lineThickness: strokeWidth, dashLength: 5, dashGapLength: 5, ), ), ); } dottedCircle() { return DottedBorder( borderType: BorderType.Circle, dashPattern: const [5, 5], child: Container( height: size, width: size, decoration: const BoxDecoration(shape: BoxShape.circle), )); } dottedCircleWithCheckMark() { return Container( height: size + strokeWidth * 2, width: size + strokeWidth * 2, decoration: const BoxDecoration( shape: BoxShape.circle, color: checkedColor, ), child: const Icon( Icons.check, color: Colors.white, size: size / 4 * 3, ), ); }
unknown
d2945
train
Mark them invalid by UIInput#setValid(), passing false. input1.setValid(false); input2.setValid(false); input3.setValid(false); The borders are specific to PrimeFaces <p:inputText>, so you don't need to add any CSS boilerplate as suggested by the other answerer. Note that this can also be achieved by OmniFaces <o:validateAll> tag without the need to homegrow a custom validator.
unknown
d2946
train
$('#myddl option[value=2]').text('Two'); A: var myDLLField = $('select[id="myddl"]'); myDLLField.find('option[value="2"]').text("Two"); or, in one line... $('select[id="myddl"]').find('option[value="2"]').text("Two");
unknown
d2947
train
use images in drawable-mdpi and drawable-hdpi for different height set use dimension in values res/values-mdpi/dimen.xml res/values-hdpi/dimen.xml dp, dip will change according to the density. use px in different dimension
unknown
d2948
train
File is blocked when it is accessed. Not every file. But you could check whether the file is open by another application. If the file is not open - this should tell you, that it has downloaded completely.
unknown
d2949
train
You have a tableRowRoot rule, but I don't see you set the className in the TableRow to apply the custom styles: <TableRow key={event.id} className={classes.tableRowRoot} /* <------- Add this */> From the docs, you can also use withStyles to create a styled component from the original one: const StyledTableRow = withStyles((theme) => ({ root: { '&:nth-of-type(odd)': { backgroundColor: theme.palette.action.hover, }, }, }))(TableRow); <TableBody> {pendingEvents.map((event) => ( <StyledTableRow key={event.id}> {...} </StyledTableRow> ))} </TableBody>
unknown
d2950
train
You can set your ng-model to be an object( which represent your user/supervisor entity) instead of just the name. So add a new property to your scope called supervisor. myApp.controller('mainController', function ($scope, $http) { $scope.supervisor=null; //your existing code goes here }; Now in your view, you can use the name property to display the selected supervisor name. <div>{{supervisor.supervisorfName}} {{supervisor.supervisorlName}}</div> <select ng-options="option.supervisorfName for option in supervisors" ng-model="supervisor"></select> When you have to save, you can get the id of the selected supervisor from the id property like $scope.supervisor.supervisorId And to show both first name and last name in the option, you simply need to concatenate <select ng-options="option.supervisorfName+' ' +option.supervisorlName for option in supervisors" ng-model="supervisor"></select>
unknown
d2951
train
Prakash - we have seen a number of issues where spiky producer patterns see batch timeout. The problem here is that the producer has two TCP connections that can go idle for > 4 mins - at that point, Azure load balancers close out the idle connections. The Kafka client is unaware that the connections have been closed so it attempts to send a batch on a dead connection, which times out, at which point retry kicks in. * *Set connections.max.idle.ms to < 4mins – this allows Kafka client’s network client layer to gracefully handle connection close for the producer’s message-sending TCP connection *Set metadata.max.age.ms to < 4mins – this is effectively a keep-alive for the producer metadata TCP connection Feel free to reach out to the EH product team on Github, we are fairly good about responding to issues - https://github.com/Azure/azure-event-hubs-for-kafka A: This exception indicates you are queueing records at a faster rate than they can be sent. Once a record is added a batch, there is a time limit for sending that batch to ensure it has been sent within a specified duration. This is controlled by the Producer configuration parameter, request.timeout.ms. If the batch has been queued longer than the timeout limit, the exception will be thrown. Records in that batch will be removed from the send queue. Please check the below for similar issue, this might help better. Kafka producer TimeoutException: Expiring 1 record(s) you can also check this link when-does-the-apache-kafka-client-throw-a-batch-expired-exception/34794261#34794261 for reason more details about batch expired exception. Also implement proper retry policy. Note this does not account any network issues scanner side. With network issues you will not be able to send to either hub. Hope it helps.
unknown
d2952
train
The MultipartRequest, is not supported out of the box. You can use the following code to enable the support. static{ SpringDocUtils.getConfig().addFileType(MultipartRequest.class); } This support will be added for the future release.
unknown
d2953
train
It seems that its just a minor mistake that you have to move your SELECT query of categories within the while loop of $select_posts. Since, in given code, only last record will be passed to next while loop to fetch categories and eventually printed to browser. So, correct code should look like this. { while ($row = mysqli_fetch_assoc($select_posts)) { $post_id = $row['post_id']; $post_author = $row['post_author']; $post_title = $row['post_title']; $post_category_id = $row['post_category_id']; $post_status = $row['post_status']; $post_image = $row['post_image']; $post_tags = $row['post_tags']; $post_comment_count = $row['post_comment_count']; $post_date = $row['post_date']; echo ""; echo "$post_id"; echo "$post_author"; echo "$post_title"; $query = "SELECT * FROM categories WHERE cat_id = {$post_category_id} "; $select_categories_id = mysqli_query($connection, $query); while ($row = mysqli_fetch_assoc($select_categories_id)) { $cat_id = $row['cat_id']; $cat_title = $row['cat_title']; echo "{$cat_title}"; } echo "$post_status"; echo ""; echo "$post_tags"; echo "$post_comment_count"; echo "$post_date"; echo "Edit"; echo "Delete"; echo ""; } } A: Use it like this: Print data inside while loop <?php $query = "SELECT * FROM posts"; $select_posts = mysqli_query($connection, $query); /* check there are records in recordset */ if( mysqli_num_rows( $select_posts ) > 0 ) { while ($row = mysqli_fetch_array($select_posts)) { $post_id = $row['post_id']; $post_author = $row['post_author']; $post_title = $row['post_title']; $post_category_id = $row['post_category_id']; $post_status = $row['post_status']; $post_image = $row['post_image']; $post_tags = $row['post_tags']; $post_comment_count = $row['post_comment_count']; $post_date = $row['post_date']; echo "<tr>"; echo "<td>$post_id</td>"; echo "<td>$post_author</td>"; echo "<td>$post_title</td>"; $query = "SELECT * FROM categories WHERE cat_id = {$post_category_id} "; $select_categories_id = mysqli_query($connection, $query); while ($row = mysqli_fetch_array($select_categories_id)) { $cat_id = $row['cat_id']; $cat_title = $row['cat_title']; echo "<td>{$cat_title}</td>"; } // End of Category Loop echo "<td>$post_status</td>"; echo "<td><img src='../images/$post_image' width='150' height='50'></td>"; echo "<td>$post_tags</td>"; echo "<td>$post_comment_count</td>"; echo "<td>$post_date</td>"; echo "<td><a href='posts.php?source=edit_post&p_id={$post_id}'>Edit</a></td>"; echo "<td><a href='posts.php?delete={$post_id}'>Delete</a></td>"; echo "</tr>"; } // End of Posts Loop } // End of IF ?>
unknown
d2954
train
There is no way to selectively dump only new rows, because PostgreSQL has no way to know which ones are new. But you can avoid deleting all the data upon restore. For that, upgrade to PostgreSQL v12 or better and use pg_dump with the options --on-conflict-do-nothing and --rows-per-insert=100. Then all the rows that already exist at the destination will be skipped. You should upgrade anyway, 9.5 will go out of support this year.
unknown
d2955
train
@ORM\JoinColumn(name = "id_commessa", name = "id") is wrong. there is 2 times name field
unknown
d2956
train
This is usually to be declared in the view side. Even though you didn't mention anything about it (which is bad; you should always mention in the question which JSF implementation and component libraries exactly you're using and for sure not overgeneralize everything as "standard JSF"), the listener method code which you've there is recognizeable as the one specific to PrimeFaces <p:fileUpload>. In that case, you should actually be using component's own update attribute which should reference the (relative) client ID of the component you'd like to update on complete of the ajax request. <p:fileUpload ... update="text" /> ... <h:outputText id="text" value="#{bean.text}" /> That's all. You'd in this particular example just have to assign the filename to the text property. See also: * *<p:fileUpload> VDL documentation — lists all available attribtues.
unknown
d2957
train
AND has higher precedence than OR, so it's equivalent to: WHERE (deleted_by <> :user AND deleted_by <> :nula) OR (deleted_by IS NULL AND IDmessage = :ID) I recommend using explicit parentheses whenever you have a mix of AND and OR, because the results are not always intuitive.
unknown
d2958
train
The classic way to do this is to create a simple shell script like chromium-custom.sh: #!/bin/sh chromium --disable-pinch --disable-sync "$@" Then chmod +x chromium-custom.sh ./chromium-custom.sh --extra-parameter http://URL
unknown
d2959
train
forecastDf['date'] = forecastDf['dateLocation'].str.partition(';')[0] forecastDf['Lat'] = forecastDf['dateLocation'].str.partition(';')[2] forecastDf['Lon'] = forecastDf['dateLocation'].str.partition(';')[4] Let me know if this works for you! A: First make sure the column is string dtype forecastDD['dateLocation'] = forecastDD['dateLocation'].astype('str') Then you can use this to split in dask splitColumns = client.persist(forecastDD['dateLocation'].str.split(';',2)) You can then index the columns in the new dataframe splitColumns and add them back to the original data frame. forecastDD = forecastDD.assign(Lat=splitColumns.apply(lambda x: x[0], meta=('Lat', 'f8')), Lon=splitColumns.apply(lambda x: x[1], meta=('Lat', 'f8')), date=splitColumns.apply(lambda x: x[2], meta=('Lat', np.dtype(str)))) Unfortunately I couldn't figure out how to do it without calling compute and creating the temp dataframe.
unknown
d2960
train
I was originally planning on using FreeRTOS, but it doesn't seem to support that particular processor Actually, FreeRTOS support all Cortex-M3 and Cortex-M4 processors with GCC, IAR and Keil. Just because there is not a specific pre-configured demo project for it does not mean it is not supported. FreeRTOS does not rely on anything outside of the Cortex-M core, because the timer generation and interrupt controller are part of the core itself. You can take an existing official LPCxx IAR demo project from the FreeRTOS distribution, and simply re-target it by setting up the right linker script for the chip. Any demo tasks that make use of IO that might be different on your particular hardware (ports used for LED outputs, etc.) can be modified to be correct for your IO port assignment, or just removed. For example, Atollic have 55 FreeRTOS projects running on 55 different hardware platforms, all that actually use the same C source files - only the start up files and linker scripts are different. A: I have specifically evaluated FreeRTOS, embOS and Keil RTX on Cortex-M3. Of the three FreeRTOS certainly had the slowest context switch times, while RTX had the fastest, but the range was 5us to 15us so probably not critical for all but the most hard real-time applications (it made a difference in my case however). RTX is of course Keil specific and you are using IAR, it's API is less sophisticated than embOS, and at the time it had a few bugs on CM3 and did not fully support the NVIC interrupt priority scheme. I believe these issues are resolved. FreeRTOS is perhaps the most unconventional of the three in terms of API and architecture, having extensively used embOS and VxWorks and similar "traditional" RTOS systems I was not entirely comfortable with it. embOS works well with IAR and its debugger, with a level of RTOS aware debug that is useful. The licensing is per-developer/per-processor/per-toolchain, but otherwise royalty free and can be used over many projects using the same architecture and toolchain. The support from Segger is excellent, as is the documentation, and I would suggest that for a commercial product with sufficient volumes and margin it would be well worth it. You might also consider eCos - this is a more comprehensive solution offering support for USB, netwoking, filesystems and more as well as scheduling and IPC. There is a port for LPC1766 that could probably be ported relatively easy. Most likely however you would have to use the GNU toolchain for development which may have a bearing on your use of existing tools such as JTAG debuggers. A: I know that Keil mVision IDE have RTOS for NXP chips, it works on 24xx 100%. But this RTOS is not opens source, and only IDE owners can use it. A: You can try an get RTAI compiled with any linux kernel. Might take some work but should be doable (and free) A: Linux, it its uClinux form, runs just fine on the LPC1788. Take a look at this video, for instance: http://www.youtube.com/watch?v=VTemb8P1doI As mentioned in the comments above, internal SRAM of the LPC1788 is not enough to run Linux, however LPC1788 provides an SDRAM interface making it possible to add external RAM. A: The Unison RTOS offers the same POSIX calls as Linux including a complete set of I/O calls that you will find missing from things like freertos. The business model is free for DIY and royalty based for commercial products. It tends to be a small fraction of the competitors prices at $999 getting started with serial I/O and a file system. www.rowebots.com for details. A: I'm working at a RTOS if you want you can find at github http://www.github.com/geppo12/YasminOS (path case sensitive) Is a simple scheduler I'm going to introduce task priority as soon as possible. I create YasminOS because other OS are too complex or too expensive Actually I'm developing YasminOS with only one vision: simplicity There are many application that not require a extreme powerful OS, but just as simple scheduler. Actually it's tested on Spansion FM3 architecture or NXP lpc800 (yes work also for cortex m0) in near future I'll test it on nxp 4088....
unknown
d2961
train
I'm reluctant to do all your homework for you. However, given that the code you were given is not valid Elixir, I'll provide you a partial solution. I've implemented the :goto and :x handlers. You should be able to figure out how to write the :moveDelta and :y handlers. defmodule Obj do def call(obj, msg) do send obj, { self(), msg } receive do response -> response end end end defmodule Pawn do def new(), do: spawn(__MODULE__,:init, [] ) def init(), do: loop({0,0}) def loop({x, y} = state) do receive do {pid, {:goto, new_x, new_y}} -> send pid, {new_x, new_y} {new_x, new_y} {pid, {:moveDelta, dx, dy}} -> state = {x + dx, y + dy} send pid, state state {pid, :x} -> send pid, x state {pid, :y} -> send pid, y state end |> loop end end p1=Pawn.new() Obj.call(p1,{:goto, 1, 2}) 1=Obj.call(p1, :x) 2=Obj.call(p1, :y) Obj.call(p1,{:moveDelta , 3, 1}) 4=Obj.call(p1, :x ) 3=Obj.call(p1 ,:y ) The code runs. Here is the output of the test cases you provided (after I fixed the syntax issues: iex(5)> p1=Pawn.new() #PID<0.350.0> iex(6)> Obj.call(p1,{:goto, 1, 2}) {1, 2} iex(7)> 1=Obj.call(p1, :x) 1 iex(8)> 2=Obj.call(p1, :y) 2 iex(9)> Obj.call(p1,{:moveDelta , 3, 1}) {4, 3} iex(10)> 4=Obj.call(p1, :x ) 4 iex(11)> 3=Obj.call(p1 ,:y ) 3 iex(12)> Also, I fixed syntax issues in the given problem.
unknown
d2962
train
Updated: ofType accept action creator, so you can using it directly: @Effect({ dispatch: false }) addTab$ = this.actions$.pipe( ofType( TabsActions.addTab, TabsActions.searchCompanyTab, TabsActions.searchCardholderTab ), withLatestFrom(this.store.pipe(select(getTabs))), tap(([action, tabs]) => { // this object will contain `type` and action payload const {type, ...payload} = action; // some logic console.log(payload) }) ); ============== Old answer also work: because you're using action creator, which return a function, so you can access action type through type property like this: @Effect({ dispatch: false }) addTab$ = this.actions$.pipe( ofType( TabsActions.addTab.type, TabsActions.searchCompanyTab.type, TabsActions.searchCardholderTab.type ), withLatestFrom(this.store.pipe(select(getTabs))), tap(([action, tabs]) => { // this object will contain `type` and action payload const {type, ...payload} = action; // some logic console.log(payload) }) ); demo: https://stackblitz.com/edit/angular-3t2fmx?file=src%2Fapp%2Fstore.ts
unknown
d2963
train
I figured out why the registers were getting the wrong values (I was sending them the memory locations with irmovl instead of the values with mrmovl) and in a similar vein, how to assign the value to the global variable sum (rmmovl %eax, sum). It was a matter of addressing the content as opposed to location
unknown
d2964
train
This goes from 8.5/16 first bullet to 8.5.4 list-initialization and from 8.5.4/3 third bullet to 8.5.1 aggregate initialization and then 8.5.1/4 says An array of unknown size initialized with a brace-enclosed initializer-list containing n initializer-clauses, where shall be greater than zero, is defined as having elements The only difference if the object is an array between = { ... } and { ... } is that the first is called copy-list-initialization and the second is called direct-list-initialization, so both are kinds of list-initialization. The elements of the array are copy-initialized from the elements of the initializer list in both cases. Notice that there is a subtle difference between those forms if the array has a size and the list is empty, in which case 8.5.4 second bullet applies: struct A { explicit A(); }; A a[1]{}; // OK: explicit constructor can be used by direct initialization A a[1] = {}; // ill-formed: copy initialization cannot use explicit constructor This difference does not apply to lists that have content in which case third bullet applies again, though struct A { explicit A(int); }; A a[1]{0}; // ill-formed: elements are copy initialized by 8.5.1 A a[1] = {0}; // ill-formed: same. The FCD changed this compared to the previous draft, and initialization with an empty initializer list now always works even with explicit default constructors. This is because the FCD states that the elements are value-initialized, and value initialization doesn't care about explicitness since it doesn't do overload resolution on default constructors (it couldn't figure out better or worse matches anyway). The previous draft used normal overload resolution on the constructors and thus rejected explicit default constructors during copy initialization. This defect report did that change. A: Yes, it is valid, and has been for decades, even in C. The size is simply set to the number of elements supplied. I don't know the reference, unfortunately. (Added bonus...) If you need the number of elements use sizeof(x)/sizeof(*x). It's safer than hard-coding a constant that may become invalid if you add or remove entries. EDIT: As pointed out in the comments, the code in question is missing an = (a fact that I missed), without which it isn't valid in any current standard of C or C++.
unknown
d2965
train
Here's a working example for your problem var settimernow="off"; var stop; function change_timer(){ if(settimernow==="on"){ clearInterval(stop); settimernow="off"; } else{ stop=setInterval('change()',2000); settimernow="on"; } } function change(){ var img=document.getElementById('browser'); if(img.src==="https://www.w3schools.com/css/trolltunga.jpg") { img.src="http://hdwallpaperfun.com/wp-content/uploads/2015/07/Big-Waves-Fantasy-Image-HD.jpg"; } else { img.src="https://www.w3schools.com/css/trolltunga.jpg"; } } <body> <img src="http://hdwallpaperfun.com/wp-content/uploads/2015/07/Big-Waves-Fantasy-Image-HD.jpg" alt='browser' id='browser' width="100px" height="100px" onclick='change_timer();'> <p>Click on image to set timer on or off</p> </body> A: This line var stop=setInterval('change()',2000); ... creates a new, locally scoped variable stop instead of assigning to the one you created in the outer scope, so when you later run clearInterval(stop) (in a new 'instance' of the function with a new scope) you're not clearing the interval you created previously. The same goes for the settimer variable. Simply remove the var keyword from those lines in the change_timer() function and it will work as intended.
unknown
d2966
train
The way you've structured your slider with JavaScript and CSS has a few different problems, I don't think there's any easy fix for what you're putting together here. * *you're animating the slides in a way that's problematic from a CSS point of view - the should be floated inline *and you should be animating one main container rather than animating the elements inside of their separate containers. The best advice I could give you is to use a different approach. I see you're using the jQuery UI library for the animations - I don't think that's the best fit for what you're trying to achieve here - those plugins are better suited to effects and require more work to adapt and re-skin. There's lots of better suited, existing plugins out there specifically for slideshows like this and work well out of the box: http://jquerytools.org/demos/scrollable/index.html http://www.woothemes.com/flexslider/ http://jquery.malsup.com/cycle/
unknown
d2967
train
You could try DOM Mutation Events, which are dispatched eg. when a property of an element is changed. There are plugins for jQuery, which mimes the behavior of event mutation (although I haven't tried any of those). But feel free to google about mutation events in jQuery and that should probably help you. A: You can do it with http://jqueryui.com/demos/switchClass/ (i made a similar question few weeks a go can a .classA styles to .classB styles be animated easly? )
unknown
d2968
train
Try this: RewriteRule ^([a-zA-Z0-9\.]+)$ view.php?Id=$1 Basically what I did is I added \. with your pattern. This will make sure your regex matches any letter (small/caps), decimal numbers and periods (.). Hope this helps :) A: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-zA-Z0-9\.]+)$ view.php?id=$1 [QSA,L] You need RewriteCond %{REQUEST_FILENAME} !-f before the RewriteRule line to tell the server that the RewriteRule written below to be executed if the input passed in the URL is not an actual file. Because server searches for a file matching the input you pass in the URL and also it won't work in case you pass my.book in the URL since web server recognizes . as prefix for extension like .php or .html or like so and thereby it results in Not Found error if there is no file named my.book exists. So, you also need to escape . in the URL. To allow .'s in the input, you need to add . with escape sequence \ in the character class group like ^([a-zA-Z0-9\.]+)$. Note, allowing this can result in escaping the extension in the URL, that is, passing view.php in the URL won't navigate to the actual file. Rather, it will be considered as a value in the query string.
unknown
d2969
train
As other people put here @Ignore ignores a test. If you want something conditional that look at the junit assumptions. http://junit.sourceforge.net/javadoc/org/junit/Assume.html This works by looking at a condition and only proceeding to run the test if that condition is satisfied. If the condition is false the test is effectively "ignored". If you put this in a helper class and have it called from a number of your tests you can effectively use it in the way you want. Hope that helps. A: You can use the @Ignore annotation which you can add to a single test or test class to deactivate it. If you need something conditional, you will have to create a custom test runner that you can register using @RunWith(YourCustomTestRunner.class) You could use that to define a custom annotation which uses expression language or references a system property to check whether a test should be run. But such a beast doesn't exist out of the box. A: Hard to know if it is the @Ignore annotation that you are looking for, or if you actually want to turn off certain JUnit tests conditionally. Turning off testcases conditionally is done using Assume. You can read about assumptions in the release notes for junit 4.5 There's also a rather good thread here on stack over flow: Conditionally ignoring tests in JUnit 4 A: If you use JUnit 4.x, just use @Ignore. See here
unknown
d2970
train
Drag the Number Formatter (found in the object library) object onto the field/label. Change the behavior (be sure your in the attributes inspector for the number formatter) to 'OS X 10.4+ Custom' (that's what it was in Xcode 4.5.2). In the 'Integer Digits' field, change the minimum to 1 and leave the maximum whatever you need. For the 'Fraction Digits' fields set the minimum and maximum to 2. Near the top of the field, stick a dollar sign in front of the 'Format (+)' and '(-)' fields. Check the group separator box then change the primary and secondary grouping fields to 3. A: The solution of your problem is NSNumberFormatter Some code to get you started: NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; NSLog(@"%@", [currencyFormatter stringFromNumber:[NSNumber numberWithInt:10395209]]); [currencyFormatter release];
unknown
d2971
train
Idea is aggregate minimal and maximal values per days, so possible get max and min by max and min levels in df1 and last subtract to new df2: df['Timestamp'] = pd.to_datetime(df['Timestamp']) cols = ['Spot DK1','Spot DK2','Ubalance DK1','Ubalance DK2'] df1 = (df.set_index('Timestamp')[cols] .groupby(pd.Grouper(freq='D', level='Timestamp')) .agg(['min','max'])) s1 = df1.xs('max', level=1, axis=1).max(axis=1) s2 = df1.xs('min', level=1, axis=1).min(axis=1) df2 = s1.sub(s2).rename_axis('Day').reset_index(name='Max diff') print (df2) Day Max diff 0 2020-01-01 00:00:00+01:00 13.00 1 2020-01-02 00:00:00+01:00 31.72 2 2020-01-03 00:00:00+01:00 8.95 Details: print (df1) Spot DK1 Spot DK2 Ubalance DK1 \ min max min max min max Timestamp 2020-01-01 00:00:00+01:00 30.00 33.42 30.00 33.42 21.00 34.0 2020-01-02 00:00:00+01:00 24.99 33.38 24.99 46.72 15.00 27.5 2020-01-03 00:00:00+01:00 9.98 18.93 9.98 18.93 9.98 15.0 Ubalance DK2 min max Timestamp 2020-01-01 00:00:00+01:00 21.00 34.00 2020-01-02 00:00:00+01:00 15.00 46.05 2020-01-03 00:00:00+01:00 9.98 15.00
unknown
d2972
train
pd.Series's index can be the x axis, and it's values show as y axis . alist = [[1577836800000, 7195.153895430029],[1577923200000, 7193.7546679601],[1609459200000, 29022.41839530417]] df = pd.DataFrame(alist, columns=['ts', 'price']) df['date'] = pd.to_datetime(df['ts'], unit='ms') obj = df.set_index('date')['price'] obj.plot()
unknown
d2973
train
Deleted and recreated the service, setting all the same settings made it work again. A: I had same issue with my UWP. But in my case I had issue with self signed certificate. When I set the AppxPackageSigningEnabled property to True (in .csproj) then notifications stopped working and I got "The token obtained from the Token Provider is wrong" (Test send from Azure Portal). The certificate must have same issuer as Publisher in Identity element in .appxmanifest file.
unknown
d2974
train
To complete the answer of @Thomas Matthews but why does it matter ? does << write differently that .write in binary files ? Out of windows you will not see a difference, under windows the \n are saved/read unchanged if the file open in binary mode, else a writting \n produces \r\n and reading \c\n returns \n. It like the difference between "r"/"rb" and "w"/"wb" for fopen. You can mix the use of the operator <</>> and read/write in binary mode or not but you have to take care of the separators, for instance : #include <iostream> #include <fstream> using namespace std; int main() { int AccountNumber = 123; { ofstream bin("bin",ios::binary); bin << AccountNumber << '\n'; // a \n to finish the number allowing to read it later bin.write((char *) &AccountNumber, sizeof(AccountNumber)); } { ofstream txt("txt"); txt << AccountNumber << '\n'; txt.write((char *) &AccountNumber, sizeof(AccountNumber)); } { ifstream bin("bin",ios::binary); AccountNumber = 0; bin >> AccountNumber; cout << AccountNumber << endl; // I have to read the \n with read() because >> bypass it. // Supposing I written '@' rather than '\n' `bin >> c;` can be used char c; bin.read(&c, 1); cout << (int) c << endl; AccountNumber = 0; bin.read((char *) &AccountNumber, sizeof(AccountNumber)); cout << AccountNumber << endl; } return 0; } Compilation and execution (out of Windows) : pi@raspberrypi:/tmp $ g++ -pedantic -Wextra -Wall f.cc pi@raspberrypi:/tmp $ ./a.out 123 10 123 pi@raspberrypi:/tmp $ cmp txt bin pi@raspberrypi:/tmp $ I am not under Windows so to use the binary mode or not changes nothing, the two files are identical A: For writing binary files, use std::ostream::write() method, not operator<<: FileCreator.write((char *) &AccountNumber, sizeof(AccountNumber)); The cast is necessary because there is no overload for writing integers to the stream. Remember, read and write are paired for binary I/O. Edit 1: Fixed length & variable length records Be aware that you need the size of the item when writing and reading. This will work for fixed size/length data items and structures. However, it does not work well with variable length data, such as text. For variable length records, you may want to write the length first followed by the data: static const char hello[] = "Hello"; static const unsigned int data_size(sizeof(hello) - 1); FileCreator.write((char *) &data_size, sizeof(data_size)); FileCreator.write(&hello[0], data_size); In the above example, the "- 1" is there so that the terminating NUL character is not written to the file. You don't need this for binary files, but YMMV (I use the idiom when writing to console and other human readable streams).
unknown
d2975
train
If it is just a few lines as in your example, the manual way is most convenient. Paste everything in one cell, and then split the cell by using a keyboard shortcut for that (Ctr-Shift-Minus) and use another keyboard shortcut (M) to change the types of cells with comments in it to Markdown. If you have lots of material to convert, Jupytext might help. https://github.com/mwouts/jupytext .
unknown
d2976
train
Once you do ref.read(gameBoardStateProvider.notifier).state[index] = 'X' Means changing a single variable. In order to update the UI, you need to provide a new list as State. You can do it like List<String> oldState = ref.read(gameBoardStateProvider); oldState[index] = "X"; ref .read(gameBoardStateProvider.notifier) .update((state) => oldState.toList()); Or List<String> oldState = ref.read(gameBoardStateProvider); oldState[index] = "X"; ref.read(gameBoardStateProvider.notifier).state = oldState.toList(); Why testStateProvider works: Because it contains single int as State where gameBoardStateProvider contains List<String> as State. Just updating single variable doesn't refresh ui on state_provider, You need to update the state to force a refresh More about state_provider You can also check change_notifier_provider A: The reason the ""simple"" StateProvider triggers a rebuild and your actual doesn't is because you aren't reassigning its value. StateProviders works like this: * *StateProvider is just a StateNotifierProvider that uses a simple implementation of a StateNotifier that exposes its get state and set state methods (and an additional update method); *StateNotifier works like this: an actual state update consists of a reassignment. Whenever state gets reassigned it triggers its listeners (just like ChangeNotifier would do). See immutability patterns. This means that, since you're exposing a List<String>, doing something like state[0] = "my new string will NOT trigger rebuilds. Only actions such as state = [... anotherList]; will do. This is desirable, since StateNotifier pushes you to use immutable data, which is can be good pattern in the frontend world. Instead, your int StateProvider will basically always trigger an update, since chances are that when you need to alter its state, you need to reassign its value. For your use case you can do something like: state[i] = 'x'; state = [...state]; This forces a re-assignment, and as such it will trigger the update. Note: since you're implementing a tic-tac-toe, it is maybe desirable to handle mutable data for that grid. Try using a ChangeNotifier, implement some update logic (with notifiyListeners()) and exposing it with a ChangeNotifierProvider. Riverpod actually advises against mutable patterns (i.e. against ChangeNotifiers), but, as there is no silver bullet in Computer Science, your use case might be different. A: Big thanks to both Yeasin and venir for clarifying what it means to reassign the state and the difference between simple and complex types. While keeping the initial StateProvider I've replaced ref.read(gameBoardStateProvider.notifier).state[index] = 'X'; with var dataList = ref.read(gameBoardStateProvider); dataList[index] = 'X'; ref.read(gameBoardStateProvider.notifier).state = [...dataList]; And it works now - the state gets updated and the widget rebuilt. I've also tried the StateNotifier approach and it also works - although it seems more convoluted to me :) I'm pasting the code bellow as it can maybe benefit someone else to see the example. class GameBoardNotifier extends StateNotifier<List<String>> { GameBoardNotifier() : super(List.filled(9, '', growable: false)); void updateBoardItem(String player, int index) { state[index] = player; state = [...state]; } } final gameBoardProvider = StateNotifierProvider<GameBoardNotifier, List<String>>((ref) => GameBoardNotifier()); class Board extends ConsumerWidget { const Board({Key? key}) : super(key: key); @override Widget build(BuildContext context, WidgetRef ref) { final gameBoard = ref.watch(gameBoardProvider); return Expanded( child: Center( child: GridView.builder( itemCount: 9, gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), shrinkWrap: true, itemBuilder: ((BuildContext context, int index) { return InkWell( onTap: () { ref.read(gameBoardProvider.notifier).updateBoardItem('X', index); }, child: Container( decoration: BoxDecoration(border: Border.all(color: Colors.white)), child: Center( child: Text(gameBoard[index]), ), ), ); }), ), ), ); } }
unknown
d2977
train
You're returning from onBindViewHolder() immediately: if (cursor.moveToPosition(position)) { return; } moveToPosition() returns true on success.
unknown
d2978
train
You should get your Name server on Email when you order the Hosting server also you can find the name server on logged in cpanel.
unknown
d2979
train
I think the below is what you need. The below query is a standard ANSI query: SELECT name ,SUM(CASE WHEN status = 'normal' THEN (a + b + c) ELSE 0 END) AS normal ,SUM(CASE WHEN status = 'loan' THEN (a + b + c) ELSE 0 END) AS loan ,status FROM yourTable GROUP BY name, status OUTPUT: name normal loan status bcd 0 150 loan abc 180 0 normal As per your requirement in the comment to update the existing rows: UPDATE yourTable SET normal = CASE WHEN status = 'normal' THEN (a + b + c) ELSE 0 END, loan = CASE WHEN status = 'loan' THEN (a + b + c) ELSE 0 END FROM yourTable Please note that you need to update the table every time you insert new record or to change the original INSERT statement to include those columns as well. A: In single select you can make it. Try SELECT *,(CASE WHEN [status]='normal' THEN [a]+[b]+[c] ELSE null END) as normal,(CASE WHEN [status]='loan' THEN [a]+[b]+[c] ELSE null END) as loan FROM YourTable
unknown
d2980
train
I'm Danny and I work on Cloudinary's Developer Support team. We've got a Node SDK, as well as a jQuery one and a vanilla Javascript one too. If you're just looking to allow users to upload content via your site, the upload widget may be a better solution for you. Would you mind posting a little about your use case? If you let us know the specific problem you're trying to solve, we should be able to help. Feel free to reply here, or if you're providing specific details about your account, you may prefer to raise a ticket via our support center. Looking forward to hearing back from you.
unknown
d2981
train
Why not just do this? jcts = urlib2.urlopen(settings.HOTMAIL_USER_FRIENDS_URI % response['access_token']) contacts = simplejson.loads(jcts)
unknown
d2982
train
Do you have error reporting enabled on your machine? Make sure, that you have these lines in your php.ini file: error_reporting = E_ALL display_errors = on It will help you to find the problem by showing the error. If it doesn't help, try to put this code in your index.php in public directory ini_set('display_errors', 1); Also make sure, that DocumentRoot points to your Zend project public folder. A: Are the memory limits the same on both servers? I have seen similar results using php (with zend, albeit). When I run out of memory, just a blank white screen is the result. A: This error is caused because your server is running version 4 of PHP, change to version 5 and it will work.
unknown
d2983
train
With the FORM protocol on the REQUEST you indicate the callback url, you will be notified on that URL when the payment is completed. SuccessURL The URL of the page/script to which the user is redirected if the transaction is successful. You may attach parameters if you wish. Sage Pay Form will also send an encrypted field containing important information appended to this URL (see below). You also need to specify the FailureURL, in case the transaction fails. A: Sage Pay also allow confirmation of failed and successful transactions via email if you pass a field *VendorEMail=*[email protected] in your transaction posts. This is listed as an optional field in their integration protocol.
unknown
d2984
train
Some kind of solution, but I am disappointed to not be able to make the header selectable. The core of my proposal is using a non visible copy of your headlines to make room for the fixed header and then use z-index property to hide the non usable horizontal scrollbar of the .header-container. .chart { position: relative; /* simulate horizontal scrolling, to remove */ width: 700px; } .chart-wrapper { display: flex; overflow-x: scroll; } .header-container { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow-x: scroll; z-index: -1; } .data-container { display: flex; pointer-events: none; } .header, .header-spacing { flex-shrink: 0; display: flex; flex-direction: column; font-weight: bold; text-align: center; } .header { position: absolute; top: 0; bottom: 0; z-index: 1; background: white; } .header-spacing { visibility: hidden; } .data { z-index: -2; } .row { display: flex; width: 100% } .row > div, .header > div { flex-grow: 1; min-width: 50px; margin: 1px; } <div class="chart"> <div class="chart-wrapper"> <div class="header-container"> <div class="header"> <div> Department - Team</div> <div>Corporate Development - Fundraisin </div> <div>Corporate Development - Marketing </div> <div>FAS - Team A </div> <div>BF Server - Server . </div> </div> </div> <div class="data-container"> <div class="header-spacing"> <div> Department - Team</div> <div>Corporate Development - Fundraisin </div> <div>Corporate Development - Marketing </div> <div>FAS - Team A </div> <div>BF Server - Server . </div> </div> <div class="data"> <div class="row"> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> <div>11</div> <div>12</div> <div>13</div> <div>14</div> <div>15</div> <div>16</div> <div>17</div> </div> <div class="row"> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> <div style="background-color:#FFAAAA;">7.67</div> </div> <div class="row"> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> <div style="background-color:#AAAAFF;">1.25</div> </div> <div class="row"> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAAAA;">10.00</div> <div style="background-color:#FFAA14;">5.00</div> <div style="background-color:#FFAA14;">5.00</div> <div style="background-color:#FFAA14;">5.00</div> </div> <div class="row"> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#FFAA14;">4.75</div> <div style="background-color:#AAAAFF;">1.75</div> <div style="background-color:#AAAAFF;">1.75</div> <div style="background-color:#AAAAFF;">1.75</div> </div> </div> </div> </div> </div>
unknown
d2985
train
Can you capture wireshark log to see if the IP address in SNMP level TRAP message is the same as the sender IP address in IP level?
unknown
d2986
train
Why you are using two sligingMenu instead try LEFT_RIGHT Mode for your SlidingMenu This class has method as setMode() LEFT_RIGHT_ACTIVITY A: you can use a code like this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle("Hello"); // set the content view setContentView(R.layout.main); // configure the SlidingMenu final SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); /// get 1/3 screen width DisplayMetrics display = this.getResources().getDisplayMetrics(); int width = display.widthPixels; int menu_width = width - width / 3; if (menu_width < 100) { menu_width = 100; } menu.setBehindWidth(menu_width); // set the first sliding size menu.setFadeDegree(0.35f); menu.setSlidingEnabled(true); menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW); menu.setSlidingEnabled(true); View view = G.layoutInflater.inflate(R.layout.menu, null); menu.setMenu(view); final SlidingMenu menu2 = new SlidingMenu(this); menu2.setMode(SlidingMenu.RIGHT); menu2.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu2.setBehindWidth(menu_width / 2); // set the second sliding size half of first slidingه menu2.setFadeDegree(0.35f); menu2.setSlidingEnabled(true); menu2.attachToActivity(this, SlidingMenu.SLIDING_WINDOW); menu2.setSlidingEnabled(true); View view22 = G.layoutInflater.inflate(R.layout.menu, null); menu2.setMenu(view22);
unknown
d2987
train
The axes "box" consists of 4 "spines", which are accessible via ax.spines. You may set a linestyle to those as shown below. import matplotlib.pyplot as plt fig, axes = plt.subplots(2,2) linestyles = ["--","-.",":", (0,(5,2,1,4))] for ax, ls in zip(axes.flat, linestyles): for spine in ax.spines.values(): spine.set_linestyle(ls) spine.set_linewidth(2) ax.set_title("linestyle: {}".format(ls)) plt.tight_layout() plt.show()
unknown
d2988
train
Your question touches on something deeply fundamental in Apple's entire iOS strategy: At least not yet. Even Google had to rely on embedding the standard (albeit tweaked) UIWebView to implement Chrome for iOS. We can expect Apple to be very reluctant to allow this since allowing other web renderers (possibly even with alternative JS implementations, e.g. V8) kind of breaks Apple's monopoly on control of the development environment for iOS. Allowing an alternative would essentially mean allowing an alternative runtime getting a foothold on the platform. Although me personally, I think they will have a hard time in the long run to keep this level of purity. A: Although still inspired by Safari, starting from iOS8 there is WKWebView, a WebKit-based component that provides more powerful, higher-performance APIs than the older UIWebView.
unknown
d2989
train
Excel sheet import value always return in string format so you try below code $status = $data[0]->status; if(is_null($status)){ echo "Status field required";exit; }else{ $status = (int)$status; } if($status === 0 || $status === 1){ echo "successfully";exit; }else{ echo "status format 0 or 1 required"; exit; }
unknown
d2990
train
If the underlying type of the object variable is List<string>, a simple cast will do: // throws exception if Model is not of type List<string> List<string> myModel = (List<string>)Model; or // return null if Model is not of type List<string> List<string> myModel = Model as List<string>;
unknown
d2991
train
CGImageMaskCreate is documented as “Image masks must be 1, 2, 4, or 8 bits per component.”
unknown
d2992
train
MSDN is the place to be for this type of info: System.Windows.Forms.Control.Enabled
unknown
d2993
train
You can in fact define such an operator, because you are free to overload += for built-in types: int& operator+=(int &lhs, Foo &rhs) { lhs += rhs.somefield; return lhs; } On the other hand, instead of writing overloaded functions for all possible operators, you can also provide a function that will allow implicit casts of class Foo to int: class Foo { ... somefield; operator int() { return (int)somefield; } };
unknown
d2994
train
But that seems like too much repetition. Yes, it is. Should I just live with all of this repetition or is there an easy way to deal with this? Yes, you should! In such cases as yours, you should use this tehnique which is named in Firebase denormalization, and for that I recomend you see this tutorial, Denormalization is normal with the Firebase Database, for a better understanding. So, there is nothing wrong in what you are doing, besides that is a common practice when it comes to Firebase.
unknown
d2995
train
You could track the pages by using a unique identifying code in a PHP session, a temporary variable, and using a temporary database table that tracks page loads by these temporary values. The database structure might be: +-------------+-------------------+---------------------+ | Unique ID | Page Referral | Time of page load | +-------------+-------------------+---------------------+ Tracking time of page load would allow you to selectively wipe loads older than X minutes, and keep the table relatively small. Anyway, this would allow you to keep as many levels as you'd like, and if you wanted to add an auto incrementing counter field, or your own counter field, you could even keep a simple to use number system that tracks page loads, though I believe the time of page load would suffice for that scenario.
unknown
d2996
train
Maybe is this what you are looking for? (I have used split from plotly): library(plotly) #Code plot_ly(data = bData, x = ~`Maturity Date`, y = ~YVal, type = 'scatter', mode='markers', symbol = ~Sym, symbols = c('circle-open','x-open','diamond-open','square-open') , split = ~Crncy, text = ~paste(bData$Security,bData$Crncy, bData$YTM, bData$DM,sep = "<br>") , hoverinfo = 'text') Output: Update: Here somo other options for OP: #Option 1 plot_ly(data = bData, x = ~`Maturity Date`, y = ~YVal, type = 'scatter', mode='markers', symbol = ~Sym, symbols = c('circle-open','x-open','diamond-open','square-open') , text = ~paste(bData$Security,bData$Crncy, bData$YTM, bData$DM,sep = "<br>") , hoverinfo = 'text',legendgroup = 'group1' ) %>% add_trace(x = ~`Maturity Date`, y = ~YVal , symbol=~Crncy,legendgroup = 'group2') Output: Option 2: #Option 2 plot_ly(bData, x = ~`Maturity Date`, y = ~YVal, type = 'scatter', mode='markers', legendgroup = 'group1',color = ~Sym) %>% add_trace(y = ~YVal, legendgroup = 'group2',type = 'scatter', mode='markers', color=~Crncy) Output:
unknown
d2997
train
I had to look it up - large parts of the string are obsolete (replaced by real methods on real str objects); because of this, you should propably use ' '.join even in Python 2. But no, there is no different - string.join defaults to joining by single spaces (i.e. ' '.join is equivalent). A: There is no significant difference. In all cases where you could use the first form the second will work, and the second will continue to work on Python 3. However, some people find that writing a method call on a literal string looks jarring, if you are one of these then there are a few other options to consider: ' '.join(iterable) # Maybe looks a bit odd or unfamiliar? You can use a name instead of a literal string: SPACE = ' ' ... SPACE.join(iterable) # Perhaps a bit more legible? Or you can write it in a similar style to string.join(), but be aware the arguments are the other way round: str.join(' ', iterable) Finally, the advanced option is to use an unbound method. e.g. concatenate_lines = '\n'.join ... print(concatenate_lines(iterable)) Any of these will work, just choose whichever you think reads best. A: The two statements are equivalent. string.join(words[, sep]) Concatenate a list or tuple of words with intervening occurrences of sep. The default value for sep is a single space character. While for the second case: str.join(iterable) Return a string which is the concatenation of the strings in the iterable iterable. The separator between elements is the string providing this method. Since the second version still exists in Python 3, you can use that one without any problems. Sources: * *Python 2.7.1 documentation of string.join() (static method) *Python 2.7.1 documentation of join() (string method) A: string.join accepts a list or a tuple as parameter, wheras " ".join accepts any iterable. if you want to pass a list or a tuple the two variants are equal. In python3 only the second variant exists afaik
unknown
d2998
train
Not sure why you say that it's stripping all those namespace prefix declarations. It strips those that aren't needed, but it leaves the declarations for NS2 and tns (and soapenv). Having declarations for namespace prefixes that are unused accomplishes nothing. Why do you care? All the elements in your output XML are in the correct namespace. That's what matters to any downstream XML consumer. (I'm assuming that the change of the namespace URI for NS2 is not part of the problem you're trying to solve.) XSLT makes sure that each element in the output XML is in the proper namespace. Other than that, it doesn't offer fine control over where namespace prefixes are declared, because it doesn't affect the semantics of the output XML. A: The difference between xsl:element name="{name()}" and xsl:copy is that xsl:copy copies the namespace declarations, while xsl:element doesn't. So use xsl:copy if you want them retained. A: The following XSLT preserves all of the namespace declarations (used and unused) and changes the tns namespace-uri to http://www.test1/webservice/Service/v3: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:djh="http://www.test1/webservice/Service/v1" xmlns:tns="http://www.test1/webservice/Service/v3" xmlns:NS1="http://www.test1/Error/v1" xmlns:NS2="http://www.test1/Error/schema/SCRIPT" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <xsl:output indent="yes"/> <xsl:template match="@*|comment()|processing-instruction()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="djh:*"> <!--reconstruct an element using the new v3 namespace, but use the same namespace-prefix "tns"--> <xsl:element name="tns:{local-name()}" namespace="http://www.test1/webservice/Service/v3"> <xsl:apply-templates select="@*|node()"/> </xsl:element> </xsl:template> <xsl:template match="*"> <xsl:element name="{name()}" namespace="{namespace-uri()}"> <!--copy all of the namespace declarations, except for "tns" - which is v1 in the source XML --> <xsl:copy-of select= "namespace::* [not(name()='tns')]"/> <!--copy the namespace declaration for "tns" from the XSLT, which is v3, and add it to the element--> <xsl:copy-of select= "document('')/*/namespace::*[name()='tns']"/> <xsl:apply-templates select="@*|node()"/> </xsl:element> </xsl:template> </xsl:stylesheet> It produces the following output with Saxon 9.x (does not preserve unused namespaces with Xalan, but that apparently is due to XALANJ-1959): <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:NS1="http://www.test1/Error/v1" xmlns:NS2="http://www.test1/Error/schema/SCRIPT" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.test1/webservice/Service/v3"> <soapenv:Body> <tns:Sample> <NS2:Message release="006" version="010"> <NS2:Header> <NS2:TestMessage>1</NS2:TestMessage> </NS2:Header> <NS2:Body> <NS2:SampleTx> <NS2:Element1> <NS2:IdName> <NS2:ID> <NS2:IDValue>114</NS2:IDValue> </NS2:ID> </NS2:IdName> </NS2:Element1> </NS2:SampleTx> </NS2:Body> </NS2:Message> </tns:Sample> </soapenv:Body> </soapenv:Envelope>
unknown
d2999
train
Some browsers support opening files in JavaScript through the FileAPI. If you want a more cross-browser solution, you'll have to use a java/swf applet, or you'll need to pass the file to a PHP server and get back its content through AJAX. Yes, it's that complex to do something as simple as opening a file in JS. It wasn't made for this purpose, and it would be a security issue if JS could easily access any file in your PC. As for how to parse the data, look at String.split like Blazemonger suggested, or learn how to do regular expressions. Finally, you could store the file in this format: [0.1, 0.5, 0.2, 0.8] And call JSON.parse(filecontent) and it would return an array with the values. JSON is the standard way to store JS objects in files.
unknown
d3000
train
final View v = inflater.inflate(R.layout.fragment_image, container, false); imageDisplay = (ImageView) v.findViewById(R.id.imageView); spinner = (ProgressBar) imageDisplay.findViewById(R.id.loading); Is this "spinner" a child of your fragment view or "imageDisplay"? Perhaps, it should be spinner = (ProgressBar) v.findViewById(R.id.loading); A: You should change this spinner = (ProgressBar) imageDisplay.findViewById(R.id.loading); with spinner = (ProgressBar) v.findViewById(R.id.loading); You should find View from inflated view in Fragment.
unknown