_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d5301
train
That's what memcpy is for. memcpy(B, A + n, (N - n) * sizeof(A[0])); where N is the number of elements in A. If A is really an array (not just a pointer to one), then N can be computed as sizeof(A) / sizeof(A[0]), so the call simplifies to memcpy(B, A + n, sizeof(A) - n * sizeof(A[0])); memcpy lives in <string.h>; its first argument is the destination of the copy, its second the source. (I'm sorry, I don't really follow what kind of pointer trick you have in mind, so I can't comment on that.) A: I think I understand what you're asking. You can use pointers to set up your second array, but here is the problem with doing it that way: int [] primary = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; int * secondary = primary + 5; At this point, primary is { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, and secondary is { 6, 7, 8, 9, 0 }, but the problem is they both point to the same array in memory. So instead of having two independent copies, if you edit any of the elements of 'secondary', they are edited in 'primary' also. secondary[2] = 10; for(int i = 0; i < 10; ++i) cout << primary[i] << ' '; This portion of code would now yield: 1 2 3 4 5 6 7 10 9 0 The correct way to do it would to either be setting up the new array, and looping through copying over the values, or using memcpy(). Edit: //Rotate an array such that the index value is moved to the front of the array null rotateArray( &int original[], int size, int index) { int * secondary = new int[size]; //dynamically allocated array for(int i = 0; i < size; ++i) { secondary[i] = original[(i+index)%size]; } original = secondary; //Move the original array's pointer to the new memory location } Some notes: secondary[i] = original[(i+index)%size]; this is how I rotated the array. Say you had an original array of size 5, and you wanted the fourth element to be the new start (remember, elements are numbered 0-(size-1)): i = 0; secondary[0] = original[(0 + 3)%5]// = original[3] i = 1; secondary[1] = original[(1 + 3)%5]// = original[4] i = 2; secondary[2] = original[(2 + 3)%5]// = original[0] ... The last part of the code: original = secondary; is a little bit questionable, as I don't remember whether or not c++ will try and clean up the used memory once the function is exited. A safer and 100% sure way to do it would be to loop through and copy the secondary array's elements into the original array: for(int i = 0; i < size; ++i) original[i] = secondary[i];
unknown
d5302
train
Use zip(a, b) for the two lists, e.g. a = [1, 2, 3] b = ["a", "b", "c"] print(list(zip(a, b))) [(1, "a"), (2, "b"), (3, "c")] A: As mentioned in the comments you can simply use zip which can take lists as parameters and returns an iterator, with tuples of i-th position of the lists passed as arguments, therefore if we try to print it, we'll get a zip object at ... that's why we need to use list() so we can access the values in a list format: import datetime people = ['Albert Einstein', 'Benjamin Franklin', 'J. Edgar Hoover'] dates = [datetime.date(1642, 12, 25), datetime.date(1879, 3, 14), datetime.date(1706, 1, 17)] output = list(zip(people,dates)) For example: [('Albert Einstein', datetime.date(1642, 12, 25)), ('Benjamin Franklin', datetime.date(1879, 3, 14)), ('J. Edgar Hoover', datetime.date(1706, 1, 17))] A: Try this: names = ['Albert Einstein', 'Benjamin Franklin', 'J. Edgar Hoover'] dates = [datetime.date(1642, 12, 25), datetime.date(1879, 3, 14), datetime.date(1706, 1, 17)] print(list(zip(names, dates))) Output: [('Albert Einstein', datetime.date(1642, 12, 25)), ('Benjamin Franklin', datetime.date(1879, 3, 14)), ('J. Edgar Hoover', datetime.date(1706, 1, 17))]
unknown
d5303
train
It turns out that the solution is very simple. I just needed to use "*/*" as the type and then add the openable category which filters out things like contacts that I don't want. public void getFileContent() { Intent fileIntent = new Intent(Intent.ACTION_GET_CONTENT); fileIntent.setType("*/*"); fileIntent.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(fileIntent, RESULT_GET_CONTENT); }
unknown
d5304
train
Check that, it's tottaly what you search : https://irazasyed.github.io/telegram-bot-sdk/usage/keyboards/#keyboards And https://medium.com/@chutzpah/telegram-inline-keyboards-using-google-app-script-f0a0550fde26
unknown
d5305
train
Did you know that the Memcache client can already do compression for you? $memcache_obj = new Memcache; $memcache_obj->addServer('memcache_host', 11211); $memcache_obj->setCompressThreshold(20000, 0.2); This would compress values when larger than 20k with a minimum compression of 20%. See also: Memcache::setCompressThreshold
unknown
d5306
train
Again, your question is about generic ImageView use and the source of the image doesn't have much to do with it. Did you check the tutorial I linked in your previous question? It has a section on using ImageViews: http://developer.android.com/training/displaying-bitmaps/display-bitmap.html
unknown
d5307
train
Probably a duplicate question. But since you're new to Android development this article will explain everything to you. https://blog.takipi.com/the-ultimate-json-library-json-simple-vs-gson-vs-jackson-vs-json/ In short , if your json response is quite small, go with gson otherwise Jackson is better.
unknown
d5308
train
Kaminari's paginate_array method does not show the values in the array. The best way to do so is get the query paginated from the database. Kaminari.paginate_array in your code takes in the whole array of users from the database and then paginates it which is highly inefficient and memory consuming. You need to add the logic to the controller. If you paginate the @role.users query, it is generated with LIMIT which is the value you assign in the per method and OFFSET which equals to (params[:page] - 1) * per. This gets only the number of records you need from the database. In your controller app/controllers/roles_controller.rb class ConversationsController < ApplicationController def show @role = Role.find params[:id] @users = @role.users.page(params[:page]).per(20) end end In your view app/views/roles/show.html.haml %ul.assigned-users - if @users.present? - @users.each do |u| %li=u.name = paginate @users - else %p No users have this role assigned
unknown
d5309
train
You can change the text colour simply using css. To add an image, you can add a custom render function as below: $(function() { $("#ordersTable").DataTable({ processing: true, serverSide: false, ajax: "{{route('index22')}}", data : [{"orderId":"1","orderNumber":"ABC123", "orderDate" : "12/Jun/2022"}, {"orderId":"2","orderNumber":"DEF987", "orderDate" : "11/Jun/2022"}], columns: [{ data: 'orderId' }, { data: 'orderNumber', render: function (data, type) { if (type === 'display') { return "<img src='https://via.placeholder.com/80x40.png?text=ORDER' />" + data; } return data; } }, { data: 'orderDate' }, ] }); }); #ordersTable tbody tr td:first-child { color:green; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css"> <table id="ordersTable" class="table-striped table"> <thead> <tr> <td>ORDER ID</td> <td>ORDER NUMBER</td> <td>ORDER DATE</td> </tr> </thead> </table> A: Please, refer to datatable documentation: datatable examples , and for suggestion I would go with Bootstrap 5 for some decent look. Also, these are CSS selectors: For Table Header table>thead>tr>th{ your styling } For Pagination .dataTables_paginate{ styles } For Pagination Links .dataTables_paginate a { padding: 6px 9px !important; background: #ddd !important; border-color: #ddd !important; } Also, if you using Bootstrap, you will might have to modify the bootstrap.min.css at line :3936 .pagination>li>a, .pagination>li>span { position: relative; float: left; padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; color: #337ab7; text-decoration: none; background-color: #fff; border: 1px solid #ddd; }
unknown
d5310
train
.container { overflow: auto; height: 300px } .header { padding: 10px; text-align: center; background-color: pink; position: sticky; top: 0; z-index: 1; } .content { height: 1000px; } .section { height: 150px; border: 1px solid black; margin-top: 40px; } .inner-header { height: 30px; border-bottom: 1px solid black; position: sticky; top: 2.4rem; background-color: gray; } <div class="container"> <div class="header"> Main sticky header </div> <div class="content"> <div class="section"> <div class="inner-header"> Section sticky header </div> </div> </div> </div>
unknown
d5311
train
I’m afraid there is no direct way. I thought Opera once had an option for this, and its current version has an option (via opera:config) to force a specific encoding, overriding HTTP headers and all, but even there, iso-8859-1 actually means windows-1252. I checked Opera versions 5 and 9 too, no luck. But using the current version of Opera (12.02), you can set the encoding via View → Encoding, and in the “Western” set (where iso-8859-1 means windows-1252 as usual), selecting iso-8859-15 causes the range 130–159 (decimal) of bytes to be effectively ignored in display, not shown as per windows-1252. So this more or less means treating the data as genuinely iso-8859-1 – except of course that the few graphic characters where iso-8859-1 and iso-8859-15 differ, the latter is used. Technically, those bytes represent C1 Controls in iso-8859-1, and in the mode described above, Opera actually treats them that way. They are disallowed in HTML but normally just ignored by browsers.
unknown
d5312
train
For iOS you can use PhotoKit in Xamarin.iOS which allows you to customize a user interface and modify its content. For information on its use, please refer to: https://learn.microsoft.com/en-us/xamarin/ios/platform/photokit
unknown
d5313
train
Just an example of one of the possible reimplementations of your sample code in Logtalk. It uses prototypes for simplicity but it still illustrates some key concepts including inheritance, default predicate definitions, static and dynamic objects, and parametric objects. % a generic dog :- object(dog). :- public([ create_dog/3, bark/0, name/1, age/1 ]). create_dog(Name, Age, Dog) :- self(Type), create_object(Dog, [extends(Type)], [], [name(Name),age(Age)]). % default definition for all dogs bark :- write(ruff), nl. :- end_object. :- object(bassethound, extends(dog)). % bark different bark :- write(woof), nl. :- end_object. :- object(bloodhound, extends(dog)). :- end_object. % support representing dogs as plain database facts using a parametric object :- object(dog(_Name,_Age,_Type), extends(dog)). name(Name) :- parameter(1, Name). age(Age) :- parameter(2, Age). bark :- parameter(3, Type), [Type::bark]. :- end_object. % a couple of (static) dogs as parametric object proxies dog(fred, 5, bassethound). dog(fido, 6, bloodhound). % another static object :- object(frisbee, extends(bloodhound)). name(frisbee). age(1). :- end_object. Some sample queries: $ swilgt ... ?- {dogs}. % [ /Users/foo/dogs.lgt loaded ] % (0 warnings) true. ?- bassethound::bark. woof true. ?- bloodhound::bark. ruff true. ?- bassethound::create_dog(boss, 2, Dog). Dog = o1. ?- o1::bark. woof true. ?- {dog(Name, Age, Type)}::bark. woof Name = fred, Age = 5, Type = bassethound ; ruff Name = fido, Age = 6, Type = bloodhound. ?- dog(ghost, 78, bloodhound)::(bark, age(Age)). ruff Age = 78. ?- forall(between(1,5,_X), {dog(fred,_,_)}::bark). woof woof woof woof woof true. Some notes. ::/2 is the message sending control construct. The goal {Object}::Message simply proves Object using the plain Prolog database and then sends the message Message to the result. The goal [Object::Message] delegates a message to an object while keeping the original sender. A: Prolog modules can be trivially interpreted as objects (specifically, as prototypes). Prolog modules can be dynamically created, have a name that can be regarded as their identity (as it must be unique in a running session as the module namespace is flat), and can have dynamic state (using dynamic predicates local to the module). In most systems, however, they provide weak encapsulation in the sense that you can usually call any module predicate using explicit qualification (that said, at least one system, ECLiPSe, allows you to lock a module to prevent breaking encapsulation this way). There's also no support for separating interface from implementation or having multiple implementations of the same interface (you can somehow hack it, depending on the Prolog module system, but it's not pretty). Logtalk, as mentioned in other answers, is a highly portable object-oriented extension to Prolog supporting most systems, including SWI-Prolog. Logtalk objects subsume Prolog modules, both from a conceptual and a practical point-of-view. The Logtalk compiler supports a common core of module features. You can use it e.g. to write module code in Prolog implementations without a module system. Logtalk can compile modules as objects and supports bi-directional calls between objects and modules. Note that objects in Logic Programming are best seen as a code encapsulation and code reuse mechanism. Just like modules. OO concepts can be (and have been) successfully applied in other programming paradigms, including functional and logic. But that doesn't mean necessarily bringing along imperative/procedural concepts. As an example, the relations between an instance and its class or between a prototype as its parent can be interpreted as specifying a pattern of code reuse instead of being seen from a dynamic/state point-of-view (in fact, in OOP languages derived from imperative/procedural languages, an instance is little more than a glorified dynamic data structure whose specification is distributed between its class and its class superclasses). Considering your sample code, you can recode it easily in Logtalk close to your formulation but also in other ways, the most interesting of them making use of no dynamic features. Storing state (as in dynamic state) is sometimes necessary and may even be the best solution for particular problems (Prolog have dynamic predicates for a reason!) but should be used with care and only when truly necessary. Using Logtalk doesn't change (nor intends to change) that. I suggest you look into the extensive Logtalk documentation and its numerous programming examples. There you will find how to e.g. cleanly separate interface from implementation, how to use composition, inheritance, specialize or override inherited predicates, etc. A: Logtalk is effectively the prominent object oriented Prolog available today. Paulo made it available as a pack, so installing should be very easy. Modules are not really appropriate for object orientation. They are more similar to namespaces, but without nesting. Also, the ISO standard it's a bit controversy. SWI-Prolog v7 introduced dicts, an extension that at least handles an historical problem of the language, and make available 'fields' by name, and a syntax for 'methods'. But still, no inheritance... edit I've added here a small example of object orientation in SWI-Prolog. It's an evolution of my test application about creating genealogy trees. Comparing the genealogy.pl sources, you can appreciate how the latest version uses the module specifier, instead of the directive :- multifile, and then can work with multiple trees. You can see, the calling module is passed down the graph construction code, and have optional or mandatory predicates, that gets called by module qualification: make_rank(M, RPs, Rp-P) :- findall(G, M:parent_child(P, G), Gs), maplist(generated(M, Rp, RPs), Gs). optional predicates must be called like ... catch(M:female(P),_,fail) -> C = red ... Note that predicates are not exported by the applicative modules. Exporting them, AFAIK, breaks the object orientation. ========== Another, maybe more trivial, example of of object orientation, it's the module pqGraphviz_emu, where I crafted a simple minded replacement of system level objects. I explain: pqGraphviz it's a tiny layer - written in Qt - over Graphviz library. Graphviz - albeit in C - has an object oriented interface. Indeed, the API allows to create relevant objects (graphs, nodes, links) and then assign attributes to them. My layer attempts to keep the API most similar to the original. For instance, Graphviz creates a node with Agnode_t* agnode(Agraph_t*,char*,int); then I wrote with the C++ interface PREDICATE(agnode, 4) { if (Agnode_t* N = agnode(graph(PL_A1), CP(PL_A2), PL_A3)) return PL_A4 = N; return false; } We exchange pointers, and I have setup the Qt metatype facility to handle the typing... but since the interface is rather low level, I usually have a tiny middle layer that exposes a more applicative view, and it's this middle level interface that gets called from genealogy.pl: make_node(G, Id, Np) :- make_node(G, Id, [], Np). make_node(G, Id, As, Np) :- empty(node, N0), term_to_atom(Id, IdW), N = N0.put(id, IdW), alloc_new(N, Np), set_attrs(Np, As), dladd(G, nodes, Np). In this snippet, you can see an example of the SWI-Prolog v7 dicts: ... N = N0.put(id, IdW), ... The memory allocation schema is handled in allocator.pl. A: Have a look at logtalk. It is kind of an object-oriented extension to Prolog. http://logtalk.org/ A: the PCE system in SWI-Prolog is also an option for OOP in Prolog. It's usually associated with xpce, the GUI system, but it's actually a general purpose class based OO system. A: Nowadays, SWI prolog has dicts which interact with the modules in a nice way. See The SWI prolog manual page on dicts, especially section 5.4.1.1: User defined functions on dicts. This allows you to define things that look exactly like methods, up to returning values (unusual but very useful in Prolog). Unlike discussed in some of the other answers, I personally find the logic programming and OOP paradigms to be orthogonal to each other: it definitely doesn't hurt to be able to structure your logic code using the OOP modularity... A: There is something called context.pl implemented as part of another, unrelated project. Unlike Logtalk, it doesn't require compilation, but it definitely has only a fraction of Logtalk's features: Context is an object-oriented programming paradigm for Prolog. It implements contexts (namespaces), classes and instances. It supports various inheritance mechanisms. Access to member predicates is regulated through public/protected & private meta-predicates. We enable declarative static typing of class data members. /.../ CONTEXT implements a declarative contextual logic programming paradigm that aims to facilitate Prolog software engineering. Short description: * *We split up the global Prolog namespace into contexts, each having their own facts and rules. *We create a meta-language allowing you to declare metadata about facts and rules in a context. *We implement Classes and Instances, Public, Protected and Private meta-predicates. We implement (Multiple) inheritance and cloning. We implement operators enabling interaction with context.
unknown
d5314
train
You're right - you will typicaly go through (regardless of whether you use the m2eclipse or the commandline version) * *the clean lifeycle (refer to the standard phases in this lifecycle here) *the default lifeycle, particularly the phases from validate thru package (again, refer to the standard phases in this lifecycle here) by running mvn clean package Quoting the doc further (emphasis mine), Some phases have goals bound to them by default. And for the default lifecycle, these bindings depend on the packaging value (which in your case should be war). So the maven-war-plugin handles the packaging for you to deploy (not to be confused with the Maven deploy) it to a tomcat instance in your case. Although you will usually want to install it to your local m2 repository and deploy it to a remote m2 repository for the artifact (*.war) to be available in environments other than your local. For that, you will want to go further into the default lifecycle depending on your need. Also, the tomcat7-maven-plugin can help you deploy the artifact on any tomcat server, you will just need to attach the right goal to the appropriate phase. Read more about the use of the plugin here.
unknown
d5315
train
It seems you've caught bash in a little bit of an optimization. if a subshell contains only a single command, why really make it a subshell? $ ( ps -f ) UID PID PPID C STIME TTY TIME CMD jovalko 29393 24133 0 12:05 pts/10 00:00:00 bash jovalko 29555 29393 0 12:07 pts/10 00:00:00 ps -f However, add a second command, say : (the bash null command, which does nothing) and this is the result: $ ( ps -f ; : ) UID PID PPID C STIME TTY TIME CMD jovalko 29393 24133 0 12:05 pts/10 00:00:00 bash jovalko 29565 29393 0 12:08 pts/10 00:00:00 bash jovalko 29566 29565 0 12:08 pts/10 00:00:00 ps -f One of the main reasons to use a subshell is that you can perform operations like I/O redirection on a group of commands instead a single command, but if your subshell contains only a single command there's not much reason to really fork a new bash process first. As to ps counting as a process, it varies. Many commands you use like ls, grep, awk are all external programs. But, there are builtins like cd, kill, too. You can determine which a command is in bash using the type command: $ type ps ps is hashed (/bin/ps) $ type cd cd is a shell builtin A: The main part of the question is: Does every command run as a separate process? YES!. Every command what isn't built-in into bash (like declare and such), runs as separate process. How it is works? When you type ps and press enter, the bash analyze what you typed, do usual things as globbing, variable expansionas and such, and finally when it is an external command * *the bash forks itself. The forking mean, than immediatelly after the fork, you will have two identical bash processes (each one with different process ID (PID)) - called as "parent" and "child", and the only difference between those two running bash programs is, than the "parent" gets (return value from the fork) the PID of the child but the child don't know the PID of the parent. (fork for the child returns 0). * *after the fork, (bash is written this way) - the child replaces itself with the new program image (such: ps) - using the exec call. *after this, the child bash of course doesn't exist anymore, and running only the newly executed command - e.g. the ps. Of course, when the bash going to fork itself, do many other things, like I/O redirections, opens-closes filehandles, changes signal handling for the child and many-many other things.
unknown
d5316
train
This is based on a current version of the starter kit: http://kieranhealy.org/resources/emacs-starter-kit.html MP:~ HOME$ grep -inIEr --color=ALWAYS -C1 "osascript" .../emacs-starter-kit-master .../emacs-starter-kit-master/kjhealy.org-189- (defun raise-emacs-on-aqua() .../emacs-starter-kit-master/kjhealy.org:190: (shell-command "osascript -e 'tell application \"Emacs\" to activate' &")) .../emacs-starter-kit-master/kjhealy.org-191- (add-hook 'server-switch-hook 'raise-emacs-on-aqua) MP:~ HOME$
unknown
d5317
train
Hey its better to use Eloquent Relation like if you have Author Model and AuthorProfile Model so you put below method in Author model public function Authorprofile(){ return $this->belongsTo(AuthorProfile::class, 'authorprofile_id'); } then use in Controller like. public function show($id){ $author = Author::with('Authorprofile')->find($id) } Hope it mights help
unknown
d5318
train
First thing to do is to find out where the data comes from, so I looked up the network traffic in my developer console, and found it very soon: The data is stored as json here. Now you've got plenty of data for each candidate. I don't know exactly in what relation these numbers are but they definitely are used for their calulation in the graph. I found out that the position in the main.js is on line 392 where they calculate the data with this expression: Math.log(dataPoints[i][j] * 100.0) / Math.log(logScaleBase); My guess is: Without the logarithm and a bit exponential calculation you should get the right results.
unknown
d5319
train
You can use java.io.RandomAccessFile to access file(B) and write to it at the desired location.
unknown
d5320
train
The reason this happened was because the dependency line changed, and was no longer right. I cannot figure out why it would work after one build, but not after a clean. The error message isn't clear! Even though the artifact didn't exist according to the dependency declaration, it would pass through that build step and attempt to compile. In the end, fixing the dependency fixed this issue. The artifact is named like this: com.company:artifact:1.2.0.0.+@aar That artifact exists. However, someone mistakenly changed it to: com.company:artifact:1.2.0.0.0.+@aar That does not exist. I had a copy of this artifact in my local ~/.m2 that fits the first, but not the second. So, strangely, the dependency resolution had a false positive, and then the build would fail. To make matters worse, the second build (without a clean) would succeed.
unknown
d5321
train
Your'e directly modifying the mainCatTitle variable from onClick, not the state hoisted by your ViewMoel DropdownMenuItem(onClick = { mainCatTitle = it.category_name.toString() ... and because you didn't provide anything about your ViewModel, I would assume and suggest to create a function if you don't have one in your ViewModel that you can call like this, DropdownMenuItem(onClick = { viewModel.onSelectedItem(it) // <-- this function ... } and in your ViewModel you update the state like this fun onSelectedItem(item: String) { // <-- this is the function _mainCatTitle.value = item }
unknown
d5322
train
You cannot control the number of cells in a UITableView from the cellForRowAtIndexPath method - You need to return the correct value from the numberOfRowsInSection method. Refer to the UITableViewDataSource protocol reference and the Table View Programming Guide Addtionally, this code block - if (indexPath.row == 0) { identifier = @"Cell"; } else if (indexPath.row == 1) { identifier = @"Cell2"; } is somewhat redundant - all of your cells are UITableViewCellStyleDefault, so they are interchangeable. Using two different identifiers is not necessary - If you intend to use different custom cell types in the future then you can keep this concept, but you probably wouldn't use the indexPath.row directly, rather you would be driven by the data type in your model for the row in question.
unknown
d5323
train
Late ... but ... my solution is to set %md as first line. So no command would be executet. David
unknown
d5324
train
The error means that JAVA_HOME in your shell used to invoke Ant is different from the Java that was included with the embedded WebSphere Application Server. Try using the WAS_HOME/bin/ws_ant script, or set JAVA_HOME to WAS_HOME/java/. A: The error Cannot run RMIC because it is not installed. Expected location of RMIC is the following: will some times confuse. enable the "Capture RMIC verbose output to the workspace .log file. and see what the exact error your getting. This option will be available in properties > EJBDeployment. In My case it throwing error due to huge number of jars in class path.It got resolved after shortening the class path jar location.
unknown
d5325
train
I'll see about changing the page to show the textbox. Why is it that you need the textbox to be there after submitting?
unknown
d5326
train
is it possible to know annotation value inside annotated field It's not possible. You may have 2 different classes class SomeClass { @MyAnnotation("Annotation") private MyClass myClass; public SomeClass(MyClass myClass) { this.myClass=myClass; } } and class SomeClassNo Annotation { private MyClass myClass; public SomeClassNo(MyClass myClass) { this.myClass=myClass; } } Then you create an instance of MyClass MyClass instance = new MyClass(); then 2 classes instances new SomeClass(instance) and new SomeClassNo(instance) both have reference to the same instance. So the instance does not know whether the reference field annotated or not. The only case when it is possible is to pass somehow the container reference to MyClass. A: There is no straight forward way of implementing what you are asking. WorkAround: Limitations: * *This workaround doesn't enforce any kind of compile time check and it is completely your responsibility to handle it. *This only works if MyClass is going to be a spring bean. class MyClass { public String annotatedValue; } You can write a Spring BeanPostProcessor the following way. public class SampleBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { Field[] fields = bean.getClass().getDeclaredFields(); for (Field field : fields) { if (field instanceof MyClass && field.isAnnotationPresent(MyAnnotation.class)) { String value = field.getDeclaredAnnotation(MyAnnotation.class).value(); ((MyClass) field).annotatedValue = value; return bean; } } return bean; } } The above BeanPostProcessor will be called for every bean during the app start up. It will check all the fields of a given bean to see if the field is of type MyClass. If it is, it will extract the value from the annotation and set it in the annotatedValue field. The problem with this approach is that you can use MyAnnotation on any property in any class. You cannot enforce the annotation to be used only on MyClass.
unknown
d5327
train
First, a recommendation: if you don't want duplicates, store them with a well-known ID. For example, suppose you don't want duplicate User objects. You'd store them with an ID that makes them unique: var user = new User() { Email = "[email protected]" }; var id = "Users/" + user.Email; // A well-known ID dbSession.Store(user, id); Then, when you want to check for duplicates, just check against the well known name: public string RegisterNewUser(string email) { // Unlike .Query, the .Load call is ACID and never stale. var existingUser = dbSession.Load<User>("Users/" + email); if (existingUser != null) { return "Sorry, that email is already taken."; } } If you follow this pattern, you won't have to worry about running complex queries nor worry about stale indexes. If this scenario can't work for you for some reason, then we can help diagnose your memory issues. But to diagnose that, we'll need to see your code. A: When i need to do massive operations on large collections i work following this steps to prevent problems on memory usage: * *I use Query Streaming to extract all the ids of the documents that i want to process (with a dedicated session) *I open a new session for each id, i load the document and then i do what i need
unknown
d5328
train
If they're undefined after the assignment, that might mean there is simply no value assigned in the css style of the element. That they're undefined before the assignment is how it should be in all browsers anyway. The value undefined is the default value of any (declared) variable. Also note that "document scope" variables are actually appended to the global object (in your case most likely the window object) and it's quite a bad practice to pollute the global namespace in this way. One way to overcome it could be to have an anonymous function closure around the whole thing, like: (function() { var background; var opacity; var zIndex; function backupValues() { var overlay = $(".ui-widget-overlay"); background = overlay.css("background"); opacity = overlay.css("opacity"); zIndex = overlay.css("z-index"); } function restoreValue() { $(".ui-widget-overlay").css("background", background).css("opacity", opacity).css("z-index", zIndex); } window.my.fancy.namespace = { backupValues: backupValues, restoreValues: restoreValues }; }()); This would make the variables local to the scope. The "undefined" behavior stays the same though, as this is how it should behave. EDIT : although not directly related to your question, I updated the code to show how you can expose the functions to be accessible from outside while keeping the variables local. A: Turns out the problem was in the .css() function. The jQuery function .css() is supposed to encapsulate the difference between browsers (namely IE uses a different style attribute for opacity than other browsers). However, it seems to be broken on opacity in IE. To make this work on all browsers I would have to manage a lot of properties and cases, which is a bad idea. The solution was to avoid the problem altogether and use an overall more elegant solution. Instead of backing up the values in vars, I defined a new style in my css file for the values I was going to override. Instead of calling backupValues() and restoreValues(), I simply called .addClass("myClass") and .removeClass("myClass"). This gave me the exact same effect and doesn't have to compensate for differences in browsers which are at times quite complicated.
unknown
d5329
train
The easiest, by far, is to install QtCreator. it includes MinGW and simply opens the same project files as on linux. compile, and go! A huge advantage of MinGW over VC++ is that it doesn't make you chase circles around getting the right vcredist library for the exact version of the compiler, nor it cares too much about debug/release builds. To deploy, just be sure to copy the same one or two DLLs you have on the development machine. A few more for Qt, but these are well-documented on Qt docs. No hidden surprises.
unknown
d5330
train
"require header.php at the start of the script and have it create the header div with two sub-divs" this way, it will be easier for you to change anything including that parent div. And its usually a good practice to include a header file before starting any html output. You can do several things with it in future... like writing some statement that require sending of headers (http headers) like start session etc.
unknown
d5331
train
Your question isn't formulated very well, but here's some things that might work for your application. * *pandas.isnan *pandas.interpolate *mse = lambda y1, y2: (y2 - y1)**2 A: so you have data set in csv format or other. you can first load the data using the pandas library and fill the missing values. Build the model : mse = lambda y1, y2: (y2 - y1)**2 Test with sample data set on this model.
unknown
d5332
train
you have added the width of the PDF file, try to add the height of the PDF file. And add some more information to the meta data
unknown
d5333
train
Did it, thank you @Marian. What I did was change my add_cookie_cart method to accept another parameter: # app/models/user.rb class User < ActiveRecord::Base ... def add_cart_cookie(value, password) self.cart_cookie = value self.password = password self.password_confirmation = password self.save end ... end And changed my session#destroy accordingly: class Users::SessionsController < Devise::SessionsController def destroy current_user.add_cart_cookie(cookies['cart']['value'], current_user.password) cookies['cart'] = { value: '', path: '/' } super end end
unknown
d5334
train
The SQLAlchemy docs describe how to use the MySQL REGEXP operator. Since there is no built-in function, use .op() to create the function: query = session.query(TableFruitsDTO).filter( TableFruitsDTO.field.op('regexp')(r'apple|banana|pear') )
unknown
d5335
train
I solved this problem in a rooted device; the way I follow to manage permission require root privileges: Process su = Runtime.getRuntime().exec("su"); DataOutputStream dos = new DataOutputStream(su.getOutputStream()); dos.writeBytes("pm revoke/grant " + packageName + " " + permissionName); dos.flush(); dos.close(); Maybe studing android security architecture you will be cabable to find a way to solve the problem on non-rooted devices but you'll waste a lot of time.
unknown
d5336
train
A loop is probably better here, unless you need to collect to such ChapterPage objects in multiple places in your code or your input is already a stream and you want to avoid materializing it into a list first. Just to demonstrate how this could still be done, this is an example using a custom downstream Collector: Map<String, ChapterPage> res = input.stream() .collect(Collectors.groupingBy(ElectronicMaterialResourceRelEntity::chapterName, Collector.of( ChapterPage::new, (c, e) -> { c.getPage().add(e.page()); c.getChapterImage().add(e.chapterImageId()); }, (c1, c2) -> { c1.getPage().addAll(c2.getPage()); c2.getChapterImage().addAll(c2.getChapterImage()); return c1; } ))); Getters and constructors differ from your code, I used a record for ElectronicMaterialResourceRelEntity and a POJO without annotation magic for ChapterPage in my test. By "loop", I don't necessarily mean a traditional loop, but a somewhat less functional approach directly using a mutable HashMap: Map<String, ChapterPage> res = new HashMap<>(); input.forEach(e -> { ChapterPage c = res.computeIfAbsent(e.chapterName(), k -> new ChapterPage()); c.getPage().add(e.page()); c.getChapterImage().add(e.chapterImageId()); }); produces the same result in a less verbose way. A: You can convert List to Json, and then convert Json to Map
unknown
d5337
train
You need to enable the hstore extension in postgres. Try running rails g migration add_hstore_extension, then edit it like below: class AddHstoreExtension < ActiveRecord::Migration def self.up enable_extension "hstore" end def self.down disable_extension "hstore" end end Note that you'll need that to run before the migration which uses it. A: I ended up adding the extension to pg_catalog, which is always implicitly on search_path, as described by Craig Ringer in this post: Create HSTORE with multiple schemas CREATE EXTENSION hstore WITH SCHEMA pg_catalog;
unknown
d5338
train
You can write your own initializer that takes a pointer to the Model. in the .h file of your ControllerA and B @property(nonatomic,assign)Model* myModel; -(id)initWithModel:(Model*)model; in the .m file of your ControllerA and B @synthesize myModel; -(id)initWithModel:(Model*)model{ self = [super init]; if(self){ self.mymodel = model; } return self; } EDIT If you are using the IB you would write your initilizer in the following way: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil model:(Model*)model { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.mymodel = model; } return self; } A: I think, you need to use a singleton pattern Trivial implementation of witch looks like this YourClass.h + (id)sharedInstance; YourClass.m: +(id)singleton { static dispatch_once_t pred; static MyClass *shared = nil; dispatch_once(&pred, ^{ shared = [[MyClass alloc] init]; }); return shared; } Good article about it apple reference A: You've got the right idea: provide the model to the view controllers that need it when you create them; don't make go looking to a singleton or other global for the information they need. Since you asked about view controllers, and since those are often instantiated from .xib or storyboard files, you may need to adjust your approach a little. Instead of providing a reference to the model in the initializer, you can simply add a property that stores a reference to the model to each of your view controllers. The object that's responsible for creating a view controller can then provide the model after the controller has been created. For example, your app delegate's -applicationDidFinishLaunchingWithOptions: method will be called after the root view controller is created, and that's a good time to set up the model and point the root view controller at it: -applicationDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // set up the model self.model = [[MyModel alloc] initWithFile:...]; // get the root controller and give it a pointer to the model MyFirstViewController *firstController = self.window.rootViewController; firstController.model = model; } The root view controller can then pass the model on to other view controllers that it creates. If you have a tab based app, the app delegate might instead pass the model on to all the view controllers under the tab controller. In that case, your tab controller will be the window's root view controller, and you'd get to your view controllers like this: NSArray *controllers = self.window.rootViewController.viewControllers; The big advantage here over the singleton approach is that your view controllers don't assume anything about the rest of the app. They'll each use whatever model you give them. That makes your code cleaner, easier to manage, easier to rearrange, and so on. A: Once you create your model objects, you can store these instances in a global dictionary with a key, in some class which you have only one instance of, i.e. a singleton. When a view controller needs this model, it can ask this singleton to give it the data it needs by providing a dictionary key. Or you can store your data in coredata, and fetch it from there whenever you need it from a view controller. This way you'll also achieve persistence, if you need it.
unknown
d5339
train
You need to specify in the STARTUPINFO structure that you want your console window to be initially minimized: ZeroMemory(&si); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_MINIMIZE;
unknown
d5340
train
Replace existing function function um_get_avatar_uri( $image, $attrs ) { $uri = false; $uri_common = false; $find = false; $ext = '.' . pathinfo( $image, PATHINFO_EXTENSION ); $custom_profile_photo = get_user_meta(um_user( 'ID' ), 'profile_photo', 'true'); if ( is_multisite() ) { //multisite fix for old customers $multisite_fix_dir = UM()->uploader()->get_upload_base_dir(); $multisite_fix_url = UM()->uploader()->get_upload_base_url(); $multisite_fix_dir = str_replace( DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . get_current_blog_id() . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $multisite_fix_dir ); $multisite_fix_url = str_replace( '/sites/' . get_current_blog_id() . '/', '/', $multisite_fix_url ); if ( $attrs == 'original' && file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo{$ext}" ) ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/profile_photo{$ext}"; } elseif ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$attrs}x{$attrs}{$ext}" ) ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/profile_photo-{$attrs}x{$attrs}{$ext}"; } elseif ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$attrs}{$ext}" ) ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/profile_photo-{$attrs}{$ext}"; } else { $sizes = UM()->options()->get( 'photo_thumb_sizes' ); if ( is_array( $sizes ) ) { $find = um_closest_num( $sizes, $attrs ); } if ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$find}x{$find}{$ext}" ) ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/profile_photo-{$find}x{$find}{$ext}"; } elseif ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$find}{$ext}" ) ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/profile_photo-{$find}{$ext}"; } elseif ( file_exists( $multisite_fix_dir . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo{$ext}" ) ) { $uri_common = $multisite_fix_url . um_user( 'ID' ) . "/profile_photo{$ext}"; } } } if ( $attrs == 'original' && file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo{$ext}" ) ) { $uri = UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . "/profile_photo{$ext}"; } elseif ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . $custom_profile_photo ) ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . $custom_profile_photo; } elseif ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$attrs}x{$attrs}{$ext}" ) ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/profile_photo-{$attrs}x{$attrs}{$ext}"; } elseif ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$attrs}{$ext}" ) ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/profile_photo-{$attrs}{$ext}"; } else { $sizes = UM()->options()->get( 'photo_thumb_sizes' ); if ( is_array( $sizes ) ) { $find = um_closest_num( $sizes, $attrs ); } if ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$find}x{$find}{$ext}" ) ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/profile_photo-{$find}x{$find}{$ext}"; } elseif ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo-{$find}{$ext}" ) ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/profile_photo-{$find}{$ext}"; } elseif ( file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . "profile_photo{$ext}" ) ) { $uri = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/profile_photo{$ext}"; } } if ( ! empty( $uri_common ) && empty( $uri ) ) { $uri = $uri_common; } $cache_time = apply_filters( 'um_filter_avatar_cache_time', current_time( 'timestamp' ), um_user( 'ID' ) ); if ( ! empty( $cache_time ) ) { $uri .= "?{$cache_time}"; } return $uri; }
unknown
d5341
train
In PostgreSQL, it doesn't matter how many rows you modify in a single transaction, so it is preferable to do everything in a single statement so that you don't end up with half the work done in case of a failure. The only consideration is that transactions should not take too long, but if that happens once a day, it is no problem.
unknown
d5342
train
use in cell H1: ={COUNTIF(INDIRECT("D4:D"), TODAY());ARRAYFORMULA(COUNTIFS( INDIRECT("B4:B"), "content", MONTH( INDIRECT("D4:D")), MONTH(TODAY()))/COUNTIFS(MONTH( INDIRECT("D4:D")), MONTH(TODAY())))}
unknown
d5343
train
You can be sure about the StringPair.avsc file is in your jar by mvn tf MapReduce-0.0.1-SNAPSHOT.jar (If it's not listed maven can simply build it into the jar if you place it under the src/main/resources/StringPair.avsc) For the "No content to map to Object due to end of input" error message the magic was for me to place a slash before the file name because it is in the root of the jar. Schema.Parser parser = new Schema.Parser(); Schema schema =parser.parse(AvroScTest.class.getResourceAsStream("/StringPair.avsc"));
unknown
d5344
train
Use r'(\[\d+\])' should capture what you want, like this: import re s = 'token[0][1]' g1, g2 = re.findall(r'(\[\d+\])', s) print g1, g2 [0] [1]
unknown
d5345
train
There're two methods in question when it comes to executing queries against a table: CloudTable.ExecuteQuery and CloudTable.ExecuteQuerySegmented. The first one (ExecuteQuery) will handle the continuation token internally while the second one (ExecuteQuerySegmented) will return you the continuation token as a part of result set which you can use to fetch next set of data.
unknown
d5346
train
There is source available for the ooxml schemas! It's covered in the POI FAQ The schema classes are auto-generated by xmlbeans from the specification, but you can get the auto-generated sources if you want. Depending on your needs, you can either use the ant build file to generate them, or download the pre-generated ones from Maven central. The FAQ covers both options
unknown
d5347
train
You are "capitalising" the value html attribute. Change this to lower case... @Value = Model.DesignParams[i].DefaultValue as below ... @value = Model.DesignParams[i].DefaultValue IE is not the smartest of web browsers and there's definitely something wrong in the way Trident (they're parsing engine) validates elements' attributes as seen in these threads... https://github.com/highslide-software/highcharts.com/issues/1978 Highcharts adds duplicate xmlns attribute to SVG element in IE Also, as already noted somewhere else. What's the need for the Editor extension method? Isn't it simpler to just use TextBoxFor instead? @Html.TextBoxFor(model => model.DesignParams[i].ParamId , new { @class = "form-control text-right" , uomid = Model.DesignParams[i].UOMId , measureid = Model.DesignParams[i].MeasureId }) A: As StuartLC points out, you are trying to get Html.Editor to do something it wasn't designed to do. What happens when you pass a @value or @Value key to the htmlAttributes is that the rendering engine produces an attribute with that name in addition to the value attribute it's already generating: <input type="text" name="n" value="something" value="somethingElse" /> or <input type="text" name="n" value="something" Value="somethingElse" /> In both cases, you're giving the browser something bogus, so it can't be expected to exhibit predictable behavior. As alluded above, Html.Editor has functionality to generate the value attribute based on the expression argument you pass to it. The problem is that you are using that incorrectly as well. The first argument to Html.Editor() needs to be an expression indicating the model property that the editor should be bound to. (e.g. the string value "DesignParams[0].ParamId") Nowadays, the preferred practice is to use the more modern EditorFor that takes a lambda function, as StuartLC showed in his post: @Html.EditorFor(model => model.DesignParams[i].ParamId, ...) A: You shouldn't be using invalid Html attributes in this way. Use the data- attributes in Html 5. Also, your use of @Html.Editor(Model.DesignParams[i].ParamId (assuming ParamId is a string) deviates from the helper's purpose, which is to reflect the property with the given name off the Model, and use the value of this property as the Html value attribute on the input. (MVC will be looking for a property on the root model with whatever the value of ParamId is, which seems to silently fail FWR) I would do the defaulting of Model.DesignParams[i].ParamId = Model.DesignParams[i].DefaultValue in the Controller beforehand, or in the DesignParams constructor. @Html.EditorFor(m => m.DesignParams[0].ParamID, new { htmlAttributes = new { // Don't set value at all here - the value IS m.DesignParams[0].ParamID @class = "form-control text-right", @type = "text", id = "_" + Model.DesignParams[i].ParamId, data_uomid = Model.DesignParams[i].UOMId, data_measureid = Model.DesignParams[i].MeasureId } Note that this will give the input name as DesignParams[0].ParamID, which would be needed to post the field back, if necessary. Here's a Gist of some example code (The underscore will be converted to a dash) Use data() in jQuery to obtain these values: var value = $(inputfield).data("uomid"); A: Editor works with metadata. then you need to more about this, http://aspadvice.com/blogs/kiran/archive/2009/11/29/Adding-html-attributes-support-for-Templates-2D00-ASP.Net-MVC-2.0-Beta_2D00_1.aspx But the easiest way is go with @model Namespace.ABCModel @using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.TextBoxFor(model => model.DesignParams[i].ParamId, new { @class = "form-control text-right", uomid = Model.DesignParams[i].UOMId, measureid = Model.DesignParams[i].MeasureId }) }
unknown
d5348
train
Perhaps an alternative description would help. 'Business' and 'System' Use Cases differ in scope. The former encompasses everything the customer and supplier have to do in order to complete the goal. Some of that may involve a system interaction - but some may not. As an example, take buying a book online. Certain aspects will involve be completed online (e.g. browsing available books, placing order). But some are not: picking the stock, packaging, shipping, signing for receipt of package. A Business Use Case is a "black box" description of the entire interaction ("Buy Book"). Completing the task means following a business process. Some of the steps in the process will involve a user-system interaction, some will not. Where a step does involve a user and a system ("Browse available books") that step is a System Use Case. Typically there will be a number of System Use Cases for a given Business Use Case. So do you need both? It depends on circumstances. If you're (a) responsible for the complete business scope, and (b) want to document the business capabilities as Use Cases, then a Business UCD and supporting UC definitions is useful. The steps in the UC description would represent the business process. If someone else is responsible for the business-level definitions then you probably don't need to. One final thing: sometimes the two are coincident. For example: buying an eBook. The Business Need is for the customer to be able to get their book. The entire thing could be delivered in a single system interaction (select book, pay, receive download) - and so could be covered by a single System Use Case. So the Business- and System Use Cases are equivalent. hth. A: Think of it this way: A business UC (use case) contains absolutely no technical detail. And you need to step back a way to see the business need. So business UCs may be something like: * *Manage Photos Online *Create Personal Log Entries *Interact With Other Users Online *Share Photos With Other Users Notice none of this says anything about how it will be done. At this point it's pretty much a listing of needed functionality put into action-subject-qualifier format. You can put them into a use case model with the actors and you have a very useful set of high-level business UCs. Finish spec'ing out UCs with their pre- and post-conditions and such for low-level business UCs. But at this poing the detail of the paths aren't known. A system UC contains the system-level perspective on those business UCs. So, while Manage Photos Online may describe the need to upload photos and group them into albums, the system UCs may actually turn into: * *Upload Image (with paths for uploading, naming, cropping and deleting) *Manage Album (with paths for creating, adding images and removing images) Here we've gotten into technical detail. The business may be thinking in terms of storing and swapping photos, but you know that there's little difference in how the system will perceive and handle photos and bitmap images. You've started thinking about just what's involved in uploading images and what the user may need to do with the images. I hope this helped.
unknown
d5349
train
Looking around in some of the XMOS documentation, it seems the problem is that XC is not C, it's just a C-like language. From the "XC Programming Guide": XC provides many of the same capabilities as C, the main omission being support for pointers. ...which explains why it doesn't accept the next and prev pointers in your structure. Apparently xcc lets you mix C and XC sources, though, so if you were to limit your use of the structure to C code it should work. From the "XCC Command-Line Manual", it appears that anything with a .xc extension (as in the command line you used above) is treated as XC, rather than C, source code by default. This can be overridden by placing the option -xc before the C sources on the command line and -x afterward (or just rename the files with a .c extension). If you must use XC rather than C, you may need to find another way of doing things (arrays, maybe?). A: Try using a forward declaration of struct list_struct: struct list_struct; typedef struct list_struct { int data; struct list_struct* next; struct list_struct* prev; } list; Perhaps your compiler doesn't recognize the identifier in the middle of its own definition, I'm not sure what the standards say about that (if anything). For those that don't already know, this is also the way to deal with circular dependencies in struct definitions: struct a; struct b; struct a { int x; struct b *y; }; struct b { int x; struct a *y; };
unknown
d5350
train
Found it: https://www.jsdelivr.com/ This place has all the .js files that I was looking for, as well as .css files
unknown
d5351
train
There's no source code, template instantiation isn't a text-replace step. To inspect the generated code you should use a disassembler/debugger or dump (if the compiler supports it) the generated code. Template instantiation is a compilation step and although it can get pretty complex, it generates code and not text. Macros undergo a process similar to what you described: they're processed in the pre-processing stage and they're just plain text substitutions
unknown
d5352
train
When you put opacity: .99 on the #sidebar, it forms a stacking context on #sidebar and everything inside it is stuck on it even if you put a z-index: -1000. #sidebar { opacity: 1; } .label { z-index: -3; } Read more about the stacking context.
unknown
d5353
train
Here you go: #!/usr/bin/env python import sys import random #weights=[.25,.25,.25,.25] dna=['A','G','C','T'] def weighted_choice(weights,dna): totals = [] running_total = 0 for w in weights: running_total += w totals.append(running_total) rnd = random.random() * running_total for i, total in enumerate(totals): if rnd < total: return dna[i] def dna_gen(length): seq='' for i in range(length): seq=seq+weighted_choice(weights,dna) return seq def dna_gen2(reps,length,weights,dna): for i in range (reps): print (dna_gen(length)) if __name__=='__main__': reps = int(sys.argv[1]) length = int(sys.argv[2]) weights = [float (w) for w in sys.argv[3:6]] dna_gen2(reps,length,weights,dna) Now when I try it on the command line: python nameOfYourScript.py 2 2 0.25 0.25 0.25 0.25 I get: CG GA
unknown
d5354
train
Instead of running 50,000 queries, build one query: $rows = Array(); for( $aw=1; $aw<=50000; $aw++) $rows[] = "('Fin','0743208899','London','[email protected]')"; mysql_query("INSERT INTO say (cname,cno,clocation.email) VALUES ".implode(",",$rows));
unknown
d5355
train
i only just found this out and here you go. import win32gui def DRAW_LINE(x1, y1, x2, y2): hwnd=win32gui.WindowFromPoint((x1,y1)) hdc=win32gui.GetDC(hwnd) x1c,y1c=win32gui.ScreenToClient(hwnd,(x1,y1)) x2c,y2c=win32gui.ScreenToClient(hwnd,(x2,y2)) win32gui.MoveToEx(hdc,x1c,y1c) win32gui.LineTo(hdc,x2c,y2c) win32gui.ReleaseDC(hwnd,hdc) x1 = 640 y1 = 400 x2 = 840 y2 = 600 DRAW_LINE(x1, y1, x2, y2) as for moving your mouse underneath the lines i cant figure that out
unknown
d5356
train
You have a problem with your def run(self):. You're referencing a task variable that isn't defined. You mean self.task: # Consider renaming: it's more standard to have `TaskThread` class taskThread (threading.Thread): # Init is fine def run(self): print "Starting " + self.task + " for " + self.bot.username # It used to be just 'task'. Make it self.task if self.task == "task1": self.bot.task1() elif self.task == "task2": self.bot.task2() print "Exiting " + self.task + " for " + self.bot.username You also might want to consider: def run(self): print "Starting " + self.task + " for " + self.bot.username action = getattr(self.bot, self.task) action() print "Exiting " + self.task + " for " + self.bot.username
unknown
d5357
train
In the official document, it says This class is for use in code that is generated by the XAML compiler. This tells me that I should be able to find some reference of it in code-generated classes (.g.cs) by x:Bind, given there's not a single thread on the Internet that explains what exactly it does. So I created a test UWP project with a ListView, and inside its ItemTemplate I threw in some x:Bind with x:Phase. After I compiled the project, I found some of its methods used inside my MainPage.g.cs - XamlBindingHelper.ConvertValue public static void Set_Windows_UI_Xaml_Controls_ItemsControl_ItemsSource(global::Windows.UI.Xaml.Controls.ItemsControl obj, global::System.Object value, string targetNullValue) { if (value == null && targetNullValue != null) { value = (global::System.Object) global::Windows.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(global::System.Object), targetNullValue); } obj.ItemsSource = value; } Apparently the XamlBindingHelper.ConvertValue method is for converting values. I knew this already, as I used it in one of my recent answers on SO. XamlBindingHelper.SuspendRendering & XamlBindingHelper.ResumeRendering public int ProcessBindings(global::Windows.UI.Xaml.Controls.ContainerContentChangingEventArgs args) { int nextPhase = -1; switch(args.Phase) { case 0: nextPhase = 1; this.SetDataRoot(args.Item); if (!removedDataContextHandler) { removedDataContextHandler = true; ((global::Windows.UI.Xaml.Controls.StackPanel)args.ItemContainer.ContentTemplateRoot).DataContextChanged -= this.DataContextChangedHandler; } this.initialized = true; break; case 1: global::Windows.UI.Xaml.Markup.XamlBindingHelper.ResumeRendering(this.obj4); nextPhase = -1; break; } this.Update_((global::System.String) args.Item, 1 << (int)args.Phase); return nextPhase; } public void ResetTemplate() { this.bindingsTracking.ReleaseAllListeners(); global::Windows.UI.Xaml.Markup.XamlBindingHelper.SuspendRendering(this.obj4); } XamlBindingHelper.SuspendRendering & XamlBindingHelper.ResumeRendering look very interesting. They seem to be the key functions to enable ListView/GridView's incremental item rendering which helps improve the overall panning/scrolling experience. So apart from x:DeferLoadingStrategy and x:Load(Creators Update), they are something else that could be used to improve your app performance. IDataTemplateComponent & IDataTemplateExtension However, I couldn't find anything related to GetDataTemplateComponent and SetDataTemplateComponent. I even tried to manually set this attached property in XAML but the get method always returned null. And here's the interesting bit. I later found this piece of code in the generated class. case 2: // MainPage.xaml line 13 { global::Windows.UI.Xaml.Controls.Grid element2 = (global::Windows.UI.Xaml.Controls.Grid)target; MainPage_obj2_Bindings bindings = new MainPage_obj2_Bindings(); returnValue = bindings; bindings.SetDataRoot(element2.DataContext); element2.DataContextChanged += bindings.DataContextChangedHandler; global::Windows.UI.Xaml.DataTemplate.SetExtensionInstance(element2, bindings); } break; The method DataTemplate.SetExtensionInstance looks very similar to XamlBindingHelper.SetDataTemplateComponent. It takes element2 which is the root Grid inside the ItemTemplate of my ListView, and an IDataTemplateExtension; where the latter takes an element and an IDataTemplateComponent. If you have a look at their definitions, their functionalities are very similar, which makes me think if DataTemplate.SetExtensionInstance is the replacement of XamlBindingHelper.SetDataTemplateComponent? I'd love to know if otherwise. Unlike IDataTemplateComponent, you can get an instance of the IDataTemplateExtension in your code - var firstItemContainer = (ListViewItem)MyListView.ContainerFromIndex(0); var rootGrid = (Grid)firstItemContainer?.ContentTemplateRoot; var dataTemplateEx = DataTemplate.GetExtensionInstance(rootGrid); In my case, the dataTemplateEx is an instance of another generated class called MainPage_obj2_Bindings, where you have access to methods like ResetTemplate and ProcessBindings. I assume they could be helpful if you were to build your own custom list controls, but other than that I just can't see why you would ever need them.
unknown
d5358
train
Try this code: install.packages('Tmisc') library(Tmisc) data(quartet) View(quartet) quartet %>% group_by(set) %>% summarize(mean(x), sd(x), mean(y), sd(y), cor(x,y)) %>% ggplot(quartet,aes(x,y)) + geom_point() + geom_smooth(method=lm,se=FALSE) + facet_wrap(~set) you have to use tilde not dash in front of set because set is an independent variable in the quartet dataset. dash is used to remove a column from selection A: It works with the code: ggplot(quartet, aes(x,y)) + geom_point() + geom_smooth(method=lm, se=FALSE) + facet_wrap(~set) A: Try to install the tidyverse package and then this command supposed to be work. since ggplot function is under the tidyverse package
unknown
d5359
train
Alessandro has good advice here, definitely look at the samples repos for inspiration on how to build what you're looking for. * *start with open source, it's easier to prototype and you can switch to enterprise later it won't be an issue for you *this depends on design, you wouldn't really want to create a new corda node per-person, you might want to have corda accounts that run on a single node instead. See accounts sdk here: https://github.com/corda/accounts *what you might do is make a corda node for each school and then accounts per teacher like you were already were thinking. That would mean only a couple of nodes based on the number of schools you have. *as long as your state is marked with @CordaSerializable you won't have problems sending arrays of data, I send an array in a state in this sample here: https://github.com/corda/samples-java/blob/master/Advanced/secretsanta-cordapp/contracts/src/main/java/net/corda/samples/secretsanta/states/SantaSessionState.java#L24 https://github.com/corda/samples-java https://github.com/corda/samples-kotlin
unknown
d5360
train
not sure why is this happening but try using the second form of setState this.setState(() => ({ chore: evt.target.value})) check this https://reactjs.org/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous A: I made some changes as below and it works fine for me. Hope it helps you too. class AddChores extends Component { constructor(props) { super(props); this.state = { chore: "" }; } handleChange = (event) => { this.setState({ chore: event.target.value }); }; handleSubmit = (evt) => { evt.preventDefault(); // this.props.addChores(this.state); this.setState({ chore: "" }); }; componentDidUpdate(){ console.log('the state', this.state.chore) } render() { return ( <div> <form onClick={this.handleSubmit}> <input type="text" placeholder="New Chore" value={this.state.chore} onChange={this.handleChange} /> </form> </div> ); } }
unknown
d5361
train
It sounds like what you want is to clear the interval timer when 5 are created so you would need to check again inside the interval timer code also Something like: var timer= window.setInterval(function(){ if ($('div').length > 5){ clearInterval(timer) }else{ $('body').append('<div>' + (Math.floor(Math.random() * 9) + 0) + '</div>'); } }, 1000);
unknown
d5362
train
You can use urlSession:task:didCompleteWithError delegate method
unknown
d5363
train
Sub moveit() Dim src As Worksheet, dest As Worksheet Dim c As Range, f As Range Set src = ThisWorkbook.Sheets("Sheet1") Set dest = ThisWorkbook.Sheets("Sheet2") dest.UsedRange.ClearContents 'start with empty sheet Set c = src.Range("a2") Do While Len(c.Value) > 0 Set f = dest.Rows(1).Find(c.Value, LookIn:=xlValues, lookat:=xlWhole) If f Is Nothing Then Set f = dest.Cells(1, Columns.Count).End(xlToLeft) If Len(f.Value) > 0 Then Set f = f.Offset(0, 3) f.Value = c.Value src.Range("B1:D1").Copy f.Offset(1, 0) End If c.Offset(0, 1).Resize(1, 3).Copy dest.Cells(Rows.Count, f.Column).End(xlUp).Offset(1, 0) Set c = c.Offset(1, 0) Loop End Sub
unknown
d5364
train
In the results of your first query, you should get back a nextPageToken field. When you make the request for the next page, you must send this value as the pageToken. So you need to add pageToken=XXXXX to your query, where XXXXX is the value you received in nextPageToken. Hope this helps
unknown
d5365
train
note: if you run into this problem, inspect the actual content of the response, it may be a result of a mismatch between the index and your query. My problem was that the specific query I was using was inappropriate for the specified index, and that resulted in a 400
unknown
d5366
train
The emulator doesn't include any email application for security purposes. In order to send email you need to download any email client (k9mail is a good option) and it will work without any issues. A: Alternatively, you can send an e-mail in Android using the JavaMail API and the Gmail authentication. Relevant code for that will be : GMailSender sender = new GMailSender("[email protected]", "password"); sender.sendMail("This is Subject", "This is Body", "[email protected]", "[email protected]"); See the Stack Working Example Here .
unknown
d5367
train
You can add if/else if logic to XSLT with <xsl:if> There is also the ability to have something like a switch statement with <xsl:choose>, which includes the capability do do 'else' behaviour. These constructs take a test attribute, in which you specify the condition. Here's a nice writeup on useful getting-started tests. It's really something you have to play with to get used to, but these website links will give you a great start. Example: given your document a template like: <xsl:template match="/"> <xsl:for-each select="events/event"> <xsl:choose> <xsl:when test="type/text() = 'Processed'"> <xsl:value-of select="result"></xsl:value-of> </xsl:when> </xsl:choose> </xsl:for-each> </xsl:template> Will produce the text 'Sucess'. A: Untested, and I'm a bit confused by the logic you're trying to implement, but try starting with this: <xsl:template match="/"> <table> <xsl:apply-templates select="events/event" /> </table> </xsl:template> <xsl:template match="event"> <xsl:if test="type = 'Processed'"> <tr> <td> <xsl:value-of select="result" /> </td> </tr> </xsl:if> </xsl:template> A: xsl:choose is another option. From that link: <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <xsl:choose> <xsl:when test="price &gt; 10"> <td bgcolor="#ff00ff"> <xsl:value-of select="artist"/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="artist"/></td> </xsl:otherwise> </xsl:choose> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> The xsl:if doen't have an else functionality.
unknown
d5368
train
It is ok to use target="_blank"; This was done away with in XHTML because targeting new windows will always bring up the pop-up alert in most browsers. XHTML will always show an error with the target attribute in a validate. HTML 5 brought it back because we still use it. It's our friend and we can't let go. Never let go. A: Most web developers use target="_blank" only to open links in new tab. If you use target="_blank" only to open links in a new tab, then it is vulnerable to an attacker. When you open a link in a new tab ( target="_blank" ), the page that opens in a new tab can access the initial tab and change its location using the window.opener property. Javascript code: window.opener.location.replace(malicious URL) Prevention: rel="nofollow noopener noreferrer" More about the attribute values. A: While target is still acceptable in HTML5 it is not preferred. To link to a PDF file use the download attribute instead of the target attribute. Here is an example: <a href="files/invoice.pdf" download>Invoice</a> If the original file name is coded for unique file storage you can specify a user-friendly download name by assigning a value to the download attribute: <a href="files/j24oHPqJiUR2ftK0oeNH.pdf" download="invoice.pdf">Invoice</a> Keep in mind that while most modern browsers support this feature some may not. See caniuse.com for more info. A: It sure is! http://www.w3.org/TR/2010/WD-html5-20100624/text-level-semantics.html#the-a-element A: It looks like target="_blank" is still alright. It is listed as a browsing context keyword in the latest HTML5 draft. A: Though the target="_blank" is acceptable in HTML5, I personally try never to use it (even for opening PDFs in a new window). HTML should define meaning and content. Ask yourself, “would the meaning of the a element change if the target attribute were removed?” If not, the code should not go in the HTML. (Actually I’m surprised the W3C kept it… I guess they really just can’t let go.) Browser behavior, specifically, interactive behavior with the user, should be implemented with client-side scripting languages like JavaScript. Since you want the browser to behave in a particular way, i.e., opening a new window, you should use JS. But as you mentioned, this behavior requires the browser to rely on JS. (Though if your site degrades gracefully, or enhances progressively, or whatever, then it should still be okay. The users with JS disabled won’t miss much.) That being said, neither of these is the right answer. Out there somewhere is the opinion that how a link opens should ultimately be decided by the end user. Take this example. You’re surfing Wikipedia, getting deeper and deeper into a rabbit hole. You come across a link in your reading. Let’s say you want to skim the linked page real quick before coming back. You might open it in a new tab, and then close it when you’re done (because hitting the ‘back’ button and waiting for page reload takes too long). Or, what if it looks interesting and you want to save it for later? Maybe you should open it in a new background tab instead, and keep reading the current page. Or, maybe you decide you’re done reading this page, so you’ll just follow the link in the current tab. The point is, you have your own workflow, and you’d like your browser to behave accordingly. You might get pretty frustrated if it made these kinds of decisions for you. THAT being said, web developers should make it absolutely clear where their links go, what types and/or formats of sources they reference, and what they do. Tooltips can be your friend (unless you're using a tablet or phone; in that case, specify these on the mobile site). We all know how much it sucks to be taken somewhere we weren't expecting or make something happen we didn't mean to. A: it's by the easiest way to open a new window for something like a PDF It's also the easiest way to annoy non-Windows users. PDF open just fine in browsers on other platforms. Opening a new window also messes up the navigation history and complicates matter on smaller platforms like smartphones. Do NOT open new windows for things like PDF just because older versions of Windows were broken. A: I think target attribute is deprecated for the <link> element, not <a>, that's probably why you heard it's not supposed to be used anymore. A: You can do it in the following way with jquery, this will open it in a new window: <input type="button" id="idboton" value="google" name="boton" /> <script type="text/javascript"> $('#idboton').click(function(){ window.open('https://www.google.com.co'); }); </script>
unknown
d5369
train
I think below code will help you public static void main(String[] args) throws IOException{ downloadFunction("http://google.com.vn", "/tmp/google.html", "someHeaderValue"); } private static void downloadFunction(String url, String outPut, String headerValue) throws IOException{ URL website = new URL(url); URLConnection connection = website.openConnection(); connection.setRequestProperty("headerKey", headerValue); InputStream response = connection.getInputStream(); ReadableByteChannel rbc = Channels.newChannel(response); FileOutputStream fos = new FileOutputStream(outPut); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); }
unknown
d5370
train
sleep() is one of those functions that is never re-started when interrupted. interestingly, it also does not return a EINT as one would expect. It instead returns success with the time remaining to sleep. See: http://www.kernel.org/doc/man-pages/online/pages/man7/signal.7.html for details on other APIs that do not restart when interrupted
unknown
d5371
train
You said absolutely right, if someone wanna use exposureOffset instance property in SceneKit, he/she needs to activate a wantsHDR property at first: var wantsHDR: Bool { get set } In real code it might look like this: sceneView.pointOfView!.camera!.wantsHDR = true sceneView.pointOfView!.camera!.exposureOffset = -5 But there's a bug in iOS 13 and iOS 13 Simulator. However, if you disable allowsCameraControl, exposureOffset works fine. sceneView.allowsCameraControl = false Here's how exposureOffset changes from -2 to 2:
unknown
d5372
train
I think you can try stacking the matrices into vectors, then use L1 norm. In CVX, it's just norm(variable, 1). It will do the same as you wrote here: sum of absolute elementary-wise differences.
unknown
d5373
train
• It is aptly written in the documentation link that you have stated that your application should have admin access and its consent for accessing the APIs in Azure databricks. Thus, as per the error statement that you are encountering, it might be that your application might not have the correct permissions to access the respective resources based on its assigned service principal. • Also, please take note of the token issued by the Azure AD when queried a test application created wherein when decoded on ‘jwt.io’ clearly states the information regarding the user including its email address. This access token issued using authorization code flow as stated in the documentation link connects to the application created successfully but the application fails to decode the token and use the information of the user in it for allowing the user to access its resources. The application fails to decode the token because required MSAL library redirection and resource files were missing at the location of App redirect URI. Similarly, you are trying to access email address from the issued access token and use it for giving varying levels of access in the application which is not possible as the token even if intercepted in between would not be able to access user information from it since it is encrypted using the SSL key certificate and the base 64 encoding. • To provide access to your users in varying degrees, please refer the below documentation link which describes how you can leverage dynamic groups and Azure AD conditional access policies for your requirement. https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/what-is-access-management
unknown
d5374
train
I was unable to get the next view to show with a nav bar after the camera, even after trying numerous scenarios. So, after seeing a hint in a different post, I removed the nav controller between the home and taken view, changed the attributes to none for Simulated Metrics/Top Bar and inserted a toolbar in it's place in the TakenView and two following views. Yes, it required more work in Storyboard and I had to add a label where the title should go, but it is all functioning. And, I didn't have to add any more code, except for changing the back or cancel buttons into unwindSegues.
unknown
d5375
train
It looks like your receivers are screwed up. evaluateTree does not take arguments. I'm assuming you want to evaluate the subtree, as in op(evaluateTree(left)) should instead be op(left.evaluateTree()) def evaluateTree(): A = this match { case Leaf(value) => value case Branch_A1(op, left) => op(left.evaluateTree()) case Branch_A2(op, left, right) => op(left.evaluateTree(),right.evaluateTree()) }
unknown
d5376
train
* *You will need to kick off 3 JMeter instances in Distributed Mode *For 1st JMeter instance add the next lines to user.properties file to mimic 2G network: httpclient.socket.http.cps=6400 httpclient.socket.https.cps=6400 *For 2nd JMeter instance add the next lines to user.properties file to mimic 3G network httpclient.socket.http.cps=2688000 httpclient.socket.https.cps=2688000 *For 3rd JMeter instance add the next lines to user.properties file to mimic 4G network: httpclient.socket.http.cps=19200000 httpclient.socket.https.cps=19200000 More information: How to Simulate Different Network Speeds in Your JMeter Load Test
unknown
d5377
train
If your 10 row dataset above is dat, then you can melt the dataset into a long format (Yr columns), restrict to rows where the value in those year columns exceeds 4, count the number of rows as num_yr_above, and concatenate the year values as years_above. Then just join back to dat library(data.table) setDT(dat) dat[melt(dat,id="ID", measure=patterns("Yr\\d"))[value>4, .( num_yr_above=.N, years_above = list(gsub("Yr","",variable))), by=ID], on=.(ID)] Output: (all columns included, but here I show only the new additional columns added to the dataset) ID num_yr_above years_above 1: 20106 10 1978,1979,1980,1981,1982,1983,... 2: 20108 5 1978,1979,1980,1981,1982 3: 20100 9 1979,1980,1981,1982,1983,1984,... 4: 20102 1 1979 5: 20107 9 1979,1980,1981,1982,1983,1984,... 6: 20101 7 1981,1982,1983,1984,1985,1986,... 7: 20105 7 1981,1982,1983,1984,1985,1986,... 8: 20103 2 1982,1983 9: 20104 2 1982,1983 10: 20109 5 1983,1984,1985,1986,1987
unknown
d5378
train
Fixed: new webpack.ProvidePlugin({ 'Promise': 'imports?Promise=>window.Promise!require-promise', })
unknown
d5379
train
Use brackets inside if statement if (noPt_D1.equals("f") && (day1_inst.equals("") || day1_uniform.equals("") || day1_location.equals(""))) { } if(noPt_D1.equals("t") || (!day1_inst.equals("") && !day1_uniform.equals("") && !day1_location.equals(""))) { } A: You are making minor mistake in condition PLUS you need to use if - else block instead of 2 if blocks //surround all && conditions inside separate braces if (noPt_D1.equals("f") && (day1_inst.equals("") || day1_uniform.equals("") || day1_location.equals(""))) { //show toast } else if(noPt_D1.equals("t") || (!day1_inst.equals("") && !day1_uniform.equals("") && !day1_location.equals(""))) { //start activity } Hope this helps. A: also try this. and its better to avoid including special characters for ur class name if ("f".equals(noPt_D1) && "".equals(day1_inst) || "".equals(day1_uniform) || "".equals(day1_location)) { Toast.makeText(getApplicationContext(), "Please Enter All Data Or Select the NO PT THIS DAY checkbox!", Toast.LENGTH_LONG).show(); } if("t".equals(noPt_D1) || !"".equals(day1_inst) && !"".equals(day1_uniform) && !"".equals(day1_location)) { //PASS VARIABLES WITH INTENT Intent intent = new Intent (OneWeekPlan_Start_Btn.this, Week1Day2.class); //PASS VARIABLES FOR DAY 1 intent.putExtra("noPt_D1", noPt_D1); intent.putExtra("day1_inst", day1_inst); intent.putExtra("day1_uniform", day1_uniform); intent.putExtra("day1_location", day1_location); intent.putExtra("d1hours", d1hours); intent.putExtra("d1min", d1min); intent.putExtra("d1x1", d1x1); intent.putExtra("d1x2", d1x2); intent.putExtra("d1x3", d1x3); intent.putExtra("d1x4", d1x4); startActivity(intent); } A: Try to check EditText values via length() of String value. Secondly put && operator in if statement because you said in your question: if a check box is not checked and 3 EditTexts are empty then print a toast. Otherwise dont print the toast and continue to the next activity. if (noPt_D1.equals("f") && day1_inst.trim().length() == 0 && day1_uniform.trim().length() == 0 && day1_location.trim().length() == 0) { Toast.makeText(getApplicationContext(), "Please Enter All Data", Toast.LENGTH_LONG).show(); } else { Intent intent = new Intent (OneWeekPlan_Start_Btn.this, Week1Day2.class); intent.putExtra("noPt_D1", noPt_D1); intent.putExtra("day1_inst", day1_inst); intent.putExtra("day1_uniform", day1_uniform); intent.putExtra("day1_location", day1_location); intent.putExtra("d1hours", d1hours); intent.putExtra("d1min", d1min); intent.putExtra("d1x1", d1x1); intent.putExtra("d1x2", d1x2); intent.putExtra("d1x3", d1x3); intent.putExtra("d1x4", d1x4); startActivity(intent); } EDIT: Make sure you should declare your Strings which I am assuming are: String day1_inst = your_editText_inst.getText().toString(); String day1_uniform = your_editText_uniform.getText().toString(); String day1_location = your_editText_location.getText().toString(); String noPt_D1 = "f"; if(your_check_box.isChecked()) { noPt_D1 = "t"; } else { noPt_D1 = "f"; } A: Try using an OnCheckedChangeListener Listener, like whats shown below : CheckBox noPtD1 = (CheckBox) findViewById(R.id.noPTD1); String noPt_D1 = "f"; noPtD1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { noPt_D1 = "t"; } else { noPt_D1 = "f"; } } }); A: Replace getApplicationContext() with this if you are in activity. getActivity() if you're in fragment. A: Just figured it out thanks to M S Gadag =) Basically I took the if statements and put the startActivity if statement on top. Then I added a variable to show that that statement had already been executed. Then I used that variable to start another if statement to decide whether or not to show the toast. int showToast = 0; if("t".equals(noPt_D1) || !"".equals(day1_inst) && !"".equals(day1_uniform) && !"".equals(day1_location)) { //PASS VARIABLES WITH INTENT Intent intent = new Intent (OneWeekPlan_Start_Btn.this, Week1Day2.class); //PASS VARIABLES FOR DAY 1 intent.putExtra("noPt_D1", noPt_D1); intent.putExtra("day1_inst", day1_inst); intent.putExtra("day1_uniform", day1_uniform); intent.putExtra("day1_location", day1_location); intent.putExtra("d1hours", d1hours); intent.putExtra("d1min", d1min); intent.putExtra("d1x1", d1x1); intent.putExtra("d1x2", d1x2); intent.putExtra("d1x3", d1x3); intent.putExtra("d1x4", d1x4); startActivity(intent); showToast = 1; } if ("f".equals(noPt_D1) && "".equals(day1_inst) || "".equals(day1_uniform) || "".equals(day1_location)) { if (showToast !=1) { Toast.makeText(getApplicationContext(), "Please Enter All Data Or Select the NO PT THIS DAY checkbox!", Toast.LENGTH_LONG).show(); } }
unknown
d5380
train
Look at the parameters the method expects: entry_new_person_ identity_type_ pop_new_person_identity_no And the parameters being sent: entry_new_person_ identity_type_no pop_new_person_identity_no The middle parameter is different. It's similar, but it's not the same thing. The model binder isn't smart enough (thankfully) to match things which are just similar. Changing the key in the JavaScript code should fix it: var dataAjax = { 'entry_new_person_': $('#entry_new_person_1').val(), 'pop_new_person_identity_no': $('#pop_new_person_identity_no1').val(), 'identity_type_': $('#select2_identity_type_bc_for_new_person_1').val() }; (Or changing the parameter name in the method would fix it too. Depends on which one is a bigger change. For example, if you have tons of JavaScript calls to this method then a single change to the method would be easier than many changes to the invocations of the method.) A: Try after removing dataType: 'json' then It will work. And define Web Type in web mthod as POST
unknown
d5381
train
In this declaration char *exp="a+b"; the compiler at first creates the string literal that has the array type char[4] with static storage duration and the address of the first character of the string literal is assigned to the pointer exp. You may imagine that the following way char unnamed_string_literal[4] = { 'a', '+', 'b', '\0' }; char *exp = unnamed_string_literal; That is in the last declaration of the variable exp the array unnamed_string_literal is implicitly converted to a pointer to its first element and this pointer is assigned to the pointer exp. You may not change the string literal. Any attempt to change a string literal result in undefined behavior. That is you may not write for example exp[0] = 'A'; In this declaration char exp[]="a+b"; there is created the character array exp elements of which are initialized by elements of the string literal. You may imagine the declaration the following way char exp[4] = { 'a', '+', 'b', '\0' }; As the array is not declared with qualifier const then you may change elements of the array. On the other hand, you may not write int *exp = { 1,2,3 }; because the construction { 1, 2, 3 } does not represent an object of an array type. You may use such a construction to initialize an array like int exp[] = { 1, 2, 3 }; But you may not initialize a scalar object (pointers are scalar objects0 with a braced list that contains more than one expression. However you may initialize the pointer by a compound literal that has an array type like int *exp = ( int [] ){ 1,2,3 }; In this case the compiler creates an unnamed array of the type int[3] and the address of its first element is assigned to the pointer exp. You should pay attention to these key concepts. * *Scalar objects may not be initialized by a braced list containing more than one expression. *Array designators used in expressions with rare exceptions are converted to pointers to their first elements. *String literals have array types. A: What is the difference between char *exp="a+b"… char *exp declares exp to be a pointer. When this appears inside a function, a pointer is created for the duration of execution of the block it is in. When it appears outside a function, a pointer is created for the duration of execution of the program. It is initialized with the string literal "a+b". When a string literal is used this way, it is automatically converted to a pointer to its first element, so exp is initialized to point to the “a”. The string literal exists for the duration of execution of the program. Because the pointer points to the characters of the string literal, any use of the pointer uses the string literal. The C standard does not define the behavior if you attempt to modify a string literal. … and char exp[]="a+b"? char exp[] declares exp to be an array. Its duration is the same as for a pointer, above. It is initialized by copying the string literal "a+b" into it, and the size of the string literal also determines the size of the array. An array is automatically converted to a pointer to its first element except when it is the operand of sizeof, is the operand of unary &, or is a string literal used to initialize an array. Since the latter is the case here, the string literal is not converted to a pointer. Because exp contains a copy of the string literal, you may modify exp without affecting the string literal. int *exp=[1,2,3] First, [1,2,3] is not a notation meaning an array. [ and ] are used for subscripts, not for array contents. In initializers, we can use braces, { and }, for lists of initial values, but these designate only lists, not arrays. C originally did not have an “array literal” notation like a string literal. However, later a compound literal was added to the language. You can create an object directly in source code by writing (type) { initial values }. So you can create an array of int with (int []) { 1, 2, 3 }. int *exp = (int []) { 1, 2, 3 }; will create a pointer named exp and initialize it to point to the first element of the array. Unlike a string literal, which exists for the duration of the program, a compound literal inside a function exists only for the duration of the block of code it is in.
unknown
d5382
train
you can use ListView.builder to create dynamic list example : class HomePage extends StatelessWidget { List<String> images = [ "Bitcoin.svg.png", "256px-Ethereum_logo_2014.svg.png", "litecoin-ltc-logo.png" ]; @override Widget build(BuildContext context) { return ListView.builder( itemCount:images.length , itemBuilder: (context, index) => CoinCard( cryptoname: "ggg", logo: images[index], price: "5001918556", ), ); } }
unknown
d5383
train
XAML: <Window x:Class=......... DataContext="{StaticResource MainViewModel}" Name="MyWindow" > <Window.Triggers > <EventTrigger RoutedEvent="CheckBox.Unchecked" > <BeginStoryboard > <Storyboard > <DoubleAnimation Storyboard.TargetName="MyWindow" Storyboard.TargetProperty = "(Window.Height)" Duration="0:0:0.5" To="{Binding WindowHeight}" RepeatBehavior="1x" /> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="CheckBox.Checked" > <BeginStoryboard > <Storyboard > <DoubleAnimation Storyboard.TargetName="MyWindow" Storyboard.TargetProperty = "(Window.Height)" Duration="0:0:0.5" To="{Binding WindowHeight}" RepeatBehavior="1x" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Window.Triggers> <Grid Row="0" > ............ <CheckBox Grid.Column="4" Content="UpadatePack" IsChecked="{Binding PackegeCheck, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" Name="CheckUpadatePack" /> <CheckBox Grid.Column="5" Content="Setup" IsChecked="{Binding SetupCheck, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" Name="CheckSetup" /> ...... </Grid> <Grid Row="5" Visibility="{Binding SetupDestinationVisibility, Converter={StaticResource BoolToVisibilityConverter}}" > <Grid.ColumnDefinitions> <ColumnDefinition Width="120"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Label Content="Setup Destination" Margin="5" Grid.Column="0"/> <TextBox Margin="5" Grid.Column="1"/> </Grid> <Grid Row="6" Visibility="{Binding PackageDestinationVisibility, Converter={StaticResource BoolToVisibilityConverter}}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="120"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Label Content="Package Destination" Margin="5" Grid.Column="0"/> <TextBox Margin="5" Grid.Column="1"/> </Grid> </Window> MainViewModel: public class MainViewModel : ViewModelBase { private bool _sixtyFourBitCheck; private bool _packegeCheck; private bool _setupCheck; private bool _ftpUploadCheck; public int _windowHeight; public int _origSize = 200; public bool SixtyFourBitCheck { get => _sixtyFourBitCheck; set { if (value == _sixtyFourBitCheck) return; _sixtyFourBitCheck = value; OnPropertyChanged(); } } public bool PackegeCheck { get => _packegeCheck; set { if (value == _packegeCheck) return; _packegeCheck = value; OnPropertyChanged(); OnPropertyChanged(nameof(PackageDestinationVisibility)); ChangeWindowsHeght(); } } public bool SetupCheck { get => _setupCheck; set { if (value == _setupCheck) return; _setupCheck = value; OnPropertyChanged(); OnPropertyChanged(nameof(SetupDestinationVisibility)); ChangeWindowsHeght(); } } public bool FtpUploadCheck { get => _ftpUploadCheck; set { if (value == _ftpUploadCheck) return; _ftpUploadCheck = value; OnPropertyChanged(); } } public bool SetupDestinationVisibility => SetupCheck; public bool PackageDestinationVisibility => PackegeCheck; public int WindowHeight { get => _windowHeight; set { if (value == _windowHeight) return; _windowHeight = value; OnPropertyChanged(); } } public MainViewModel() { WindowHeight = _origSize; } private void ChangeWindowsHeght() { WindowHeight = _origSize; if (PackageDestinationVisibility) WindowHeight += 35; if (SetupDestinationVisibility) WindowHeight += 35; OnPropertyChanged(nameof(WindowHeight)); } }
unknown
d5384
train
On Hot Spot VM you can set agent properties using sun.misc.VMSupport.getAgentProperties().
unknown
d5385
train
From the original poster: Turns out I was using the wrong grep. $ git diff --name-only HEAD~1 HEAD | grep \.py$ | \ $ xargs git diff --check HEAD~1 HEAD -- tools/gitHooks/unittests/testPreReceive.py:75: trailing whitespace. +newmock = Mock()
unknown
d5386
train
It looks like you did not add files in openerp.py in well sequence. Are you getting this error from CSV file or from View.xml file ? You need to check openerp.py file. You may be assign first ir.model.access.csv/module_view.xml and after that, module_security.xml in 'data' attribute. So It will go first checking ir.model.access.csv/module_view.xml and it will not find that group, that you created in security.xml and that will be load after loading ir.model.access.csv/module_view.xml files. You can check it and you need to pass first security.xml and after that, ir.model.access.csv/module_view.xml files in openerp.py. You can also check by assigning group like this : module_name.GROUP_XML_ID wherever you did assign/use those groups.
unknown
d5387
train
Remove action="#", like this: <form th:action="@{/stock-list/inventory-detail}" method="post" th:object="${inventoryDetail}" class="pt-3 form-inventory-detail">
unknown
d5388
train
I think you will need to use ActiveX or Java Applets or Silverlight to do something like that. JavaScript does not have access to local file system. Another way to go with this is create a file on server (physically or on the fly) and make it available for download to the user. That will get him the save file dialog. To do this on the fly, create a blank page (without any markup. not even ), set Response.ContentType = 'text/plain' and use Response.Write() to write your content in Page_Load. A: You can generate a plain text or csv file purely in client-side JavaScript by constructing and opening a data URI. Example using jQuery: window.open( 'data:text/csv;charset=utf-8,' + escape( $('#yourlist li') // <- selector for source data here .map(function(){ // format row here return $(this).text(); }) .get() .join('\r\n') ) ); Unfortunately, this technique will not work in IE due to lack of data URI support until IE8 and security restrictions once IE added support for data URIs. You'd have to use an alternative technique for IE, either hitting the server again or using ActiveX / Silverlight / Flash / Java Applet to avoid a round trip for data that is presumably already on the client.
unknown
d5389
train
The cloud functions were updated, therefore you need to change this: exports.grantSignupReward = functions.database.ref('/users/{uid}/last_signin_at') .onCreate(event => { const uid = event.params.uid; into this: exports.grantSignupReward = functions.database.ref('/users/{uid}/last_signin_at') .onCreate(snap,context) => { const uid = context.params.uid; more info here: https://firebase.google.com/docs/functions/beta-v1-diff#realtime-database
unknown
d5390
train
You have to use AJAX. Let say we have a form (order) where we have a table (order_items). We will add rows with some goodies (items), their price and quantity. Let assume that an user already opened new order and added a new row. In the row we put the select with items, span price and text field quantity. Under table we have span total * *User selects item. When item is selected we call 'on_change' javascript event for this select. *Inside that call we sent AJAX request to items controller (method 'show') with id of selected item. Inside the controller#show we find our item and return it to client as json. *On client we have an javasript object item. Using javascript we place item.price inside span price. *Another 'on_change' we must call for quantity text field. When quantity changed we iterate all rows, calc sum for each row and accumalate it in result vatiable. Then we put this result in total span.
unknown
d5391
train
false\nkeyUsage=critical,keyEncipherment")?; let mut file = File::create(client_ext).unwrap(); file.write(b"basicConstraints=CA:false\nkeyUsage=critical,digitalSignature")?; // Generate self-signed CA Command::new("openssl") .args(&[ "req", "-x509", "-newkey", "rsa:2048", "-subj", "/CN=ca", "-nodes", "-keyout", &format!("{}/ca-key.pem", keys_dir), "-out", &format!("{}/ca-cert.pem", certs_dir), "-addext", "keyUsage=critical,keyCertSign", ]) .output()?; // Generate server key and CSR Command::new("openssl") .args(&[ "req", "-newkey", "rsa:2048", "-subj", "/CN=server", "-nodes", "-keyout", &format!("{}/server-key.pem", keys_dir), "-out", &format!("{}/server-csr.pem", scratch_dir), ]) .output()?; // Sign server CSR Command::new("openssl") .args(&[ "x509", "-req", "-CAcreateserial", "-CA", &format!("{}/ca-cert.pem", certs_dir), "-CAkey", &format!("{}/ca-key.pem", keys_dir), "-in", &format!("{}/server-csr.pem", scratch_dir), "-out", &format!("{}/server-cert.pem", certs_dir), "-extfile", server_ext, ]) .output()?; // Generate client key and CSR Command::new("openssl") .args(&[ "req", "-newkey", "rsa:2048", "-subj", "/CN=client", "-nodes", "-keyout", &format!("{}/client-key.pem", keys_dir), "-out", &format!("{}/client-csr.pem", scratch_dir), ]) .output()?; // Sign client CSR Command::new("openssl") .args(&[ "x509", "-req", "-CAcreateserial", "-CA", &format!("{}/ca-cert.pem", certs_dir), "-CAkey", &format!("{}/ca-key.pem", keys_dir), "-in", &format!("{}/client-csr.pem", scratch_dir), "-out", &format!("{}/client-cert.pem", certs_dir), "-extfile", client_ext, ]) .output()?; std::fs::remove_dir_all(scratch_dir)?; Ok(()) } For further reference please check this link for full code: https://github.com/TimonPost/udp-dtls
unknown
d5392
train
You are making it very difficult for yourself! Take a look at Simple Java Mail (open source, layer around Jakarta Mail / JavaMail), which comes with a gmail example which should be easy to modify. For your case the code would be: private void sendPdf(Document document) { // be sure to enable a one-time app password in Google, so 2-factor won't block you Mailer mailer = MailerBuilder.buildMailer("smtp.gmail.com", 25, username, password, TransportStrategy.SMTP); // or: MailerBuilder.buildMailer("smtp.gmail.com", 587, username, password, TransportStrategy.SMTP_TLS); // or: MailerBuilder.buildMailer("smtp.gmail.com", 465, username, password, TransportStrategy.SMTPS); Email email = EmailBuilder.startingBlank() .from(username) .to("[email protected]") .withSubject("dummy subject") .withPlainText("dummy content") .withAttachment("test.pdf", producePdfData(document), "application/pdf"); mailer.sendMail(email); } private byte[] producePdfData(Document document) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); PdfWriter.getInstance(document, outputStream); return outputStream.toByteArray(); } Now you just need to fill in the right Yahoo server and port and transport method, but it should work. If you still can't get a connection, then I'm guessing you are trying from a corporate environment and you are probably blocked by a proxy (or less likely a firewall). Simple Java Mail supports proxy connections (including authenticated proxy), but if it's a firewall, then you are out of luck unless you setup an SSH tunnel or something (probably not allowed).
unknown
d5393
train
Try from .models import EmailData A: * *get rid of the __init__.py adjacent to your manage.py - the level with manage.py should not be a Python package *use EmailIngestionDemo.models instead
unknown
d5394
train
Uri uri = uri obtained from ACTION_OPEN_DOCUMENT_TREE String folderName = "questions.59189631"; DocumentFile documentDir = DocumentFile.fromTreeUri(context, uri); DocumentFile folder = documentDir.createDirectory(folderName); return folder.getUri(); Use createFile() for a writable file.
unknown
d5395
train
This was driving me crazy for hours but the solution (as usual) was simple. I had forgotten to make sure $config[‘encryption_key’] was the same for both applications! Working great now
unknown
d5396
train
I don't think the problem is directly related to the pydev debugger in this case... my bet is that for some reason you're having corrupted .pyc files (don't know why thought). Try cleaning your .pyc files from your pycharm installation and your own files and run it again (you may try running with pydev which has the same debugger backend if you want to see if you reproduce the issue there).
unknown
d5397
train
How about this class Person def initialize puts "old" end alias_method :original_initialize, :initialize def self.method_added(n) if n == :initialize && !@adding_initialize_method method_name = "new_initialize_#{Time.now.to_i}" alias_method method_name, :initialize begin @adding_initialize_method = true define_method :initialize do |*args| original_initialize(*args) send method_name, *args end ensure @adding_initialize_method = false end end end end class Person def initialize puts "new" end end Then calling Person.new outputs old new i.e. our old initialize method is still getting called This uses the method_added hook which is called whenever a method is added (or redefined) at this point the new method already exists so it's too late to stop them from doing it. Instead we alias the freshly defined initialize method (you might want to work a little harder to ensure the method name is unique) and define another initialize that calls the old initialize method first and then the new one. If the person is sensible and calls super from their initialize then this would result in your original initialize method being called twice - you might need to guard against this You could just throw an exception from method_added to warn the user that they are doing a bad thing, but this doesn't stop the method from being added: the class is now in an unstable state. You could of course realias your original initialize method on top of their one. A: In your comment you say that in the c++ code, this is a null pointer. If it is possible to call a c++ class that way from ruby, I'm afraid there is no real solution. C++ is not designed to be fool-proof. Basically this happens in c++; Person * p = 0; p->name(); A good c++ compiler will stop you from doing this, but you can always rewrite it in a way the compiler cannot detect what is happening. This results in undefined behaviour, the program can do anything, including crash. Of course you can check for this in every non-static function; const string& Person::name() const { if (!this) throw "object not allocated"; return m_name; } To make it easier and avoid double code, create a #define; #define CHECK if (!this) { throw "object not allocated"; } const string& name() const { CHECK; return m_name; } int age() const { CHECK; return m_age; } However it would have been better to avoid in ruby that the user can redefine initialize. A: This is an interesting problem, not endemic to Rice, but to any extension which separates allocation and initialization into separate methods. I do not see an obvious solution. In Ruby 1.6 days, we did not have allocate/initialize; we had new/initialize. There may still be code left over in Rice which defines MyClass.new instead of MyClass.allocate and MyClass#initialize. Ruby 1.8 separated allocation and initialization into separate methods (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/23358) and Rice uses the new "allocation framework". But it has the problem you pointed out. The allocate method cannot construct the object, because it does not have the parameters to pass to the constructor. Rice could define .new instead (as was done on 1.6), but this doesn't work with #dup and Marshal.load. However, this is probably the safer (and right) solution. A: I now think that this is a problem of the Rice library. If you use Rice in the way it is documented, you get these problems and there is no obvious way to solve it and all workarounds have drawbacks and are terrible. So I guess the solution is to fork Rice and fix this since they seem to ignore bug reports.
unknown
d5398
train
without any line of code its hard to say how you are setting these Fragments , but you may need addToBackStack method or consider @Override onBackPressed properly. assuming notification is yours you can set id or whatever you need inside PendingIntent extras Bundle, obtain inside OnCreate method and then create a stack
unknown
d5399
train
Class base components can be thought of as being some sort of controller (invokable kind). When there's a need for accessing a service out of the service container and process the data received as props - class based components can handle it. In class based component, any service from Laravel's container can be injected via the constructor. For example: Say you are defining a component to show the total before tax, discount, tax and then the final grand total. A service can be defined to lookup the tax rates and perform tax and discount calculations with specific formulae and then this service can be injected via the components constructor - anonymous component won't be a good fit here. On the other hand say there's need to define a component for alert, the data required to be passed to the alert component would be message & type of alert. Then based on type of alert the colouring of alert component can be adjusted. Here there's no need to go for class based component as no complex processing is required. A: It is totally optional, but I may say that when your component relies on so many data variables and calculations or queries, you should consider using the class-based component to separate the logic behind the component and the rest of your application. As @Donkarnash said, class-based components are like Controllers. To give an example I have a class-based component like this: class Filters extends Component { public $post_caption; public $image_path; public $filter1 ="thePathToTheFilteredImage"; public $filter2 ="thePathToTheFilteredImage"; public $filter3 ="thePathToTheFilteredImage"; public $filter4 ="thePathToTheFilteredImage"; public $filter5 ="thePathToTheFilteredImage"; public $filter6 ="thePathToTheFilteredImage"; public $filter7 ="thePathToTheFilteredImage"; public $filter8 ="thePathToTheFilteredImage"; public $filter9 ="thePathToTheFilteredImage"; public $filter10 ="thePathToTheFilteredImage"; public $filter11 ="thePathToTheFilteredImage"; public $filter12 ="thePathToTheFilteredImage"; public $filter13 ="thePathToTheFilteredImage"; public function __construct($post_caption, $image_path) {} public function applyFilter($num) {} public function correctImageOrientation($imagepath, $effect, $newimagepath, $arg1, $arg2, $arg3, $arg4, $argnum) {} public function render() { return view('components.filters'); } } Then I have the blade template: <div class="max-w-4xl my-0 mx-auto"> <div class="grid grid-cols-3 gap-4 mx-0 mt-0 mb-10"> <div> <p class="text-center">{{__('original')}}</p> <img src="storage/{{$image_path}}" class="w-64 h-64 cursor-pointer" onClick=""> </div> <div> <p class="text-center">{{__('filter1')}}</p> <img src="{{$filter1}}" class="w-64 h-64 cursor-pointer" onClick=""> </div> <div> <p class="text-center">{{__('filter2')}}</p> <img src="{{$filter2}}" class="w-64 h-64 cursor-pointer" onClick=""> </div> <div> <p class="text-center">{{__('filter3')}}</p> <img src="{{$filter3}}" class="w-64 h-64 cursor-pointer" onClick=""> </div> <div> <p class="text-center">{{__('filter4')}}</p> <img src="{{$filter4}}" class="w-64 h-64 cursor-pointer" onClick=""> </div> ....**and so on**..... </div> </div> And that's the idea. Note: I have deleted the contents of functions and a lot of codes, this is just an example. I was already answering the question before you got your answer, but I decided that I will continue with my answer haha
unknown
d5400
train
Make use of ul <ul> <li><a href="index.php?p=home">Home</a></li> <li><a href="index.php?p=shopinfo">Shop Information</a></li> <li><a href="index.php?p=products">Products</a></li> <li><a href="index.php?p=cart">Cart</a></li> <li><a href="index.php?p=contact">Contact</a></li> </ul> CSS ul li { display:inline; padding:5px; } Here is the Demo A: There are a lot of options. You can use margin-right or padding. JS-fiddle: http://jsfiddle.net/7Uq9y/ <a href="index.php?p=home">Home</a> <a href="index.php?p=shopinfo">Shop Information</a> <a href="index.php?p=products">Products</a> <a href="index.php?p=cart">Cart</a> <a href="index.php?p=login">Login</a> <a href="index.php?p=contact">Contact</a> css: a{ margin-right: 50px; } A: Can you try using <nav> tag <nav> <a href="index.php?p=home">Home</a> <a href="index.php?p=shopinfo">Shop Information</a> <a href="index.php?p=products">Products</a> <a href="index.php?p=cart">Cart</a> <a href="index.php?p=login">Login</a> <a href="index.php?p=contact">Contact</a> </nav> CSS: nav { display:block; margin-left:auto; margin-right:auto; } A: CSS Using your existing html/php code : div#header a { margin-right: 10px; width: 150px; display: inline-block; } A: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Test Website</title> <style> #menubar{ position: relative; margin: 25px auto; padding-top: 20px; width: 900px; height: 100px; list-style: none; background: rgba(0,0,0,0.8); color: #ffffff; border-left: 2px solid #010000; border-right: 2px solid #010000; } #menubar ul { margin-top:15px; } #menubar ul li{ display: inline; margin: 25px 10px 15px 15px; padding: 25px; } #menubar ul li a{ font-weight: bold; text-decoration: none; color: #ffffff; font-size: 15px; } #menubar ul li a:hover{ border-bottom: 2px solid #ffffff; transition: opacity .5s ease-in; opacity: 1; } </style> </head> <body> <div id="menubar"> <ul> <li><a href="index.php?p=home">Home</a></li> <li><a href="index.php?p=shopinfo">Shop Information</a></li> <li><a href="index.php?p=products">Products</a></li> <li><a href="index.php?p=cart">Cart</a></li> <li><a href="index.php?p=login">Login</a></li> <li><a href="index.php?p=contact">Contact</a></li> </ul> </div> </body> </html>
unknown