_id
stringlengths
2
6
text
stringlengths
4
46k
title
stringclasses
1 value
d10701
Both ways to perform a delete operation are valid if the node has two children. Remember that when you get either the in-order predecessor node or the in-order successor node, you must call the delete operation on that node. A: It doesn't matter which one you choose to replace. In fact you may need both. Look at the following BST. 7 / \ 4 10 / \ / 1 5 8 \ 3 To delete 1, you need to replace 1 with right node 3. And to delete 10, you need to replace 10 with left node 8.
d10702
Instead of running an endless loop you may want to subscribe to the port's DataReceived event. You can then create a variable within the handler to read the data. var port = (SerialPort)sender; // Retrieve and write your data here This may be easier to debug since you can place a breakpoint in the handler. If you never receive any data then you may have a handshake problem.
d10703
There is only 1 reactive variable show. Setting it to true while all form is using v-if="show", will show everything. You can set show to something that each form uniquely have. For example, its text, and perform a v-if using its text. demo: https://jsfiddle.net/jacobgoh101/umaszo9c/ change v-if="show" to v-if="show === todo.text" <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> <div id="app"> <h2>Todos:</h2> <ol> <li v-for="(todo,key) in todos"> <p> {{ key+1 }} - {{ todo.text}} <span @click="toggle(todo)"><b>Contact</b></span> <div v-if="show === todo.text"> <hr /> <p> <label>Message</label> <input type="text"> </p> <hr /> </div> </p> </li> </ol> </div> change toggle method new Vue({ el: "#app", data: { todos: [{ text: "Learn JavaScript" }, { text: "Learn Vue" }, { text: "Play around in JSFiddle" }, { text: "Build something awesome" } ], show: '' }, methods: { toggle: function(todo) { if (this.show === todo.text) this.show = false else this.show = todo.text } } }) A: property "show" should be a prop of todo,not prop of data new Vue({ el: "#app", data: { todos: [{ text: "Learn JavaScript" }, { text: "Learn Vue" }, { text: "Play around in JSFiddle" }, { text: "Build something awesome" } ].map(o=>({...o,show:false})) }, methods: { toggle: function(todo) { todo.show = !todo.show } } }) body { background: #20262E; padding: 20px; font-family: Helvetica; } #app { background: #fff; border-radius: 4px; padding: 20px; transition: all 0.2s; } li { margin: 8px 0; } h2 { font-weight: bold; margin-bottom: 15px; } del { color: rgba(0, 0, 0, 0.3); } <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> <div id="app"> <h2>Todos:</h2> <ol> <li v-for="(todo,key) in todos"> <p> {{ key+1 }} - {{ todo.text}} <span @click="toggle(todo)"><b>Contact</b></span> <div v-if="todo.show"> <hr /> <p> <label>Message</label> <input type="text"> </p> <hr /> </div> </p> </li> </ol> </div>
d10704
I think that the private_ip property in the code above references to the property of the ec2 variable that's used to catch the returned values from the ec2 module (from the last step), no the one that you defined elsewhere. - name: Launch the new EC2 Instance local_action: ec2 group={{ security_group }} instance_type={{ instance_type}} image={{ image }} wait=true region={{ region }} keypair={{ keypair }} count={{count}} register: ec2 (this is where the variable is defined!!!) Essentially Ansible is complaining that the ec2 variable hasen't got the attribute 'private_ip' , so check the preceding code and see how that variable gets defined. In the example above you're trying to get the private_ip address from aws. Is that really what you want? Most of the time you want the public ip address since that's what you will use to connect to the ec2 machine, provision it, deploy your app etc...
d10705
Try to use CreateMuiTheme like global theme for some components and then just in components where you need specific style use other theme wrapper or another style. Also for component styles you can use makeStyles
d10706
I share your preference. Note that different Prolog systems have different top levels... SWI-Prolog gives me this: $ swipl ?- X = 10, Y = 10, Z = 10. X = Y, Y = Z, Z = 10. Traella Prolog says something quite similar: $ tpl ?- X = 10, Y = 10, Z = 10. X = 10, Y = X, Z = X. GNU-Prolog and Scryer Prolog, however, give me answers that I like better: $ gprolog | ?- X = 10, Y = 10, Z = 10. X = 10 Y = 10 Z = 10 yes $ scryer-prolog ?- X = 10, Y = 10, Z = 10. X = 10, Y = 10, Z = 10. A: change([H,Q,D,N,P]) :-member(H,[0,1,2]), /* Half-dollars /member(Q,[0,1,2,3,4]), / quarters /member(D,[0,1,2,3,4,5,6,7,8,9,10]) , / dimes /member(N,[0,1,2,3,4,5,6,7,8,9,10, / nickels /11,12,13,14,15,16,17,18,19,20]),S is 50H + 25Q +10D + 5*N,S =< 100,P is 100-S.
d10707
Update To understand more about how logback is configured you should pass -Dlogback.debug=true property to the jvm/play. This might save you hours of debbugging. Add a file in test/logback-test.xml (needs to be on classpath so it might depend on how the play application is configured to find tests resources) with a content like <configuration> <conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" /> <appender name="FILE" class="ch.qos.logback.core.FileAppender"> <file>${application.home:-.}/logs/application.log</file> <encoder> <pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern> </encoder> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%coloredLevel %logger{15} - %message%n%xException{5}</pattern> </encoder> </appender> <logger name="play" level="INFO" /> <logger name="application" level="INFO" /> <root level="ERROR"> <appender-ref ref="STDOUT" /> <appender-ref ref="FILE" /> </root> </configuration> A: I have not done this yet, but you have to configure a logback configuration file. See the play documentation for additional information: http://www.playframework.com/documentation/2.2.x/SettingsLogger Once you defined a specific logback configuration file, this needs to be placed in the test package, see this issue for details:https://github.com/playframework/playframework/issues/1669#issuecomment-24452132 See message from @benmccann: you can configure the logger in test mode by placing a logback-test.xml in test/resources (took me hours to figure out!).
d10708
Use group instead of animal_weight.animal.Note that from your sample data,Dog should have an average of weight (10+20+15)/3 = 15 kg results = FOREACH animal_by GENERATE group as animal_name, AVG(animal_weight.weight) as kg; Output
d10709
I found the problem. Somehow my WCF and ASP.NET installations became corrupted. Reinstalling fixed the problem.
d10710
You can take a look at The Boost Iostreams Library: #include <fstream> #include <boost/iostreams/filtering_stream.hpp> #include <boost/iostreams/filter/gzip.hpp> std::ifstream file; file.exceptions(std::ios::failbit | std::ios::badbit); file.open(filename, std::ios_base::in | std::ios_base::binary); boost::iostreams::filtering_stream<boost::iostreams::input> decompressor; decompressor.push(boost::iostreams::gzip_decompressor()); decompressor.push(file); And then to decompress line by line: for(std::string line; getline(decompressor, line);) { // decompressed a line } Or entire file into an array: std::vector<char> data( std::istreambuf_iterator<char>(decompressor) , std::istreambuf_iterator<char>() ); A: You need to use inflateInit2() to request gzip decoding. Read the documentation in zlib.h. There is a lot of sample code in the zlib distribution. Also take a look at this heavily documented example of zlib usage. You can modify that one to use inflateInit2() instead of inflateInit(). A: Here is a C function that does the job with zlib: int gzip_inflate(char *compr, int comprLen, char *uncompr, int uncomprLen) { int err; z_stream d_stream; /* decompression stream */ d_stream.zalloc = (alloc_func)0; d_stream.zfree = (free_func)0; d_stream.opaque = (voidpf)0; d_stream.next_in = (unsigned char *)compr; d_stream.avail_in = comprLen; d_stream.next_out = (unsigned char *)uncompr; d_stream.avail_out = uncomprLen; err = inflateInit2(&d_stream, 16+MAX_WBITS); if (err != Z_OK) return err; while (err != Z_STREAM_END) err = inflate(&d_stream, Z_NO_FLUSH); err = inflateEnd(&d_stream); return err; } The uncompressed string is returned in uncompr. It's a null-terminated C string so you can do puts(uncompr). The function above only works if the output is text. I have tested it and it works. A: Have a look at the zlib usage example. http://www.zlib.net/zpipe.c The function that does the real work is inflate(), but you need inflateInit() etc.
d10711
Rather than using two different functions and moving one object within each, you might find better results keeping track of where each object should be, and using one function to draw both. It's a little hard to tell what's going on in your code since some functions and variable declarations are missing (I don't see you ever actually drawing a bullet, for example - might be a bug in your BulletPattern?), but something like this might do the trick: void GameMovements() { while (true) { //MOVEMENTS FOR PLAYER 1 if (GetAsyncKeyState(VK_LEFT) && Player1XCoordinate != GAMEBOARD_LEFT) { Player1XCoordinate -= 3; } else if (GetAsyncKeyState(VK_RIGHT) && Player1XCoordinate != GAMEBOARD_RIGHT) { Player1XCoordinate += 3; } else if (GetAsyncKeyState(VK_UP) && Player1YCoordinate != SPACESHIP_TOP) { Player1YCoordinate -= 2; } else if (GetAsyncKeyState(VK_DOWN) && Player1YCoordinate != SPACESHIP_BOTTOM) { Player1YCoordinate += 2; } Sleep(10); UpdateBulletPosition(); DrawObjects(); } } void UpdateBulletPosition() { //if the bullet hits the top of the screen, remove it if (bulletYCoordinate == GAMEBOARD_TOP) { bulletXCoordinate = 0; bulletYCoordinate = 0; } //I assume you're automatically generating bullets whenever possible; you'll have to adjust this conditional if that's not the case //no bullet? generate one if (bulletXCoordinate == 0) { bulletXCoordinate = Player1XCoordinate + 3; bulletYCoordinate = 25; } else { bulletYCoordinate--; Sleep(100); } } void DrawObjects() { //wipe the screen and show status first system("cls"); GameBorderAndStatus(); SetCoordinate(Player1XCoordinate, Player1YCoordinate); cout << " ^ \n"; SetCoordinate(Player1XCoordinate, Player1YCoordinate + 1); cout << "^==|==^ \n"; //only draw the bullet if there's a bullet there to draw if (bulletXCoordinate != 0) { SetCoordinate(bulletXCoordinate, bulletYCoordinate); cout << ".\n"; } } const int GAMEBOARD_LEFT = 16; const int GAMEBOARD_RIGHT = 94; const int GAMEBOARD_TOP = 3; const int SPACESHIP_TOP = 24; const int SPACESHIP_BOTTOM = 28; int Player1XCoordinate = 55, Player2XCoordinate = 55; int Player1YCoordinate = 28; int bulletXCoordinate = 0, bulletYCoordinate = 0; I also made some tweaks to the rest of your code. Every case in your if-else block used the same basic drawing code, so I pulled that out of the if-else entirely. That also let me drop the entire initialization if-else. I also dropped one of your vertical coordinates for the spaceship. You really don't need two; just keep track of the upper coordinate and draw the lower half of the ship at Player1YCoordinate + 1. Finally, I replaced your hardcoded board edges with constants. Magic numbers are generally frowned upon; using named constants makes it easier to determine why you're using a given value in a given location, as well as making it easier to update the code in the future (perhaps you need to update for a different console size).
d10712
You can group by ID, and make use of lag, if I'm interpreting your question correctly! library(dplyr) sick %>% arrange(ID, SickStartDate) %>% group_by(ID) %>% mutate(EndLastSick = case_when( # if this is the first record for this person, use RecordBegins is.na(lag(SickEndDate)) ~ RecordBegins, # otherwise, get the most recent SicKEndDate TRUE ~ lag(SickEndDate) )) ## A tibble: 4 x 5 ## Groups: ID [2] # ID RecordBegins SickStartDate SickEndDate EndLastSick # <chr> <date> <date> <date> <date> #1 person1 1990-01-01 2017-03-04 2017-07-01 1990-01-01 #2 person1 1990-01-01 2018-11-01 2019-02-04 2017-07-01 #3 person2 1995-01-01 2014-10-07 2017-01-04 1995-01-01 #4 person2 1995-01-01 2017-11-01 2017-11-23 2017-01-04 Data: sick <-tribble( ~ID, ~RecordBegins, ~SickStartDate, ~SickEndDate, "person1", as.Date("1990-01-01"), as.Date("2017-03-04"), as.Date("2017-07-01"), "person1", as.Date("1990-01-01"), as.Date("2018-11-01"), as.Date("2019-02-04"), "person2", as.Date("1995-01-01"), as.Date("2014-10-07"), as.Date("2017-01-04"), "person2", as.Date("1995-01-01"), as.Date("2017-11-01"), as.Date("2017-11-23"), ) A: This is similar to @heds1's answer but using only lag function. library(dplyr) sick %>% arrange(ID, SickStartDate, SickEndDate) %>% group_by(ID) %>% mutate(EndLastSick = lag(SickEndDate, default = first(RecordBegins))) %>% ungroup # ID RecordBegins SickStartDate SickEndDate EndLastSick # <chr> <date> <date> <date> <date> #1 person1 1990-01-01 2017-03-04 2017-07-01 1990-01-01 #2 person1 1990-01-01 2018-11-01 2019-02-04 2017-07-01 #3 person2 1995-01-01 2014-10-07 2017-01-04 1995-01-01 #4 person2 1995-01-01 2017-11-01 2017-11-23 2017-01-04
d10713
I have Faced Same issue just i have changed the Version on mysql server connector than works fine <!-- commented as it was not make to connect <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.34</version> </dependency> --> added latest version of mysql connector <!-- added latest version of mysql connector --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.18</version> </dependency> A: I know this post is almost 2 years old, but for me the questions gave me, for me, the right answer. And because people with the same question are getting this post from Google. I thought, lets add my story. Same thing, same problem. And for me the answer was that SQL Server didn't accept connections from the outside. The tcp/ip network client configuration is standard disabled. So it was for me a hint in the right direction. A: I changed the version of MySql like, From 5.1.8 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.8</version> </dependency> To 8.0.19 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.19</version> </dependency> It works for me. Thank you. A: Use This with all Permission of DB <property name="hibernate.connection.url">jdbc:mysql://ip:3306/dbname</property><property name="hibernate.connection.username">*******</property> <property name="hibernate.connection.password">*******</property> A: Try going to the command line and see if sqlserver is indeed listening to that port. On windows this would be the command: netstat -nao | findstr 1433 Then see if the PID is Sql Server as expected in the windows (Ctr+Alt+Delete) process list. If the server is running, try to connect to it using a SQL client GUI, see here for examples. When you can connect to the database from an external client successfully, try again from the Java program. Try to see also if your local firewall settings to see if the firewall is the cause for the error, although by default firewalls do not block localhost - have a look at this answer. A: Check you Sid in hibernate.cfg.xml file For Oracle Express Edition: <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:xe</property> For Oracle Enterprise Edition: <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property> A: the error is due to AnnotationConfiguration and making session by it. you can try this solution: @Autowired SessionFactory sessionFactory; Session session = sessionFactory.getCurrentSession(); session.saveOrUpdate(ce); A: I also face same problem due to some dependency issue. i solve my problem to change sql depenedency which is compatible to my current version of sql server in pom.xml file. A: I had a same error when migrating from jTDS1.2.8 to mssql-jdbc and for me it helped removing the port number and specifying the named instance in the connection URL within hibernate.cfg.xml From: <property name="hibernate.connection.url">jdbc:sqlserver://MYHOSTNAME:1433;databaseName=mydbname;instanceName=MYINSTANCENAME;</property> To: <property name="hibernate.connection.url">jdbc:sqlserver://MYHOSTNAME;instanceName=MYINSTANCENAME;databaseName=mydbname;</property> Reference: https://learn.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-2017 When using Named and Multiple SQL Server Instances, to use a JDBC URL property, do the following: jdbc:sqlserver://localhost;instanceName=instance1;integratedSecurity=true;<more properties as required>; A: if you are using a virtual server or server that is not updated the time zone should update it. SQL CONSOLE: SET GLOBAL time_zone = '+3:00'; A: Wrong username or a password in a config hibernate file "hibernate.cfg.xml" A: Please make sure that the database with which you are trying to connect has already been created in the database with the same name. A: If you're using Hibernate 4, try switching to Hibernate 5. <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.4.10.Final</version> </dependency> This helped me resolve the error.
d10714
The issue has been resolved based on suggestions found on the web but sorry can not remember the url. public int getTouchPosition(MotionEvent motionEvent){ // Transient properties int mDismissAnimationRefCount = 0; float mDownX; int mDownPosition=-1; View mDownView=null; // Find the child view that was touched (perform a hit test) Rect rect = new Rect(); int childCount = mListView.getChildCount(); int[] listViewCoords = new int[2]; mListView.getLocationOnScreen(listViewCoords); int x = (int) motionEvent.getRawX() - listViewCoords[0]; int y = (int) motionEvent.getRawY() - listViewCoords[1]; View child; for (int i = 0; i < childCount; i++) { child = mListView.getChildAt(i); child.getHitRect(rect); if (rect.contains(x, y)) { mDownView = child; break; } } if (mDownView != null) { mDownX = motionEvent.getRawX(); mDownPosition = mListView.getPositionForView(mDownView); } return mDownPosition; } Can use the position to get the cursor position used to populate the view Cursor cursor = (Cursor)mListView.getItemAtPosition(mDownPosition);
d10715
I know this is an old post, but I had the same problem and I found a solution. I found the solution here: https://github.com/seesharper/LightInject/issues/350 The code on that page is this: public static class ContainerExtensions { public static void RegisterCommandHandlers(this IServiceRegistry serviceRegistry) { var commandTypes = Assembly.GetCallingAssembly() .GetTypes() .Select(t => GetGenericInterface(t, typeof(ICommandHandler<>))) .Where(m => m != null); RegisterHandlers(serviceRegistry, commandTypes); serviceRegistry.Register<ICommandExecutor>(factory => new CommandExecutor((IServiceFactory)serviceRegistry)); serviceRegistry.Decorate(typeof(ICommandHandler<>), typeof(TransactionalCommandDecorator<>)); } public static void RegisterQueryHandlers(this IServiceRegistry serviceRegistry) { var commandTypes = Assembly.GetCallingAssembly() .GetTypes() .Select(t => GetGenericInterface(t, typeof(IQueryHandler<,>))) .Where(m => m != null); RegisterHandlers(serviceRegistry, commandTypes); serviceRegistry.Register<IQueryExecutor>(factory => new QueryExecutor((IServiceFactory)serviceRegistry)); serviceRegistry.Decorate(typeof(IQueryHandler<,>), typeof(QueryHandlerLogDecorator<,>)); } private static Tuple<Type, Type> GetGenericInterface(Type type, Type genericTypeDefinition) { var closedGenericInterface = type.GetInterfaces() .SingleOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == genericTypeDefinition); if (closedGenericInterface != null) { var constructor = type.GetConstructors().FirstOrDefault(); if (constructor != null) { var isDecorator = constructor.GetParameters().Select(p => p.ParameterType).Contains(closedGenericInterface); if (!isDecorator) { return Tuple.Create(closedGenericInterface, type); } } } return null; } private static void RegisterHandlers(IServiceRegistry registry, IEnumerable<Tuple<Type, Type>> handlers) { foreach (var handler in handlers) { registry.Register(handler.Item1, handler.Item2); } } } Hope it can help someone else too :) Cheers!
d10716
not sure if you have solved this problem. i came across the same thing last week. I am on Celery 4.1 and the solution I came up with was to just define the exchange name and the routing_key so in your publish method, you would do something like: def publish(self, task_name, job_id=None, params={}): if not job_id: job_id = uuid.uuid4() self.celery.send_task( task_name, [job_id, params], exchange='name.of.exchange', routing_key='*' )
d10717
@hillct there is an option called prefix, thank you for pointing out that the options aren't documented. Here is how to use it: var Gun = require('gun'); var gun = Gun({ file: 'data.json', s3: { key: '', // AWS Access Key secret: '', // AWS Secret Token bucket: '', // The bucket you want to save into prefix: 'gun/' } }); And just in case, here are some of the other options: { throttle: 15 // Throttle writes to S3 in 15 second intervals, keeps S3 API costs down. batch: 10 // Or if there are more than 10 things in queue, don't wait. }
d10718
Since the restriction from using toupper strikes me as silly and counterproductive, I'd probably respond to such an assignment in a way that followed the letter of the prohibition while side-stepping its obvious intent, something like this: #include <locale> #include <iostream> struct make_upper : private std::ctype < char > { void operator()(std::string &s){ do_toupper(&s[0], &s[0]+s.size()); } }; int main() { std::string input = "this is some input."; make_upper()(input); std::cout << input; } This, of course, produces the expected result: THIS IS SOME INPUT. Unlike the other answers I see posted here, this still gains all the normal advantages of using toupper, such as working on a machine that uses EBCDIC instead of ASCII encoding. At the same time, I suppose I should admit that (for one example) when I was in fifth grade I was once told to do something like "write 'I will not talk in class', 50 times." so I turned in a paper containing one sentence that read "I will not talk in class 50 times." Sister Mary Ellen (yes, Catholic schools) was not particularly pleased. A: The std::transform function with a lambda expression is one way to do it: std::string s = "all uppercase"; std::transform(std::begin(s), std::end(s), std::begin(s), [](const char& ch) { return (ch >= 'a' && ch <= 'z' ? ch - 32 : ch) }); std::cout << s << '\n'; Should output ALL UPPERCASE But only if the system is using the ASCII character set (or the ch - 32 expression will give unexpected results). A: This is correct. But you should take care to add checks on the input. You could check if the characters are lowercase alphabets. if (x[y] <= 'z') && (x[y] >= 'a') x[y] = x[y] - 32; For readability, you should replace 32 by 'a' - 'A'. Also, your first function does nothing. It creates a copy of the string. Does the required actions on it. And then discards it because you are not returning it, and the function ends. A: Sample Code: * *With correct checks of the range. *With C++11 version (using range-for-loop). Note: the production version should be using toupper. But the OP specifically state that can't used. Code: #include <iostream> const char upper_difference = 32; void uppercaseCpp11(std::string& str) { for (auto& c : str) { if (c >= 'a' && c <= 'z') c -= upper_difference; } } std::string UppercaseCpp11(std::string str) { uppercaseCpp11(str); return str; } void uppercase(std::string& x) { for (unsigned int i = 0; i < x.size(); ++i) { if (x[i] >= 'a' && x[i] <= 'z') x[i] -= upper_difference; } } std::string Uppercase(std::string x) { uppercase(x); return x; } int main() { std::cout << Uppercase("stRing") << std::endl; std::string s1("StrinG"); uppercase(s1); std::cout << s1 << std::endl; std::cout << UppercaseCpp11("stRing") << std::endl; std::string s2("StrinG"); uppercaseCpp11(s2); std::cout << s2 << std::endl; return 0; } A: string x = "Hello World"; char test[255]; memset(test, 0, sizeof(test)); memcpy(test, x.c_str(), x.capacity()); for (int i = 0; i < x.capacity(); i++) { if (test[i] > 96 && test[i] < 123) test[i] = test[i] - 32; } x.assign(test);
d10719
Something like this to look at each cell. Another option to avoid looking at each cell would be to alter your range "Sheet1!B3:D6" so that it only was set to cells below 50. But this would require constant tracking and re-evaluating the range for changes with events. So for a 12 cell range, the loop approach below should suffice. Public NextFlash As Double Public Const FR As String = "Sheet1!B3:D6" Sub StartFlashing() Dim rng1 As Range For Each rng1 In Range(FR).Cells If rng1.Value < 50 Then If rng1.Interior.ColorIndex = 3 Then rng1.Interior.ColorIndex = xlColorIndexNone Else rng1.Interior.ColorIndex = 3 End If Else rng1.Interior.ColorIndex = xlColorIndexNone End If Next NextFlash = Now + TimeSerial(0, 0, 1) Application.OnTime NextFlash, "StartFlashing", , True End Sub Sub StopFlashing() Range(FR).Interior.ColorIndex = xlColorIndexNone Application.OnTime NextFlash, "StartFlashing", , False End Sub
d10720
A HUGE thanks to Kul-Tigin for providing the answer for the USE of ADO ActiveX which I did not even think about. I was not searching properly the ODBC connection methods and always fell on VBScript. So here is a working code of a personal test I did after installing the latest MySQL ODBC Connector as of the date of this comment. var hmess = document.getElementById("mess"); var oconn = new ActiveXObject("ADODB.Connection"); var ors = new ActiveXObject("ADODB.Recordset"); var sconn = ""; var scn_driver = "DRIVER=MySQL ODBC 8.0 Unicode Driver;"; var scn_server = "SERVER=localhost;"; var scn_database = "DATABASE=DatabaseName;"; var scn_userid = "USER ID=UserName;"; var scn_password = "PASSWORD=UserPassword;"; var ssql = "SELECT * FROM Table WHERE IDField=1"; sconn = scn_driver + scn_server + scn_database + scn_userid + scn_password; oconn.Open(sconn); ors.Open(ssql,oconn); ors.MoveFirst(); hmess.innerHTML = ors("TableFieldName"); ors.Close(); oconn.Close(); Thank you for the answers and your help.
d10721
This looks like a bug 7042153, aka 2210012 reported in early May. Note the workaround offered by one user: using the "-server" JVM option fixed it for them. A: Try Java 1.6.0_20, and check if that works. You have found a JVM bug, and going back 6 minor versions might be enought to get this running. You are lucky in the way that this bug is reproducable, so create a minimal testcase and post it to the Oracle bug database.
d10722
Question 1. For that you would need javascript, javascript is used for adding behaviour to websites. I would recommend using a javascript framework called Jquery for that. You would do this by adding an html "id" or "class" to the inputs that have the value you want to recieve from the users and an "id" to the field where you would display the results of those calculations. You would create an javascript event that basically tracks whenever any html object that has the class you used for the inputs above was changed, when that happens you do your calculations, and post the results on the result field you decided, using it's "id" identifier. Take a look at this link for more info Question 2. For that you would have to do what is called "Web scraping": First you read the html source code of the page you want to get the information from and look at the ID of the HTML object you want to get the information from (If it doesn't have an ID, you would then have to look at the Hierarchy of it (What is also known as the Document Object Model DOM), looking at with Objects it's inside of) then you create a script that reads the HTML and looks for that ID or follows the Hierarchy you discovered and reads the text in that HTML object. Remember that HTML is just text. I'm more used to the Ruby programming language, in ruby there is a module you download for that, but I'm sure that there is one called "Mechanize" for Python. Question 3. You could use Flask which is a light and simple micro-framework for python Python, from the needs you describe, it sounds like perfect fit. A: To achieve your goal, you need good knowledge of javascript, the language for dynamic web pages. You should be familiar with dynamic web techniques, AJAX, DOM, JSON. So the main part is on the browser side. Practically any python web server fits. To "bridge the gap" the keyword is templates. There are quite a few for python, so you can choose, which one suites you best. Some frameworks like django bring their own templating engine. And for your second question: when a web site doesn't offer an API, perhaps the owner of the site does not want, that his data is abused by others.
d10723
* *It won't work because your __setProperty() function call doesn't make sense at all and it's syntactically incorrect *Since JMeter 3.1 you're supposed to use JSR223 Test Elements and Groovy language for scripting So * *Remove your Beanshell Assertion *Add JSR223 PostProcessor as a child of the request which returns the above response *Put the following code into "Script" area: props.put('chat_id', new groovy.json.JsonSlurper().parse(prev.getResponseData()).id as String) *In 2nd Thread Group access the value using __P() function as: ${__P(chat_id,)} Demo: More information regarding what these prev and props guys mean can be found in the Top 8 JMeter Java Classes You Should Be Using with Groovy article P.S. You may find Inter-Thread Communication Plugin easier to use
d10724
I might be due to file access control set to root:daemon. If you run getfacl /home/user it should tell you if that was the problem. If yes, then you can set per-folder with the command setfacl with the parameters you prefer. Another cause that comes to my mind is if that is a mountpoint masked with those particular user and group; you can check that with cat /etc/fstab.
d10725
Googles official answer can be found here - Get the currently signed-in user - Firebase Below is a function that returns a promise of type string. The promise resolves with the user's uid which is returned from onAuthStateChangedwhich() along with the rest of the user's firebase auth object(displayName...etc). getCurrentUser(): Promise<string> { var promise = new Promise<string>((resolve, reject) => { this.afAuth.auth.onAuthStateChanged(returnedUser => { if (returnedUser) { resolve(returnedUser.uid); } else { reject(null); } }); }) return promise } You would call it in the constructor or ngOninit: userDoc: User = null; constructor() { this.getCurrentUser().then((userID: string) => { //here you can use the id to get the users firestore doc this.afs.collection('users').doc(userID).valueChanges() .subscribe(userFirestoreDoc => { // remember to subscribe this.userDoc = userFirestoreDoc; }) }).catch(nullID => { //when there is not a current user this.userDoc = null }) } To add a collection for 'vacations' nested in the users doc you need to add a sub collection to the that users firestore doc. I would advise only doing this once the user gets/adds their first vacation. You can simply set a doc in the subcollection and if the sub collection doesn't already exist firestore will first create it and then add the new doc(vaction) so this is the only code you need to set the new collection and new vaction inside that collectio. this.afs.collection('users').doc(this.userDoc.uid).collection('vacations).add(vactionObject).then(returnedVaction => { }).catch(error => { }) A: users =》last login This field on the google auth user object is updated on every new login with the time of the last success login
d10726
This is a timing issue. fs.readFile is an asynchronous operation - your second console.log that doesn't work is getting processed immediately after fs.readFile starts running and your threadArray is not yet populated. You can use fs.readFileSync instead try { var threads = fs.readFileSync('./database/threadList.txt'); var threadIds = threads.toString().split('\n'); for(i in threadIds) { threadArray[i] = threadIds[i].split(","); } console.log("This works: " + threadArray[0]); } catch (e) { console.error("Error reading file: ", e); }
d10727
What do you mean by saying zulu jdk without JCE? Official zulu jdk is provided with all required crypto libraries and providers. In case of you manually exclude some of the providers or libraries you'll miss corresponding functionality. For example SunEC crypto provider is responsible for ECDSA and ECDH algorithms implementation. Excluding SunEC from the list of providers or disabling/removing jdk.crypto.ec module, you'll miss all TLS_ECDH_ECDSA_* TLS_ECDHE_ECDSA_* cipher suites. It could be a reason of your TLS handshake failure. A: Clean alpine docker image with Zulu 11 jdk shows the following: $ docker run alpn_zulu more /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.10.2 PRETTY_NAME="Alpine Linux v3.10" HOME_URL="https://alpinelinux.org/" BUG_REPORT_URL="https://bugs.alpinelinux.org/" $ docker run alpn_zulu java -version openjdk version "11.0.4" 2019-07-16 LTS OpenJDK Runtime Environment Zulu11.33+15-CA (build 11.0.4+11-LTS) OpenJDK 64-Bit Server VM Zulu11.33+15-CA (build 11.0.4+11-LTS, mixed mode) $ docker run alpn_zulu jrunscript -e "java.util.Arrays.asList(javax.net.ssl.SSLServerSocketFactory.getDefault().getSupportedCipherSuites()).stream().forEach(println)" Warning: Nashorn engine is planned to be removed from a future JDK release TLS_AES_128_GCM_SHA256 TLS_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 TLS_RSA_WITH_AES_256_GCM_SHA384 TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_128_GCM_SHA256 TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 TLS_RSA_WITH_AES_256_CBC_SHA256 TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_256_CBC_SHA TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA TLS_ECDH_RSA_WITH_AES_256_CBC_SHA TLS_DHE_RSA_WITH_AES_256_CBC_SHA TLS_DHE_DSS_WITH_AES_256_CBC_SHA TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 TLS_RSA_WITH_AES_128_CBC_SHA256 TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA TLS_ECDH_RSA_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_AES_128_CBC_SHA TLS_DHE_DSS_WITH_AES_128_CBC_SHA TLS_EMPTY_RENEGOTIATION_INFO_SCSV
d10728
DrupalCoreRenderMarkup should do the trick: <?php use Drupal\Core\Render\Markup; function module_page_attachments(array &$page) { $tags = [ ["name" => "twitter:card", "content" => "summary"], ["name" => "og:url", "content" => Markup::create("https://example.net/index.php?param1=1&param2=2&param3=3")], ["name" => "og:title", "content" => "My title"], ["name" => "og:description", "content" => "My description"], ["name" => "og:image", "content" => Markup::create("https://example.net/images?id=1&size=400")], ]; foreach ($tags as $tag) { $headerTag = array( '#tag' => 'meta', '#attributes' => array( 'property' => $tag['name'], 'content' => $tag['content'], ), ); $page['#attached']['html_head'][] = [$headerTag, $tag['name'] . "Id"]; } } A: There is an open ticket for issue with the status needs work on drupal's website. The issue can be found here: www.drupal.org/project/drupal/issues/2968558 A work around to solve the issue is to intercept the page and alter its template in the module file like the example here below shows: file name: example.module /** * Drupal bug caused the application to escape links. Therefore the og:image and og:url * were not working. Drupal kept converting `&` to `&amp;` * The solution here below converts the tags into inline templates */ function spa_seo_page_attachments_alter(array &$attachments) { if (isset($attachments['#attached']['html_head'])) { foreach ($attachments['#attached']['html_head'] as $key => $item) { $property = !empty($item[0]['#attributes']['property']) ? $item[0]['#attributes']['property'] : ''; if ($property == "og:url" || $property == "og:image") { $content = $item[0]['#attributes']['content']; $property = $item[0]['#attributes']['property']; $attachments['#attached']['html_head'][$key][0] = [ '#type' => 'inline_template', '#template' => "{{ meta|raw }}", '#context' => [ 'meta' => '<meta property="' . $property . '" content="' . $content . '" />', ] ]; } } } } Note Please note that DrupalCoreRenderMarkupdoes not solve the issue as this is a bug.
d10729
You're looking for $.fn.dataTable.tables() - DataTables's static function. It can be useful to be able to get a list of the existing DataTables on a page, particularly in situations where the table has scrolling enabled and needs to have its column widths adjusted when it is made visible. This method provides that ability.
d10730
Instead of setting the central widget to central you should try using scroll as your central widget. Thus, the proper line would be: this->setCentralWidget(scroll); Remember the scroll area uses central as the widget it contains already, so setting it as the central widget doesn't actually make sense.
d10731
You can add a background service. Nothing to do with Blazor, just Asp.Net: It's just one line in the Startup class: public void ConfigureServices(IServiceCollection services) { ... services.AddHostedService<MyBackgroundService>(); } and then implement your own MyBackgroundService with a loop or a Timer.
d10732
Try this: filename=["1.txt","2.txt","3.txt"] for file in filename: with open(file,'r/w') as f: #r for reading w for writing #Other code Or if you want to iterate throught all files from a folder then try this: import os filename=os.listdir("/path/to/folder you want the files from") for file in filename: with open(file,'r/w') as f: #r for reading w for writing #Other code
d10733
Double check that you spelled everything exactly as it is in the database. In your example, you state the table name is "Achievements" however reference "Achievement" in two places. Fixing that should solve your issue. Final SQL is as follows: CREATE TRIGGER "checkAllAchievements" AFTER UPDATE ON Achievements WHEN (SELECT SUM(Completed) FROM Achievements) = (SELECT COUNT(Completed)-1 FROM Achievements) BEGIN UPDATE Achievements SET Completed=1 WHERE Name='AllCompleted'; END; A: typically this would be a mutation in the table you are updating... the trigger should just set the value something like new_rec.completed := 1; not try to do another update. (excuse my Oracle syntax) A: I think you should not update a table from a trigger on updating of that table, could be a infinite recursion. Maybe SQLite doesn't like that, but give a bad diagnositic
d10734
First, check your realtime firebase, sometimes if you use free, your realtime firebase has expired (for 1 month). You can print it by inputting a simple value, for example: If nothing happens, then check your project's API, library, or expiration date. Solution: Create a new project.
d10735
Basically, right now, the drop event occurs again and again, whether you're dragging images from outside or inside the container. The simplest solution is to check whether an image is already inside the container, and if so, do not add it to the container: jQuery(function($) { $('.drop-zone').droppable({ accept: '.drag', drop: function(event, ui) { var $clone = ui.helper.clone(); if (!$clone.is('.inside-drop-zone')) { $(this).append($clone.addClass('inside-drop-zone').draggable({ containment: '.drop-zone' })); } } }); $('.drag').draggable({ helper: 'clone' }); });
d10736
Android does not have such functions built in, and the process is not at all trivial. If you would like to try and code it yourself, I suggest looking at such algorithms as PSOLA, WSOLA and Phase Vocoder for pitch alteration. The book DAFX by Udo Zölzer discusses many of these in quite good detail and most of it is fairly straightforward. Phase Vocoder, I believe, works the fastest, but also takes more DSP and mathematical knowledge to understand. PSOLA is perhaps the least mathematically complicated. I personally prefer WSOLA and Enhanced WSOLA (EWSOLA), but those take quite a bit of processing power. For correlation techniques (if you use WSOLA) I suggest doing it if frequency domain (Google FFT-based correlation). It is much quicker. If most of this had just gone over your head, you might want to reconsider doing this altogether, but I by no means try to discourage you. = )
d10737
As far as I understood you want to mark certain pixels based on a label and you have the pixel/label as a data frame. You only need to define markers and colors and iterate over your data frame. The following will do this import pandas as pd import matplotlib.pyplot as plt data = {'X': [200, 246, 387, 86, 100], 'Y': [100, 200, 34, 98, 234], 'Texture': [0,1,2,3,4]} data = pd.DataFrame(data) img = plt.imread("img.jpg") # Define symbols and colors as you want. # Item at ith index corresponds to that label in 'Texture'. color = ['y', 'r', 'b', 'g', 'm'] marker = ['o', 'v', '1', 's', 'p'] # fig, ax = plt.subplots() ax.imshow(img, extent=[0, 400, 0, 300]) # for _, row in data.iterrows(): ax.plot(row['X'], row['Y'], marker[row['Texture']],color=color[row['Texture']]) plt.show() If you have your data as python dictionary, you can Zip the dictionary values and iterate over them. The following will do it, import matplotlib.pyplot as plt data = {'X': [200, 246, 387, 86, 100], 'Y': [100, 200, 34, 98, 234], 'Texture': [0,1,2,3,4]} img = plt.imread("img.jpg") # Define symbols and colors as you want. # Item at ith index corresponds to that label in 'Texture'. color = ['y', 'r', 'b', 'g', 'm'] marker = ['o', 'v', '1', 's', 'p'] # Zip the data, returns a generator of paired (x_i, y_i, texture_i) data_zipped = zip(*(data[col] for col in data)) # fig, ax = plt.subplots() ax.imshow(img, extent=[0, 400, 0, 300]) # for x,y, texture in data_zipped: ax.plot(x, y, marker[texture],color=color[texture]) plt.show()
d10738
Maybe you could just store the profile in the user's Dropbox (e.g. via the Datastore API). Then you don't have to worry about it at all... only the authenticated user can see his or her own data. Otherwise you could just use the user ID. If you're doing this server-side, pass the OAuth token to the server, and on the server call /account/info to get the user ID. Then just tie the profile to that user ID.
d10739
Activating LFS locally (git-lfs.github.com as you mention) is a good first step. Check also the prerequisites and limitations at Azure DevOps Azure Repos / Use Git Large File Storage (LFS) Finally, if you just added/committed the large file, it is better to reset that commit (assuming you don't have any other work in progress), and then track it through lfs: git reset @~ git lfs track lyLargeFile git A: After fighting with git for weeks, I have finally solved this. the answer for me was to clone the repo again using SSH instead of HTTP.
d10740
Solved. mounted() { window.Echo.channel(`laravel_database_new-payload.${this.city_id}`) .listen('.new-payload-event', (e) => { console.info('listen'); console.log(e.payload); }) } public function broadcastOn() { return new Channel('new-payload.'.$this->payload->city_id); }
d10741
This is because you declared BR(int), but not BR(bool), to be const. Then when you call BR(int) on a non-const object, the compiler has two conflicting matching rules: parameter matching favours BR(int), but const-ness matching favours BR(bool).
d10742
Something like this should work. Put it into the code module for the sheet you want to apply it to. Private Sub worksheet_change(ByVal target As Range) ''''' CHECK IF THE CHANGED CELL IS IN RANGE A1:A99 (OR ANY OTHER RANGE YOU DEFINE) If Not Intersect(target, Range("A1:A99")) Is Nothing Then ''''' UNPROTECT THE SHEET ActiveSheet.Unprotect ''''' IF THE CELL CHANGED IS NOW 'YES' If target = "Yes" Then ''''' WE DEFINE HOW MANY COLUMNS TO MOVE ACROSS FROM THE CELL THAT CHANGED AND DO THE ACTIONS IN THE CODE BELOW ''''' SO IN THIS EXAMPLE WE'RE MOVING ACROSS 1 CELL TO B1 AND THEN 2 CELLS TO C1 ''''' SO TO GET TO AA1 AND AB2 WE'D DO i = 26 to 27 ''''' IF WE WANTED TO ACCESS AA1 ALL THE WAY THROUGH TO AZ1 WE'D DO i = 26 to 51 For i = 1 To 2 ''''' MOVE ACROSS i NUMBER OF CELLS FROM THE CELL THAT CHANGED With target.Offset(0, i) ''''' UNLOCK THE CELL .Locked = False '''''SET THE CONDITIONAL FORMATTING .FormatConditions.Add Type:=xlExpression, Formula1:="=ISBLANK(" & target.Offset(0, i).Address & ")" With .FormatConditions(.FormatConditions.Count) .SetFirstPriority .Interior.ColorIndex = 37 End With End With ''''' INCREASE i BY 1 AND LOOP TO AFFECT THE NEXT CELL Next i ''''' IF THE CELL CHANGED IS NOW 'NO' ElseIf target = "No" Then ''''' WE DEFINE HOW MANY COLUMNS TO MOVE ACROSS FROM THE CELL THAT CHANGED AND DO THE ACTIONS IN THE CODE BELOW For i = 1 To 2 ''''' MOVE ACROSS i NUMBER OF CELLS FROM THE CELL THAT CHANGED With target.Offset(0, i) ''''' SET THE CELL VALUE TO BLANK .Value = "" ''''' LOCK THE CELL .Locked = True ''''' REMOVE THE CONDITIONAL FORMATTING .FormatConditions.Delete ''''' ADD NEW CONDITIONAL FORMATTING HERE IF REQUIRED End With ''''' INCREASE i BY 1 AND LOOP TO AFFECT THE NEXT CELL Next i End If '''''PROTECT THE SHEET ActiveSheet.Protect End If End Sub Be sure to set locked to false in your A column where the drop down lists are or users won't be able to change the drop down value while the sheet is locked.
d10743
It's done with 2 scroll views, one in front of the other. One scroll view (A) contains the small numbers. The second scroll view (B) contains the zoomed numbers. The frame of (B) is the transparent window. When you scroll (A), you scroll (B) programmatically, but you move it farther than (A). (I.e. if (A) scrolls 10 pixels, you might scroll (B) 20 pixels.) Make sense? If you've ever used Convert.app from TapTapTap they use a similar effect.
d10744
I ended up changing the application MainPage to navigate throughout the pages. So my initial application main page is now the CheckPermissionsPage. Should permissions be granted I then run Application.Current.MainPage = new NavigationPage(new LoginPage());. After logging in, the HomePage is displayed with Application.Current.MainPage = new NavigationPage(new HomePage());. This probably isn't the most ideal solution, but it does allow me to prevent back navigation for my LoginPage.
d10745
Before coding, you need be sure the following inputs contain value: <input type="hidden" name="cardId" id="cardId" /> @{ var getUser = await UserManager.GetUserAsync(User); } <input type="hidden" name="userId" asp-for="@getUser.Id" /> Two ways you could follow: 1.From Body: View <form id="formToStore" method="post" enctype="multipart/form-data"> <input type="hidden" name="cardId" id="cardId" value="1" /> <input type="hidden" name="userId" value="466788cb-6aab-4798-81f1-f6b05cb71e32"/> <div class="modal-footer"> <button type="button" id="buttonclose" name="buttonclose" class="buttonclose btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" id="addToOrder" name="addToOrder" class="btn btn-primary">Add to Order</button> </div> </form> @section Scripts { <script> var buttonAddOrder = document.getElementById("addToOrder"); buttonAddOrder?.addEventListener("click", function () { var catId = document.querySelector("#formToStore input[name = 'cardId']").value; var userId = document.querySelector("#formToStore input[name = 'userId']").value; var antiForgeryToken = document.querySelector("#formToStore input[name = '__RequestVerificationToken']").value; var itemsStore = { // __RequestVerificationToken: antiForgeryToken, //remove this.... UserId:userId, CatrgoryId: catId, Payed: false }; var url = "/CategoriesToUser/AddItemToStore"; var response = fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', headers: { 'Content-Type': 'application/json', //change here... "X-ANTI-FORGERY-TOKEN": antiForgeryToken, //add this..... }, body: JSON.stringify(itemsStore) //change here..... }) .then((response) => { return response.json(); }).catch((e) => console.log(e.message)); }) </script> } Controller [HttpPost] [ValidateAntiForgeryToken] public IActionResult AddItemToStore([FromBody] StoreUser itemsStore) { //do your stuff.... return Ok(itemsStore); } Startup.cs: services.AddAntiforgery(x => x.HeaderName = "X-ANTI-FORGERY-TOKEN"); 2.From Form: View <form id="formToStore" method="post" enctype="multipart/form-data"> @*change name="cardId" to name="CatrgoryId"*@ <input type="hidden" name="CatrgoryId" id="cardId" value="1" /> <input type="hidden" name="userId" value="466788cb-6aab-4798-81f1-f6b05cb71e32"/> <div class="modal-footer"> <button type="button" id="buttonclose" name="buttonclose" class="buttonclose btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" id="addToOrder" name="addToOrder" class="btn btn-primary">Add to Order</button> </div> </form> @section Scripts { <script> var buttonAddOrder = document.getElementById("addToOrder"); buttonAddOrder?.addEventListener("click", function () { var url = "/CategoriesToUser/AddItemToStore"; const formToStore = document.getElementById('formToStore'); var formOrder = new FormData(formToStore); let response = fetch(url, { method: 'POST', mode: 'cors', cache: 'no-cache', //headers: { // 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8;' //}, //don't need to set the Content-Type header body: formOrder }) .then((response) => { return response.json(); }).catch((e) => console.log(e.message)); }) </script> } Controller Change [FromBody] to [FromForm]. [HttpPost] [ValidateAntiForgeryToken] public IActionResult AddItemToStore([FromForm] StoreUser itemsStore) { //do your stuff... return Ok(itemsStore); }
d10746
%n is the n-th argument when calling a program or batch file. %0 will be the first parameter or the file name of the executatble/script. Hence %0 will run it's own file, and the copy will again run it's own. This continues forever and cannot exit
d10747
The SPARQL standards themselves do not provide any support for transactions. However, Virtuoso and many other RDF databases support the Eclipse RDF4J APIs, which have full transactional support (disclosure: I'm on the RDF4J development team). An example using RDF4J transactions in Java would be something like this: Repository rep = ... ; // the Repository object is your database // open a connection to the database try(RepositoryConnection conn = rep.getConnection) { conn.begin(); // start a new transaction ... // do a query boolean success = conn.prepareBooleanQuery("ASK ...").evaluate(); if (!success) { conn.rollback(); } else { // add some data conn.add(...); conn.commit(); } } For more information on how transactions work with RDF4J, see the documentation. If you're not working in Java, you can also work with transaction via the RDF4J REST API, which is an extension of the SPARQL Protocol. As an aside: the above is just to answer the "how do I do transactions" part of your question really. There may be other, better mechanisms available than doing an ASK query for the kind of constraint validation you're looking for. SHACL, the shapes constraint language, might be what you need. Various tools and platforms have (partial or full) support for SHACL validation. You can read more about RDF4J SHACL support here. A: An update can be of the form INSERT .. WHERE and the WHERE part can include a test of whether to update or not. The SPARQL protocol for update requires actions to be atomic.
d10748
var calendar = $('#calendar').fullCalendar({ editable: true, header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, events: "events.php", selectable: true, selectHelper: true, select: function(start, end, allDay) { var title = prompt('Event Title:'); var url = prompt('Type Event url, if exits:'); if (title) { start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss"); end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss"); $.ajax({ url: 'add_events.php', data: 'title='+ title+'&start='+ start +'&end='+ end +'&url='+ url , type: "POST", success: function(json) { alert('Added Successfully'); } }); calendar.fullCalendar('renderEvent', { title: title, start: start, end: end, allDay: allDay }, true // make the event "stick" ); } calendar.fullCalendar('unselect'); }, editable: true, eventDrop: function(event, delta) { start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss"); end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss"); $.ajax({ url: 'update_events.php', data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id , type: "POST", success: function(json) { alert("Updated Successfully"); } }); }, eventResize: function(event) { start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss"); end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss"); $.ajax({ url: 'update_events.php', data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id , type: "POST", success: function(json) { alert("Updated Successfully"); } }); } });
d10749
You would need to use PDF library to iterate through all the Annotation objects and their properties to see which ones are using a highlight annotation. Once you have found the highlight annotation you can then extract the position and size (bounding box) of the annotation. Once you have a list of the annotation bounding boxes you will need to render the PDF file to an image format such as PNG/JPEG/TIFF so that you can extract / clip the rendered image of the annotation text you want. You could use GDI+ or something like LibTIFF There are various PDF libraries that could do this including http://www.quickpdflibrary.com (I consult for QuickPDF) or http://www.itextpdf.com Here is a C# function based on Quick PDF Library that does what you need. private void ExtractAnnots_Click(object sender, EventArgs e) { int dpi = 300; Rectangle r; List<Rectangle> annotList = new List<Rectangle>(); QP.LoadFromFile("samplefile.pdf", ""); for (int p = 1; p <= QP.PageCount(); p++) { QP.SelectPage(p); // Select the current page. QP.SetOrigin(1); // Set origin to top left. annotList.Clear(); for (int i = 1; i <= QP.AnnotationCount(); i++) { if (QP.GetAnnotStrProperty(i, 101) == "Highlight") { r = new Rectangle((int)(QP.GetAnnotDblProperty(i, 105) * dpi / 72.0), // x (int)(QP.GetAnnotDblProperty(i, 106) * dpi / 72.0), // y (int)(QP.GetAnnotDblProperty(i, 107) * dpi / 72.0), // w (int)(QP.GetAnnotDblProperty(i, 108) * dpi / 72.0)); // h annotList.Add(r); // Add the bounding box to the annotation list for this page. string s = String.Format("page={0}: x={1} y={2} w={3} h={4}\n", p, r.X, r.Y, r.Width, r.Height); OutputTxt.AppendText(s); } } // Now we have a list of annotations for the current page. // Delete the annotations from the PDF in memory so we don't render them. for (int i = QP.AnnotationCount(); i >= 0; i--) QP.DeleteAnnotation(i); QP.RenderPageToFile(dpi, p, 0, "page.bmp"); // 300 dpi, 0=bmp Bitmap bmp = Image.FromFile("page.bmp") as Bitmap; for (int i=0;i<annotList.Count;i++) { Bitmap cropped = bmp.Clone(annotList[i], bmp.PixelFormat); string filename = String.Format("annot_p{0}_{1}.bmp", p, i+1); cropped.Save(filename); } bmp.Dispose(); } QP.RemoveDocument(QP.SelectedDocument()); } A: Do you want each piece of text as a separate highlight or all the higlhights on a separate pane?
d10750
Number 1 rule for styling lists: Reset your lists: ul, li { margin:0;padding:0 } Do not style LIs, other than display:, position: and float:. Use display:block and put all styling on your A-tag. This will clear up 99% of list layout problems. See my tutorial: http://preview.moveable.com/JM/ilovelists/
d10751
As I understand you, you have put a console.log() in all the lifecycle-hooks. If you have also done it in ngAfterContentChecked / ngAfterViewChecked, you have to keep in mind that it is executed constantly, every time the change detection is run (application state change) and if you have a console.log(), it will appear infinitely ngDoCheck is a callback method that performs change-detection, invoked after the default change-detector runs, and again, every time the change detection is run (application state change), if you have a console.log(), it will appear infinitely. If you want it to only run once, use ngOnInit, ngAfterContentInit or ngAfterViewInit angular.io/guide/lifecycle-hooks
d10752
How about not inserting the null value in the id column. It is of no use to insert null value. It might have generated the sql exception. Try INSERT INTO table_one (name) VALUES ('Hayley');. I would suggest to use PreparedStatement instead of Statement because of the threat of SQL injection. Sometimes, the particular sql exception can occur if the database name is not given. Have you tried writing the database name like INSERT INTO database_name.table_one (name) VALUES ('Hayley');.
d10753
Found way myself, I convert the json to map and then compare to remove the duplicates. Then convert the reduced map back to json
d10754
Try this: HTML <html> <head> <title>World Cup Challenge</title> <style> BODY{color:#000000; font-size: 8pt; font-family: Verdana} .button {background-color: rgb(128,128,128); color:#ffffff; font-size: 8pt;} .inputc {font-size: 8pt;} .style3 {font-size: xx-small} </style> </head> <body> <form method="POST" action="mailer.php"> Name: <input type="text" name="name" size=""><br> <br> Brazil VS Croatia <input type="hidden" name="match_name[]" value="Brazil VS Croatia"> <br> <input type="radio" name="check0[]" value="Brazil">Brazil<br> <input type="radio" name="check0[]" value="Croatia">Croatia<br> <br> Mexico VS Cameroon <input type="hidden" name="match_name[]" value="Mexico VS Cameroon"> <br> <input type="radio" name="check1[]" value="Mexico">Mexico<br> <input type="radio" name="check1[]" value="Cameroon">Cameroon<br> <br> <input type="submit" value="Submit" name="submit"> </form> </body> </html> php: <?php if(isset($_POST['submit'])) { $to = "myemail@email.com"; $subject = "This is the subject"; $name_field = $_POST['name']; $i = 0; $body = "From: " . $name_field. "\n"; foreach($_POST['match_name'] as $match_name) { $body .= "Match: " . $match_name . "\n"; $check = "check".$i; foreach($_POST[$check] as $val) { $body .= "Selected Team: " . $val . "\n"; } $i++; } if (mail($to, $subject, $body)) { echo "Mail sent to: $to!"; } else { echo "Sending mail failed"; } } else { echo "blarg!"; } ?>
d10755
As outlined in the terraform documentation: Filesystem and Workspace Info: path.module is the filesystem path of the module where the expression is placed. path.root is the filesystem path of the root module of the configuration. path.cwd is the filesystem path of the current working directory. In normal use of Terraform this is the same as path.root, but some advanced uses of Terraform run it from a directory other than the root module directory, causing these paths to be different. Or in your case, as you need to give a relative path try something like this: module "EC2" { source = "../Modules/ec2" ami = "ami-xxxxxxxxxxxxx" instance_type = "t2.micro" userdata_1 = file("${path.module}/Modules/ec2/userdata_1.sh") }
d10756
Comparing the transform positions is not likely to be useful as even a tiny amount of offset in the float (think something as small as 0.0000001 will cause the condition to fail. I would suggest that when a player portals through to another portal, that you place them slightly in front of the portal, in addition to a small cooldown that prevents portal travel. You'll need to translate the players speed (not velocity, speed) to the direction (transform.forward) of the portal they exited as well to keep them moving in the right direction.
d10757
You could try an index that has created_at before version_hash (might get a better shot at having an index range scan... not clear how that non-equality predicate on the version_hash affects the plan, but I suspect it disables a range scan on the created_at column. Other than that, the query and the index look about as good as you are going to get, the EXPLAIN output shows the query being satisfied from the index. And the performance of the statement doesn't sound too unreasonable, given that it's aggregating 95,000+ rows, especially given the key length of 1543 bytes. That's a much larger size than I normally deal with. What are the datatypes of the columns in the index, and what is the cluster key or primary key? accumulation_hash - 128-character representation of 512-bit value caller_id - integer or numeric (?) active - integer or numeric (?) version_hash - another 128-characters created_at - datetime (8bytes) or timestamp (4bytes) amount - numeric or integer 95,000 rows at 1543 bytes each is on the order of 140MB of data.
d10758
I would construct the XML in the test setup, but limit the XML to only what you need for the test to pass. It looks like your XML document could be very simple in this case. <someRoot> <someNode> <information id='dat11'><new_val>100.0</new_val></information> <information id='dat12'><new_val>1526.0</new_val></information> </someNode> </someRoot> That XML would pass your test. I also wouldn't test the XmlHttpReader, if that is a system class. You could mock a dependency to it. You might need to wrap it with something to help you easily decouple it as dependency from your class. A: For your first question, whether you should have a big XML string or load it from a file. I would say either works. To be honest though since you are loading from a file inside the project I would keep it in the project as an embedded resource and load it via reflection. That would take the mess of file structure out of the picture if any of your colleages run it from their pc's. The only best practice I've really encountered with Unit Tests is to make sure you're testing properly and make sure others can run the test easily. For your second question, about the XmlHttpReader. It would depend on your output. If you can test that you have valid XML then go for it. I would reccommend negative testing as well. Point it to http://stackoverflow.com, or a URL you know will error out and decorate the test with the appropriate expected error.
d10759
Comparable needs a parameter. Try with the following class: class Data implements Comparable<Data> { float lati; float longi; Integer time; @Override public int compareTo(Data o) { // Integer already implements Comparable return time.compareTo(o.time); } } A: Here is one example on how to do it. import java.util.*; class Data implements Comparable<Data> { float lati; float longi; int time; // Time in seconds public Data(int time) { this.time = time; } public int compareTo(Data obj) { if(this.time == obj.time) return 0; if(this.time< obj.time) return -1; else return 1; } public static void main(String[] args) { ArrayList<Data> dataArray = new ArrayList<>(); dataArray.add(new Data(3)); dataArray.add(new Data(1)); dataArray.add(new Data(2)); Collections.sort(dataArray); System.out.println(Collections.binarySearch(dataArray,new Data(1))); System.out.println(Collections.binarySearch(dataArray,new Data(3))); System.out.println(Collections.binarySearch(dataArray,new Data(2))); } }
d10760
Angular application's bootstraping starts from main.ts file. Open main.ts file and check which module's name is used in bootStrapModule. Once done please check the parent module for any errors in the import statements.
d10761
No, there's no API to programmatically configure projects in the APIs Console.
d10762
Did you try checking out the Linq-to-Json in Json.NET for most of these? (even though it would probably get ugly) http://james.newtonking.com/pages/json-net.aspx
d10763
Set the layout_width as fill_parent, which will make it spread across the screen for all devices. Add some padding on left right and top which seems suitable. The padding might seem different for different screens but still this might be a better solution. A: set android:layout_width="match_parent" edit: check this out Auto Scale TextView Text to Fit within Bounds
d10764
* *You're comparing two arrays using !=. In javascript [] != [] is always true. To check if an array is empty, use length property like arr.length == 0. *Use filter instead of using map like a forEach. *To check existance use some/includes combo instead of looking for intersections. So, filter events that some of its intermediateDates are included in filteredDates: let eventsFound = _.filter(this.events, event => _.some(event.intermediateDates, date => _.includes(filteredDates, date) ) ); The same using native functions: let eventsFound = this.events.filter(event => event.intermediateDates.some(date => filteredDates.includes(date) ) );
d10765
From angular docs: https://docs.angularjs.org/api/ng/directive/ngRepeat You can use $last. $last boolean true if the repeated element is last in the iterator. You can also check this one: Different class for the last element in ng-repeat. I would implement it like the following: function renameIfLast(name, isLast) { if (isLast) { return name.toUpperCase(); // do you rename logic here << } else { return name; } } <h1 ng-repeat="x in records">{{renameIfLast(x.status, $last)}}</h1>
d10766
Looking at the official nextjs mdx example this is the correct configuration: const withMDX = require('@next/mdx')({ extension: /\.mdx?$/, }) module.exports = withMDX({ pageExtensions: ['js', 'jsx', 'mdx'], })
d10767
You won't need to load pagination library or initialize it. It is a little different from you do in regular codeigniter, also you can surely use the way you do it in codeigniter pagination class I usually do this for pagination. in your controller use this .... // Create pagination links $total_rows = $this->products_m->count_all_products(); $pagination = create_pagination('products/list', $total_rows); //notice that product/list is your controller/method you want to see pagination there // Using this data, get the relevant results $params = array( 'limit' => $pagination['limit'] ); $this_page_products = $this->product_m->get_all_products($params); .... //you got to pass $pagination to the view $this->template ->set('pagination', $pagination) ->set('products', $this_page_products) ->build('products/view'); obviously, you will have a model named products_m At your model this would be your get_all_products function, I am sure you can build the count_all_products() function too private function get_all_products($params){ //your query to get products here // use $this->db->limit(); // Limit the results based on 1 number or 2 (2nd is offset) if (isset($params['limit']) && is_array($params['limit'])) $this->db->limit($params['limit'][0], $params['limit'][1]); elseif (isset($params['limit'])) $this->db->limit($params['limit']); //rest of your query and return } Now at your view you have to foreach in your passed $products variable and to show pagination links use this line in your view <?php echo $pagination['links'];?> I use this in my works, hope it help. A: Pyrocms used codeigniter framework this code works perfectly in case of module but i have never tried this on a plugin but still you can try this. Load pagination library in Controller $this->load->library('pagination'); $config['base_url'] = 'http://example.com/index.php/test/page/'; $config['total_rows'] = 200; $config['per_page'] = 20; $this->pagination->initialize($config); Use this code in view to genrate the links echo $this->pagination->create_links();
d10768
Change your dependencies dependencies { compile 'com.android.support:support-v4:19.1.0' compile 'com.android.support:gridlayout-v7:19.1.0' } Using the +, you are getting the last release. Currently the last release is the compile 'com.android.support:support-v4:21 and it has a minSdk='L' because it is a preview release. Use it only to test the android 'L' preview. A: Try editing the following line to your Android Manifest file, like so: dependencies { compile 'com.android.support:support-v4:21+' } Then your project should build. A: Change your dependencies in app/build.gradle to lower version apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.eusecom.snowsmsden" minSdkVersion 16 targetSdkVersion 20 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:20.+' compile 'com.android.support:appcompat-v7:20.+' }
d10769
See Spring Security Reference: Our examples have only required users to be authenticated and have done so for every URL in our application. We can specify custom requirements for our URLs by adding multiple children to our http.authorizeRequests() method. For example: protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/resources/**", "/signup", "/about").permitAll() .antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')") .anyRequest().authenticated() .and() // ... .formLogin(); } 1 There are multiple children to the http.authorizeRequests() method each matcher is considered in the order they were declared. 2 We specified multiple URL patterns that any user can access. Specifically, any user can access a request if the URL starts with "/resources/", equals "/signup", or equals "/about". 3 Any URL that starts with "/admin/" will be resticted to users who have the role "ROLE_ADMIN". You will notice that since we are invoking the hasRole method we do not need to specify the "ROLE_" prefix. 4 Any URL that starts with "/db/" requires the user to have both "ROLE_ADMIN" and "ROLE_DBA". You will notice that since we are using the hasRole expression we do not need to specify the "ROLE_" prefix. 5 Any URL that has not already been matched on only requires that the user be authenticated Your second use of .authorizeRequests() overrides the first one. Also see AntPathMatcher: The mapping matches URLs using the following rules: ? matches one character * matches zero or more characters ** matches zero or more directories in a path Examples com/t?st.jsp — matches com/test.jsp but also com/tast.jsp or com/txst.jsp com/*.jsp — matches all .jsp files in the com directory com/**/test.jsp — matches all test.jsp files underneath the com path org/springframework/**/*.jsp — matches all .jsp files underneath the org/springframework path org/**/servlet/bla.jsp — matches org/springframework/servlet/bla.jsp but also org/springframework/testing/servlet/bla.jsp and org/servlet/bla.jsp Your modified code: protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/rest/open/**").permitAll() .antMatchers("/login/**").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .failureUrl("/login?error") .defaultSuccessUrl("/dashboard") .loginProcessingUrl("/j_spring_security_check") .usernameParameter("username") .passwordParameter("password") .and() .logout() .logoutUrl("/j_spring_security_logout") .logoutSuccessUrl("/login?logout") .and() .csrf(); }
d10770
It's not really a solution but what I found is this (credit to this answer): I've tried a few configurations including a BroadcastReceiver and adding a JobIntentService to run the code in the background, but every time I got this the onExpired callback which you can set to the SubscribeOptions: options.setCallback(new SubscribeCallback() { @Override public void onExpired() { super.onExpired(); Toast.makeText(context.get(), "No longer Subscribing!", Toast.LENGTH_SHORT).show(); } } When the subscribe occurred in the background it was delayed, but it was still called. Notes: 1. When I've tested with Strategy.BLE_ONLY I did not get the onFound callback. 2. From Google's documentation: Background subscriptions consumes less power than foreground subscriptions, but have higher latency and lower reliability When testing I found this "lower reliability" to be an understatement: onFound was rarely called and I never got the onLost. A: I know this is a late reply, but I had the same problem and found out by debugging that it is an issue related to this error: "Attempting to perform a high-power operation from a non-Activity Context". This can be solved when calling Nearby.getMessagesClient(this) by passing in an activity context instead of this. In my case I added a class extending Application which helps in returning this context (the below is in java but should be translatable to kotlin easily) public class MyApplication extends Application { private Activity currentActivity = null; public Activity getCurrentActivity(){ return currentActivity; } public void setCurrentActivity(Activity mCurrentActivity){ this.currentActivity = mCurrentActivity; } } And in my base activity, from which all activities extend, I set the current activity by calling ((MyApplication) this.getApplicationContext()).setCurrentActivity(this); in the constructor. My service can then call getMessagesClient with the correct context like below: final Activity context = ((MyApplication)getApplicationContext()).getCurrentActivity(); Nearby.getMessagesClient(context).[...] Do not forget to register your Application class in the AndroidManifest: <application android:name="com.example.xxx.MyApplication"`
d10771
This is what APPLY can be used for SELECT * FROM Table1 CROSS APPLY ( SELECT TOP (Table1.Number) * FROM Table2 WHERE Table1.Market = Table2.Market AND Table1.Measure = Table2.Measure ORDER BY LastName ) AS TopResults http://sqlfiddle.com/#!6/46b57/4 A: For anyone in the same predicament, I figured out another way of accomplishing the same thing, using the ROW_NUMBER() windowed function instead of trying to use TOP dynamically. The idea was to add a row number to Table2, partitioned by market & measure and ordered by last name, then to join the Table1.Number to Table2, and select only rows where the row number was less than Table1.Number, thus returning the "top" number of rows according to the Table1.Number. with temp as (select 'rownum' = row_number() over(partition by t2.market, t2.measure) order by t2.lastname) , t2.* , t1.number from table2 t2 inner join table1 t1 on t1.market = t2.market and t1.measure = t2.measure) select * from temp where rownum <= number order by market, measure, rownum
d10772
To be pedantic, the Inputbox will let you type up to 255 characters, but it will only return 254 characters. Beyond that, yes, you'll need to create a simple form with a textbox. Then just make a little "helper function" something like: Function getBigInput(prompt As String) As String frmBigInputBox.Caption = prompt frmBigInputBox.Show getBigInput = frmBigInputBox.txtStuff.Text End Function or something like that... A: Thanks BradC for the info that. My final code was roughly as follows, I have a button that calls the form that I created and positions it a bit as I was having some issues with the form being in the wrong spot the everytime after the first time I used. Sub InsertNotesAttempt() NoteEntryForm.Show With NoteEntryForm .Top = 125 .Left = 125 End With End Sub The userform was a TextBox and two CommandButtons(Cancel and Ok). The code for the buttons was as follows: Private Sub CancelButton_Click() Unload NoteEntryForm End Sub Private Sub OkButton_Click() Dim UserNotes As String UserNotes = NotesInput.Text Application.ScreenUpdating = False If UserNotes = "" Then NoteEntryForm.Hide Exit Sub End If Worksheets("Notes").ListObjects("Notes").ListRows.Add (1) Worksheets("Notes").Range("Notes").Cells(1, 1) = Date Worksheets("Notes").Range("Notes").Cells(1, 2) = UserNotes Worksheets("Notes").Range("Notes").Cells(1, 2).WrapText = True ' Crap fix to get the wrap to work. I noticed that after I inserted another row the previous rows ' word wrap property would kick in. So I just add in and delete a row to force that behaviour. Worksheets("Notes").ListObjects("Notes").ListRows.Add (1) Worksheets("Notes").Range("Notes").Item(1).Delete NotesInput.Text = vbNullString NotesInput.SetFocus ' Retains focus on text entry box instead of command button. NoteEntryForm.Hide Application.ScreenUpdating = True End Sub A: I don't have enough rep to comment, but in the sub form_load for the helper you can add: me.AutoCenter = True Outside of that form, you can do it like this: NoteEntryForm.Show Forms("NoteEntryForm").AutoCenter = True My Access forms get all confused when I go from my two extra monitors at work to my one extra monitor at home, and are sometimes lost in the corner. This AutoCenter has made it into the form properties of every one of my forms.
d10773
The instant vector selector can be expressed as * *namespace="test1" to match label namespace exactly equal to "test1" *<no selector on namestapce> to match all values of namespace *namespace=~"test1|test2" to match label namespace with given regex You made a mistake: you used a regex "test1[test2" with an exact match (=) instead of regex match (=~). Correct expression would be: kube_resourcequota{resource="count/deployments.apps",type="hard",namespace=~"test1|test2"}
d10774
What you're doing is setting the Alpha of any pixel outside that circle to 0, so when you render it, it's gone, but that pixel data is still there. That's not a problem, but it important to know. Problem Your "white2.png" image does not have an alpha channel. Even if it's a PNG file, you have to add an alpha channel using your image editing tool. You can print("BGN:", background.getbands()), to see the channels it has. You'll see it says 'R','G','B', but no 'A'. Solution 1 Replace your paste line with: background.paste(pfp, (200, 200), alpha) Here, we use the loaded in avatar as is, and the third argument is a mask which PIL figures out how to use to mask the image before pasting. Solution 2 Give your white background image an alpha channel. MS Paint doesn't do this. You have to use something else. For GIMP, you simply right-click on the layer and click Add Alpha-channel. Oh, and something worth noting. Documentation for Paste. See alpha_composite() if you want to combine images with respect to their alpha channels.
d10775
For real numbers, you can use a regular expression: update q_stock.daily set RET = cast(RAW_RET as double precision) where RAW_RET ~ '^[-]?[0-9]+\.?[0-9]*$';
d10776
You forgot to add selector, check this out. <ImageButton android:id="@+id/imageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/selector" /> The corresponding selector file looks like this: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/ico_100_checked" android:state_selected="true"/> <item android:drawable="@drawable/ico_100_unchecked"/> </selector> And in my onCreate I call: final ImageButton ib = (ImageButton) value.findViewById(R.id.imageButton); OnClickListener ocl =new OnClickListener() { @Override public void onClick(View button) { if (button.isSelected()){ button.setSelected(false); } else { ib.setSelected(false); //put all the other buttons you might want to disable here... button.setSelected(true); } } }; ib.setOnClickListener(ocl); //add ocl to all the other buttons Hope this helps.
d10777
The easiest solution is using a WebBrowser control, showing editable div: private void Form1_Load(object sender, EventArgs e) { webBrowser1.DocumentText = @" <div contenteditable=""true""> This is a sample: <ul> <li>test</li> <li><b>test</b></li> <li><a href=""https://stackoverflow.com"">stackoverflow</a></li> </ul> </ div >"; } You can also have some toolbar buttons for setting text bold, italic, or insert <ul> or ol and other commands. For example, the following command, makes the selection bold: webBrowser1.Document.ExecCommand("Bold", false, null); Or the following command inserts ordered list: webBrowser1.Document.ExecCommand("InsertOrderedList", false, null); You may also want to take a look at following post: Windows Forms HTML Editor
d10778
The #ifdef preprocessor directive should be the most straightforward way to achieve two of your goals: * *not be part of any production code *ensure that they can only be called from functions with the same "tag" (if they're not there, a build with DEV_ONLY undefined would not compile) That would mean to wrap the function bodies as well as the corresponding calls. As to the test methods that should be available in release builds: Then they are not DEV_ONLY, and should not be marked as such. A: One way to deal with this is to use a build system that allows you to define libraries as test only and restricts production binaries from using them. For example, bazel provides the testonly option (http://bazel.io/docs/be/common-definitions.html#common.testonly) Then you organize your code into your main binary/library, your test only library, and your test code. That would give you something like: cc_library( name = "foo", srcs = ["foo.cc"], hdrs = ["foo.h"], ) cc_library( name = "test-utils", srcs = ["test-utils.cc"], hdrs = ["test-utils.h"], testonly = 1, ) cc_test( ... deps = ["foo", "test-utils"], # works ) cc_libaray( ... deps = [..., "test-utils"], # fails ) cc_binary( ... deps = ["test-utils"], # fails )
d10779
Native html5 canvas doesn't have a way to stretch one side of a gradient fill. But there is a workaround: Create your stretch gradient by drawing a series of vertical gradient lines with an increasing length. Then you can use transformations to draw your stretched gradient at your desired angle Example code and a Demo: var canvas=document.getElementById("canvas"); var ctx=canvas.getContext("2d"); var cw=canvas.width; var ch=canvas.height; var length=200; var y0=40; var y1=65 var stops=[ {stop:0.00,color:'red'}, {stop:0.25,color:'yellow'}, {stop:0.50,color:'green'}, {stop:0.75,color:'blue'}, {stop:1.00,color:'violet'}, ]; var g=stretchedGradientRect(length,y0,y1,stops); ctx.translate(50,100); ctx.rotate(-Math.PI/10); ctx.drawImage(g,0,0); function stretchedGradientRect(length,startingHeight,endingHeight,stops){ var y=startingHeight; var yInc=(endingHeight-startingHeight)/length; // create a temp canvas to hold the stretched gradient var c=document.createElement("canvas"); var cctx=c.getContext("2d"); c.width=length; c.height=endingHeight; // clip the path to eliminate "jaggies" on the bottom cctx.beginPath(); cctx.moveTo(0,0); cctx.lineTo(length,0); cctx.lineTo(length,endingHeight); cctx.lineTo(0,startingHeight); cctx.closePath(); cctx.clip(); // draw a series of vertical gradient lines with increasing height for(var x=0;x<length;x+=1){ var gradient=cctx.createLinearGradient(0,0,0,y); for(var i=0;i<stops.length;i++){ gradient.addColorStop(stops[i].stop,stops[i].color); } cctx.beginPath(); cctx.moveTo(x,0); cctx.lineTo(x,y+2); cctx.strokeStyle=gradient; cctx.stroke(); y+=yInc; } return(c); } #canvas{border:1px solid red; margin:0 auto; } <h4>Stretched gradient made from vertical strokes</h4> <canvas id="canvas" width=300 height=200></canvas>
d10780
If you want to eliminate a bean from autowiring, then you can set autowire-candidate attribute of that bean tag to false. For example consider your case(Here I am setting B bean's autowire-candidate attribute to false) <bean id="B" class="B" autowire-candidate="false"/> <bean id="A" class="A"> <constructor-arg ref="B"> </bean> <bean id="Foo" class="Foo"> <constructor-arg ref="B"> </bean> A: You could use qualifiers attached to @Autowired. E.g., if you want to wire the bean with id B, you can do the following: @Autowired @Qualifier("B") private C c;
d10781
You have to move the time after the flow setup: @Test public void shouldDisplaySuccessMessage() { presenter.redirectToLogInScreenAfterOneSecond(); testScheduler.advanceTimeTo(1, TimeUnit.SECONDS); Mockito.verify(view).displaySuccessMessage(); Mockito.verify(view).onRegistrationSuccessful(); } Also you don't need that many operators after interval but use the mainThread scheduler directly: Disposable disposable = Flowable.interval(1, TimeUnit.SECONDS, AndroidSchedulers.mainThread()) .subscribe(aLong -> view.onRegistrationSuccessful(), view::handleError); and replace the mainThread scheduler: @Before public void setUp() { testScheduler = new TestScheduler(); RxAndroidPlugins.setMainThreadSchedulerHandler(scheduler -> testScheduler); presenter = new SignUpPresenter(); presenter.setView(view); }
d10782
You can use var text2 = "Dear 1234567890 12345678901 Welcome to MAX private ltd" var text1s = ["Dear {#dynamic#} {#dynamic#} Welcome to MAX private ltd {#dynamic#}"]; var text2 = "Dear joe harry Welcome to MAX private ltd"; for (var text1 of text1s) { var rx = new RegExp(text1.replace(/\s*(\{#dynamic#}(?:\s*\{#dynamic#})*)/g, (x, y) => '\\s*.{0,' + ((y.match(/\{#dynamic#}/g) || ['']).length * 10 + (y.match(/\s/g) || '').length) + '}')) console.log(rx) console.log(rx.test(text2)) } This means: * *Sequences of possibly whitespace-separated {#dynamic#} chunks are replaced with the necessary .{0,x} patterns *If there are spaces in between, these are added up to x *If there are leading whitesapces, they will be made optional, \s* will replace any amount of whitespaces.
d10783
As the second screenshot shows, you need to install pandas for your the python interpreter that you use, like this: C:\Users\Uros\untitled\Scripts\python.exe -m pip install -U pandas
d10784
This is, because AND has priority over OR, so you have TRUE OR (FALSE AND FALSE) resulting in TRUE The extensive list of Operator Precedence can be found here: Most importantly are () > not > and > or > So to give priority to your OR operator use () (hour < 7 or hour > 20) and talking == True => (TRUE OR FALSE) AND FALSE => FALSE A: To give some more background to the already posted answer: This is based on operator precedence as explained here: https://docs.python.org/3/reference/expressions.html The higher the precedence the stronger it binds its two parts. You can image that like addition and multiplication in maths. There, multiplications bind stronger. Here, the and binds stronger as written in a different answer. A: It's about the operator's precedence In order to make that work you will need to specify the order of operators with parantheses. def parrot_trouble(talking, hour): if (hour < 7 or hour > 20) and talking == True: return True else: return False print(parrot_trouble(False, 6)) What is in parantheses will be executed first and then compared to and.
d10785
You are accessing the img element's src correctly. Based on the README for exif-js, you need to pass the actual img element as the first parameter to the getData method, not the src: this.imageExif = this.$refs.imageExif; EXIF.getData(this.imageExif, function() { console.log('image info', this); console.log('exif data', this.exifdata); });
d10786
Thanks for the detail view of your problem but the only important part is this -[NSCFString numberOfSectionsInTableView:]: unrecognized selector It tells that you are calling the method numberOfSectionsInTableView: on a NSCFString which is seem to be wrong so check where is that method called in your code And also the rest is not require in your case. Edit: did you release your custom cell in the delegate method tableview. if yes than use autorelease instead.
d10787
This is not a problem with pip; this is a problem with the commontools package. Here is its setup.py: from setuptools import setup setup( name="commontools", version="1.0", author="xxxxxxxxxxxx", author_email="xxxxxxxxxxxx", description="commontools", ) It does not even follow the minimal viable example for packaging or the basic use for setuptools. TL;DR: It is not including the source files; which is what the packages keyword for setup() does.
d10788
Numpy's .repeat() function You can change your hourly data into 5-minute data by using numpy's repeat function import numpy as np np.repeat(hourly_data, 12) A: I would strongly recommend against converting the hourly data into five-minute data. If the data in both cases refers to the mean load of those time ranges, you'll be looking at more accurate data if you group the five-minute intervals into hourly datasets. You'd get more granularity the way you're talking about, but the granularity is not based on accurate data, so you're not actually getting more value from it. If you aggregate the five-minute chunks into hourly chunks and compare the series that way, you can be more confident in the trustworthiness of your results. In order to group them together to get that result, you can define a function like the following and use the apply method like so: def to_hour(date): date = date.strftime("%Y-%m-%d %H:00:00") date = dt.strptime(date, "%Y-%m-%d %H:%M:%S") return date df['Aggregated_Datetime'] = df['Original_Datetime'].apply(lambda x: to_hour(x)) df.groupby('Aggregated_Datetime').agg('Real-Time Lo
d10789
Just for the record. I suggest to install gfortran from packages that are available from here: https://gcc.gnu.org/wiki/GFortran macOS installer can be found here: http://coudert.name/software/gfortran-6.3-Sierra.dmg Just install most recent release (using dmg file) and everything should be fine ! fort_sample.f90 program main write (*,*) 'Hello' stop end Compilation and execution goes smooth > gfortran -o fort_sample fort_sample.f90 > ./fort_sample Hello
d10790
Use grep. You don't want the lines that would be produced by: grep -B1 "unique constraint.*violated" filename Now eliminate these lines from the input: grep -v -f <(grep -B1 "unique constraint.*violated" filename) filename and you get the result: Record 2: Rejected - Error on table DMT_. ORA-01400:cannot insert NULL in to("DM"."DMT_INSURANCE"."INSURANCE_FUND_CODE") Record 4: Rejected - Error on table DMT_ADDRESS, column ORIGINAL_POSTCODE. ORA-12899: value too large for column "DM"."DMT_ADDRESS"."ORIGINAL_POSTCODE" (actual: 12, maximum: 10 (This assumes that the Record ... and ORA-... are on different lines. If those are on the same line, grep -v "unique constraint.*violated" filename would work!) A: If you have perl available you can use its paragraph mode: $ perl -00 -ne 'print unless /unique constraint/m;' < foo.input Record 2: Rejected - Error on table DMT_. ORA-01400:cannot insert NULL in to("DM"."DMT_INSURANCE"."INSURANCE_FUND_CODE") Record 4: Rejected - Error on table DMT_ADDRESS, column ORIGINAL_POSTCODE. ORA-12899: value too large for column "DM"."DMT_ADDRESS"."ORIGINAL_POSTCODE" (actual: 12, maximum: 10) Same using awk: $ awk -v RS= '!/unique constraint/' foo.input Record 2: Rejected - Error on table DMT_. ORA-01400:cannot insert NULL in to("DM"."DMT_INSURANCE"."INSURANCE_FUND_CODE") Record 4: Rejected - Error on table DMT_ADDRESS, column ORIGINAL_POSTCODE. ORA-12899: value too large for column "DM"."DMT_ADDRESS"."ORIGINAL_POSTCODE" (actual: 12, maximum: 10) A: Here is a possible solution using Perl-regex (with negative lookahead) to exclude the ORA-00001 and then get the line before the matching ORAs too (-B1): grep -B1 -P 'ORA\-(?!00001)' logfile A: This might work for you (GNU sed): sed '/^Record/{N;N;/\nORA-00001:/d}' logfile Read 3 lines for each record and if those lines contain the undesired code delete them. If more filtering is needed, further codes may be added before the enclosing }. A: One way using sed. For every field that begins with Record read next one and try to match the string unique .... If it doesn't suceed, print both adding a newline. sed -n '/^Record/ { N; /unique constraint .* violated/! { s/$/\n/; p } }' infile It yields: Record 2: Rejected - Error on table DMT_. ORA-01400:cannot insert NULL in to("DM"."DMT_INSURANCE"."INSURANCE_FUND_CODE") Record 4: Rejected - Error on table DMT_ADDRESS, column ORIGINAL_POSTCODE. ORA-12899: value too large for column "DM"."DMT_ADDRESS"."ORIGINAL_POSTCODE" (actual: 12, maximum: 10)
d10791
It's not possible with kafka-console-producer as it uses a Java Scanner object that's newline delimited. You would need to do it via your own producer code A: You can use kafkacat for this, with its -D operator to specify a custom message delimiter (in this example /): kafkacat -b kafka:29092 \ -t test_topic_01 \ -D/ \ -P <<EOF this is a string message with a line break/this is another message with two line breaks! EOF Note that the delimiter must be a single byte - multi-byte chars will end up getting included in the resulting message See issue #140 Resulting messages, inspected also using kafkacat: $ kafkacat -b kafka:29092 -C \ -f '\nKey (%K bytes): %k\t\nValue (%S bytes): %s\n\Partition: %p\tOffset: %o\n--\n' \ -t test_topic_01 Key (-1 bytes): Value (43 bytes): this is a string message with a line break Partition: 0 Offset: 0 -- Key (-1 bytes): Value (48 bytes): this is another message with two line breaks! Partition: 0 Offset: 1 -- % Reached end of topic test_topic_01 [0] at offset 2 Inspecting using kafka-console-consumer: $ kafka-console-consumer \ --bootstrap-server kafka:29092 \ --topic test_topic_01 \ --from-beginning this is a string message with a line break this is another message with two line breaks! (thus illustrating why kafkacat is nicer to work with than kafka-console-consumer because of its optional verbosity :) ) A: With Console-consumer you are obviously running tests for your expected data coming from client. If it is a single message, better keep it as a single string by adding a unique delimiter as identifier. e.g. {this is line one ^^ this is line two} Then handle the message accordingly in your consumer job. Even if client is planning to send multiple sentences in message, better make it in a single string, it will improve serialization of your message and will be more efficient after serialization.
d10792
I've found an ~okay~ way of doing this by creating an enum mapping for states, storing the previous state in the outermost context (top-level fsm), and then using a custom reaction for the T event: #include <boost/mpl/list.hpp> #include <boost/statechart/state_machine.hpp> #include <boost/statechart/simple_state.hpp> #include <boost/statechart/event.hpp> #include <boost/statechart/transition.hpp> #include <boost/statechart/custom_reaction.hpp> // states struct A; struct B; struct C; struct D; // state enum mapping enum class state_mapping { A = 0, B, C, D }; // events struct S : boost::statechart::event<S> {}; struct T : boost::statechart::event<T> {}; struct U : boost::statechart::event<U> {}; // fsm struct FSM : boost::statechart::state_machine<FSM, B> { state_mapping previous_state = state_mapping::B; }; // fully defined states/transitions struct A : boost::statechart::simple_state<A, FSM> { typedef boost::statechart::transition<S, C> reactions; A() { std::cout << "entered A" << std::endl; } virtual ~A() { outermost_context().previous_state = state_mapping::A; } }; struct B : boost::statechart::simple_state<B, FSM> { typedef boost::statechart::transition<S, C> reactions; B() { std::cout << "entered B" << std::endl; } virtual ~B() { outermost_context().previous_state = state_mapping::B; } }; struct C : boost::statechart::simple_state<C, FSM> { typedef boost::mpl::list< boost::statechart::custom_reaction<T>, boost::statechart::transition<U, D> > reactions; C() { std::cout << "entered C" << std::endl; } boost::statechart::result react(const T&) { switch(outermost_context().previous_state) { case state_mapping::A: return transit<A>(); case state_mapping::B: return transit<B>(); default: return discard_event(); } } }; struct D : boost::statechart::simple_state<D, FSM> { D() { std::cout << "entered D" << std::endl; } }; int main() { FSM fsm; fsm.initiate(); fsm.process_event(S()); fsm.process_event(T()); fsm.process_event(S()); fsm.process_event(U()); return 0; }
d10793
As per this answer, the domain for the y scale is the array indices of taskTypes. That means that: y("slot3") = undefined y(taskTypes.indexOf("slot3")) = 54 // Or some valid value You need to determine the index of d.slotName in the array. Using indexOf won't behave well for repeated values (like "slot1"). If the item is present more than once, the indexOf method returns the position of the first occurence.
d10794
You can use only dot (.) before your filename which will find that file from root of dir..for eg ./dir3/file4.php but it increase the overhead..Another way is to use $base = __DIR__ . '/../'; require_once $base.'_include/file1.php'; A: If you are calling file3 from file2 you will have to go back 2 directories. The best way is using the full path like : home/mysite/public_html/dir3/file3.php It maybe (is) troublesome but good uptill some level. Edit: DIR and rest is also handy, depending on your need A: I FIX it with: In file1.php I have: $path = '..'; include_once($path.'/dir3/file3.php'); In file3.php I have: required($path.'/dir3/file4.php'); In file2.php I want write: $path = '../..' include_once($path.'/dir3/file3.php'); This work for me.
d10795
* *Remove the javascript: portion *Remove the href portion The result : < select name='cmg_select' onchange="window.location='index.php?'+this.value" > A: Try this instead <select name='cmg_select' onChange="window.location.href='index.php?'+this.options[this.selectedIndex].value"> <option value='pening' > pening </option> <option value='complete' > complete </option> <option value='pening' > pening </option> </select> A: Remove the javascript: from the onchange attribute.
d10796
If your CSS code is inline with the HTML, make sure it's enclosed in <style> tags: <div id="home"> <div class="landing-text"> <h1 class="display-2"> One Piece MMO</h1> <button type="button" class="btn btn-primary btn-lg">Watch Trailer</button> <button type="button" class="btn btn-primary btn-lg">Download Game</button> </div> </div> <style type="text/css"> #home { background: url(images/bg.png) no-repeat fixed center; display: table; height: 100%; position: relative; width: 100%; background-size: cover; } </style> A: Your code is actually correct, which leads me to believe it could have something to do with the path to the image you want to display. I changed the url to a universal one leading to random cat image and it worked. That or enclose your image path between quotes, as in url("images/bg.png"). JS Fiddle Check your image path! <div id="home"> <div class="landing-text"> <h1 class="display-2"> One Piece MMO</h1> <button type="button" class="btn btn-primary btn-lg">Watch Trailer</button> <button type="button" class="btn btn-primary btn-lg">Download Game</button> </div> </div> #home { background: url(http://www.catster.com/wp-content/uploads/2015/06/google-cat-search-2014-_0.jpg) no-repeat fixed center; display: table; height: 100%; position: relative; width: 100%; background-size: cover; } A: You can run it. <div id="home"> <div class="landing-text"> <h1 class="display-2"> One Piece MMO</h1> <button type="button" class="btn btn-primary btn-lg">Watch Trailer</button> <button type="button" class="btn btn-primary btn-lg">Download Game</button> </div> </div> <style> #home { background: url(https://image.freepik.com/free-vector/happy-childrens-day-design_23-2147705019.jpg) no-repeat fixed center; display: table; height: 100%; position: relative; width: 100%; background-size: cover; } <style>
d10797
It sounds like you want to pass the current item to the converter and return a Visibility. It is possible that I didn't completely understood what you mean, but if that is the case, this should work for you: Visibility={Binding RelativeSource={RelativeSource Self}, Converter={StaticResource BoolViz}} The "value" parameter will be set to the ViewDocumentSearchControl in the first case, and to the ViewStartControl in the second case. Is that what you were looking for? Cheers, Laurent
d10798
You can try to override some requirements in this way: "minimum-stability": "dev", "prefer-stable": true, "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", "yiisoft/yii2-bootstrap": "~2.0.8", "yiisoft/yii2-bootstrap4": "1.0.x-dev", "bower-asset/bootstrap": "3.3.7 as 4.1.3", "npm-asset/bootstrap": "~4.1.3" }, This will install bootstrap 3.3.7 from bower and bootstrap 4.1.3 from npm. You need to update path for bootstrap4 assets bundles: 'components' => [ 'assetManager' => [ 'bundles' => [ 'yii\bootstrap4\BootstrapAsset' => [ 'sourcePath' => '@npm/bootstrap/dist' ], 'yii\bootstrap4\BootstrapPluginAsset' => [ 'sourcePath' => '@npm/bootstrap/dist' ] ] ] ] Note that yii2-bootstrap4 is not ready to use and does not even have a alpha/beta release, so expect many other problems. A: A lot of solution on how to use Bootstrap 4 in Yii2. Even the Yii2 team created an extension for that. But since, I don't like too much configuration. This is what I did. In AppAsset.php, remove the yii\bootstrap\BootstrapAsset with custom your own. I'll recommend, you stick with the original filename and classname. // AppAsset.php public $depends = [ 'yii\web\YiiAsset', //'yii\bootstrap\BootstrapAsset', // Remove this 'app\assets\BootstrapAsset', // Add this ]; Then, I created a BootstrapAsset.php file in assets folder. Copy the code from yii\bootstrap\BootstrapAsset. Then changed some part of the code. No NPM, No Bower. namespace app\assets; use yii\web\AssetBundle; class BootstrapAsset extends AssetBundle { public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ 'vendor/bootstrap/css/bootstrap.min.css' ]; public $js = [ 'vendor/bootstrap/js/bootstrap.min.js', 'vendor/popper.js/umd/popper.min.js' ]; }
d10799
There are two ways you can do it that I know of. First is to use a java transformation, where you can check how many rows are coming from source and generate the remaining using the generateRow() function within a for loop. The second option is to use a active lookup transformation, with a query like below. In the condition put rec_cnt>=src_cnt where src_cnt being the number records from source. select rownum as rec_cnt from dual connect by rownum <= 7
d10800
Thanks to @benuto for his answer, I was able to find out how I could extract any required custom attribute or property using MemeberExpress. I wanted the answer to help others, so I made a working example. Bear in mind that you will need to check if the object does have a custom property or not, to avoid crashing when accessing FirstOrDefault().Name. public static string ColumnNameFor<T, P>( this HtmlHelper<T> helper, Expression<Func<T, P>> expression) { var name = ExpressionHelper.GetExpressionText(expression); MemberExpression me = expression.Body as MemberExpression; var cp = (ColumnAttribute)me .Member .GetCustomAttributes(typeof(ColumnAttribute), false) .FirstOrDefault(); return (cp == null) ? null : cp.Name; }