pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
26,893,775
0
<p>Try something like</p> <pre><code>connect(Bgn,End,Path) :- % to find a path between two nodes in the graph connected(Bgn,End,[],P) , % - we invoke the helper, seeding the visited list as the empty list reverse(P,Path) % - on success, since the path built has stack semantics, we need to reverse it, unifying it with the result . connected(X,Y,V,[X,Y|V]) :- % can we get directly from X to Y? path(X,_,Y) % - if so, we succeed, marking X and Y as visited . % connected(X,Y,V,P) :- % otherwise... path(X,_,T) , % - if a path exists from X to another room (T) T \= Y , % - such that T is not Y \+ member(X,V) , % - and we have not yet visited X connected(T,Y,[X|V],P) % - we continue on, marking X as visited. . </code></pre> <p>You'll note the test for having visited the room before. If your graph has cycles, if you don't have some sort of test for having previously visited the node, you'll wind up going around and around in circles...until you get a stack overflow.</p>
23,603,770
0
<p>Upgrading comment to an answer;</p> <p>Seems you are using <code>HSSF</code> instead of <code>XSSF</code> for xlsx. Hence, though <a href="https://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFRichTextString.html" rel="nofollow"><code>HSSFRichTextString</code></a> is valid for an <code>HSSFCell</code>, you need <code>XSSFCell</code> instead and then set its value with <a href="https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFRichTextString.html" rel="nofollow"><code>XSSFRichTextString</code></a>.</p>
16,179,110
0
<p>That is not valid JSON, so you cannot do it with standard methods.</p> <p>You either have to escape the quotes like this: <code>"sport is \" "</code> or else you need to write your own sanitizer</p>
12,745,199
0
loading another tableview when a tablecell of one tableview is clicked returning error:"Program received signal SIGABRT" <p>I am creating an app in which there are two UIViews and in those UIViews I am loading Tableviews.. When I click a tablecell in one TableView then I am unable to redirect it to another TableView and getting error:Program received signal SIGABRT.But if I want to load a UIView when a tablecell is clicked it gets executed perfectly.I couldn't understand where Am I going wrong.... This is the code i'm writing</p> <pre><code> ViewController1: #import ViewController2.h" -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ViewController2 *v2 = [ViewController alloc] initWithNibName:@"ViewController2" bundle:[NSBundle mainBundle]]; [self presentModalViewController:v2 animated:NO]; **//getting error at this line** [v2 release]; } ViewController2.h #import"ViewController1.h" - (void)viewDidLoad { [super viewDidLoad]; tableView1 = [[UITableView alloc]initWithFrame:CGRectMake(10, 10, 320, 460)]; tableView1.delegate = self; tableView1.dataSource = self; [self.view addSubview:tableView1]; } </code></pre> <p>Couldn't understand what could be the possible cause of this error..</p>
5,515,157
1
Python web service for a java application? <p>Forgive me if this is a stupid question. I am completely new to building web services and complete web apps. I want to develop a particular functionality for a java based web application. However this functionality is simpler to develop with Python. So is it possible If i develop this web service with Python and use it for a Java based webapp?</p>
13,270,995
0
<p>I might have simplified my example a little to much. The data in A,B,C might be non-numeric and not sorted and so forth.</p> <p>I found last_value() <a href="http://www.oracle.com/technetwork/issue-archive/2006/06-nov/o66asktom-099001.html" rel="nofollow">http://www.oracle.com/technetwork/issue-archive/2006/06-nov/o66asktom-099001.html</a> fit very well with this which would return:</p> <pre> A B C | Id 1 2 3 | 1 1 4 5 | 1 1 4 6 | 1 </pre> <p>for me to operate furhter on.</p> <p>Then the query looks something like this:</p> <pre><code>select distinct last_value(a ignore nulls) over (order by id) a, last_value(b ignore nulls) over (order by id) b, last_value(c ignore nulls) over (order by id) c from datatable where datatable.id IN (select id from datatable where datatable.id = 1) </code></pre>
25,294,939
0
How to make a JButton add user input to an ArrayList and display it in a JList <p>I have an app that contains 3 classes - main gui (Book), add, contact.</p> <p>I have a JList in my phonebook class. I have a dialog window as my add class as it needs to add a contact, now I can add the data but storing it into an array and then placing that into a JList is proving tricky.</p> <p>Would anyone be able to help? I am new to java and I understand that I will need to use defaultListModel at some point but I don't quite understand where</p> <p>My button in the add class is called btnOK my arraylist is just ArrayListcontact my JList is just called list.</p> <p>Thanks to anyone who can help!</p>
25,908,146
0
Need help on a specific Regex <p>I want to validate an attribute of an xml file with an XSD file. This attribute must contain a list of comma-separated languages, like this :</p> <pre><code>&lt;Params languages="English,French,Spanish" /&gt; // OK &lt;Params languages="French,Spanish" /&gt; // OK &lt;Params languages="French" /&gt; // OK &lt;Params languages="English,French,Spanish,French" /&gt; // NOK (Two times French) &lt;Params languages="English,Spanish,French," /&gt; // NOK (Comma at the end) </code></pre> <p>So i try to write a regex pattern to validate this. Here are the constraints :</p> <ul> <li>I must have at least one language</li> <li>I cannot have a comma at the end of the string</li> <li>I one language can appear only one time in the string</li> <li><strong>EDIT : I have an important list of possible languages</strong></li> </ul> <p>The two last constraints are the problem, i don't know how to do it.</p> <p>Here is what i got now : </p> <pre><code>^[English,|French,|Spanish,...]+$ </code></pre> <p>But it's really poor. Thanks for your help.</p>
20,402,214
0
Set mongo db via JNDI in Tomcat <p>i have a persistence.xml with the following structure:</p> <pre><code>&lt;persistence-unit name="contacts_nosql" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt; &lt;jta-data-source&gt;java:comp/env/jdbc/MY_DS&lt;/jta-data-source&gt; &lt;class&gt;com.mydomain.model.User&lt;/class&gt; &lt;properties&gt; &lt;property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/&gt; &lt;property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/&gt; &lt;property name="eclipselink.nosql.property.mongo.port" value="27017"/&gt; &lt;property name="eclipselink.nosql.property.mongo.host" value="someurl.de"/&gt; &lt;property name="eclipselink.nosql.property.mongo.db" value="mydb"/&gt; &lt;property name="eclipselink.logging.level" value="FINEST"/&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; </code></pre> <p>I want to set the properties via JNDI. I thought it is enough to write the following into the context.xml of the tomcat:</p> <pre><code>&lt;Resource name="jdbc/MY_DS" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="20" maxWait="10000" username="myuser" password="mypwd" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mydb?useUnicode=true&amp;amp;characterEncoding=utf8" validationQuery="SELECT 1" removeAbandoned="true" removeAbandonedTimeout="300" /&gt; </code></pre> <p>For some reason this does not work. </p> <p>I see this in the log: Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null].</p> <p>What is wrong or what do i have to add?</p>
21,983,359
0
Compojure/Clojure error with routes <p>I am making a web-app using Clojure/ring/compojure and am having trouble with the routing. I have two files: web.clj and landing.clj. I want to route the user who navigates to the uri from the web.clj handler to the landing.clj one and for the home function to be called which will render the front page of my app. I can't for the life of me seem to grok the semantics, please help. Documentation that I read assumes a lot of web-dev knowledge and I am a beginner. I am now getting a 404 error message in the browser when I run the local server from Leiningen. I know That it is going through the defroutes in the landing.clj file, because the address bar shows <code>http://0.0.0.0:5000/landing</code>, when I load <code>http://0.0.0.0:5000</code>.</p> <p>This is the code for my web.clj file, which successfully redirects to the landing.clj file:</p> <pre><code> (defroutes app (ANY "/repl" {:as req} (drawbridge req)) (GET "/" [] (redirect "landing")) ;; come fix this later (ANY "*" [] (route/not-found (slurp (io/resource "404.html"))))) </code></pre> <p>This is from the landing.clj file, the error is located somewhere with the <code>GET "/"</code> function:</p> <pre><code>(defroutes app (GET "/" [] {:status 200 :headers {"Content-Type" "text/html"} :body (home)}) (POST "/" [weights grades] ((process-grades (read-string weights) (read-string grades)) )) (ANY "*" [] (route/not-found (slurp (io/resource "404.html"))))) </code></pre>
37,733,947
0
How to track time taken for each goal in a Maven build? <p>Maven reports overall time taken for each module at the end of a build but how can I instrument Maven to report how long running each goal took in a build? This information can be even more helpful in a multi-module build.</p>
6,101,225
0
<p>You can also comment a block with =begin and =end like this:</p> <pre><code>&lt;% =begin %&gt; &lt;%= link_to "Sign up now!", signup_path, :class =&gt; "signup_button round" %&gt; &lt;% =end %&gt; </code></pre>
13,343,128
0
<p>I think I've found a workaround:</p> <p>In the Eclipse instance you want to disable DDMS, select: </p> <pre><code>Windows &gt; Preferences &gt; DDMS </code></pre> <p>And change the "Base local debugger port to some unused port number (such as 22222).</p> <p>There is an error messages about not being able to connect to DDMS, but after dismissing it, it stops competing with the other Eclipse.</p>
30,495,195
0
No mapping found for HTTP request with URI [] in DispatcherServlet with name 'spring' <p>I am having problem in viewresolver in spring framework .</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt; &lt;context:component-scan base-package="com.controller" /&gt; &lt;mvc:annotation-driven/&gt; &lt;!-- &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix" value="" /&gt; &lt;property name="suffix" value="InfraUI.html" /&gt; &lt;/bean&gt; --&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/&gt; &lt;property name="prefix" value="" /&gt; &lt;property name="suffix" value="Home.html" /&gt; &lt;property name="order" value="0" /&gt; &lt;/bean&gt; &lt;mvc:resources mapping="/WebContent/**" location="/WebContent/" /&gt; &lt;!-- Initialization for data source --&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/&gt; &lt;property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:XE"/&gt; &lt;property name="username" value="XXXX"/&gt; &lt;property name="password" value="XXXX"/&gt; &lt;/bean&gt; &lt;!-- Definition for JDBCTemplate bean --&gt; &lt;bean id="JDBCTemplate" class="com.dao.JDBCTemplate"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <h2>web.xml</h2> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; &lt;display-name&gt;E-Health3&lt;/display-name&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;InfraUI.html&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;servlet&gt; &lt;servlet-name&gt;spring&lt;/servlet-name&gt; &lt;servlet-class&gt; org.springframework.web.servlet.DispatcherServlet &lt;/servlet-class&gt; &lt;!-- &lt;init-param&gt; &lt;param-name&gt;contextConfiguration&lt;/param-name&gt; &lt;param-value&gt;/WebContent/WEB-INF/spring-servlet.xml&lt;/param-value&gt;&lt;/init-param&gt; --&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;spring&lt;/servlet-name&gt; &lt;url-pattern&gt;*.html&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p>Controller:</p> <pre><code>package com.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class CustomController { @RequestMapping(value="/",params="abcd") public void test() { System.out.println("in test method of conroller"); } } </code></pre> <p>what I was trying is to send a request from html page to spring controller and return an JSON from spring controller to the requesting page. But now I am getting this error after to build through tomcat,</p> <pre><code>org.springframework.web.servlet.PageNotFound noHandlerFound WARNING: No mapping found for HTTP request with URI [/CONTEXTROOT/] in DispatcherServlet with name 'spring' </code></pre>
31,644,740
0
<p>I think you should optimise your adapter for recycler view. PagerAdapter is not the culprit. It would be Recycler View that is involved in scrolling.</p> <p>Ideally you should use bean classes instead of ArrayList> because it takes more time to compute has code on keys every time. Also you should take care of following things.</p> <p>Also you are calling <code>arrayList.get(position)</code> every time you want to get some data, call it single time and make the reference of it in bindView and use that reference every where.</p> <p>Make your view hierarchy as flatten as possible, because view hierarchy matters a lot in AdapterViews and can have impact on performance depending upon nesting level.</p>
2,610,216
0
<p>Either use SFTP or just plain FTP on an secure, encrypted connection.</p>
36,292,016
0
C - create TCP SYN without filling IP header using raw socket <p>I want my application to create TCP SYN packet and send on network. I did not set <code>IP_HDRINCL</code> using <code>setsockopt</code> because I want the kernel to fill the IP Header.</p> <p>I tried </p> <ol> <li>using a byte buffer to include TCP Header + Payload </li> <li>using a byte buffer to include IP Header + TCP Header + Payload.</li> </ol> <p>Both above methods returned <code>sendto</code> error -1 and errno is set to 88 Following is the code I used </p> <pre><code>#include &lt;sys/socket.h&gt; #include &lt;sys/types.h&gt; #include &lt;netinet/in.h&gt; #include &lt;netinet/ip.h&gt; #include &lt;netinet/tcp.h&gt; #include &lt;errno.h&gt; int main() { int sockfd; if(sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_TCP) &lt; 0) { printf("sokcet functin failed : \n"); exit (-1); } char packet[512]; struct sockaddr_in remote; // remote address struct iphdr *ip = (struct iphdr *) packet; struct tcphdr *tcp = (struct tcphdr *) packet + sizeof(struct iphdr); /* struct tcphdr *tcp = (struct tcphdr *) packet; // tcp header */ remote.sin_family = AF_INET; // family remote.sin_addr.s_addr = inet_addr("192.168.0.57"); // destination ip remote.sin_port = htons(atoi("3868")); // destination port memset(packet, 0, 512); // set packet to 0 tcp-&gt;source = htons(atoi("6668")); // source port tcp-&gt;dest = htons(atoi("3868")); // destination port tcp-&gt;seq = htons(random()); // inital sequence number tcp-&gt;ack_seq = htons(0); // acknowledgement number tcp-&gt;ack = 0; // acknowledgement flag tcp-&gt;syn = 1; // synchronize flag tcp-&gt;rst = 0; // reset flag tcp-&gt;psh = 0; // push flag tcp-&gt;fin = 0; // finish flag tcp-&gt;urg = 0; // urgent flag tcp-&gt;check = 0; // tcp checksum tcp-&gt;doff = 5; // data offset int err; if((err = sendto(sockfd, packet, sizeof(struct iphdr), 0, (struct sockaddr *)&amp;remote, sizeof(struct sockaddr))) &lt; 0) { // send packet printf("Error: Can't send packet : %d %d !\n\n", err, errno); return -1; } </code></pre> <p>Why i am getting the <code>sendto</code> error -1 and errno 88? </p> <p>Also, I want to know how to determine the length of data that is to be used in second argument in <code>sendto</code> function. If I hard code it to size of packet byte buffer i.e. 512 bytes, is it wrong ? </p>
19,164,698
0
How to select a row based on its row number? <p>I'm working on a small project in which I'll need to select a record from a temporary table based on the actual row number of the record.</p> <p>How can I select a record based on its row number?</p>
33,949,162
0
<p>to actually get the response you must add:</p> <pre><code>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); </code></pre> <p>don't scrape google, even to test, they actively detect and stop this</p>
33,234,871
0
How can I convert a data table in C# to data.fame in R using R.net <p>I need to convert a data table which I have defined as follows to a data frame in R.</p> <pre><code>DataTable dtb = new DataTable(); dtb.Columns.Add("Column1", Type.GetType("System.String")); dtb.Columns.Add("Column2", Type.GetType("System.String")); DataRow dtr1 = dtb.NewRow(); dtr1[0] = "abc"; dtr1[1] = "cdf"; dtb.Rows.Add(dtr1); DataRow dtr2 = dtb.NewRow(); dtr2[0] = "asdasd"; dtr2[1] = "cdasdasf"; dtb.Rows.Add(dtr2); </code></pre> <p>Is there any way to convert above DataTable "<code>dtb</code>" to a data.frame in R. I have defined this DataTable in C# but I need to do computation in R, that is why I need to pass it to R.</p>
28,853,966
0
<p>You don't need any restriction. Just get the profile of the logged user and edit it:</p> <pre><code>@login_required def edit_profile(request): profile = request.user.profile ... </code></pre>
40,255,308
0
Why default proguard configurations in android sdk use keep *Annotation* <p>There is one line in the default proguard configuration of android sdk:</p> <pre><code>-keepattributes *Annotation* </code></pre> <p>According to Proguard Manual, this line equals to:</p> <pre><code>-keepattributes RuntimeVisibleAnnotations,RuntimeInvisibleAnnotations,RuntimeVisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations,RuntimeVisibleTypeAnnotations,RuntimeInvisibleTypeAnnotations,AnnotationDefault </code></pre> <p>In my opinion, maybe the configuration below is enough:</p> <pre><code>-keepattributes RuntimeVisibleAnnotations,RuntimeVisibleParameterAnnotations,RuntimeVisibleTypeAnnotations,AnnotationDefault </code></pre> <p>Have I missing something? Why the recommend configuration keep all this things?</p>
35,685,490
0
<p>For me, this ERROR was the result of utilizing NSURLProtocol and the "setProperty" method.</p> <p>[NSURLProtocol setProperty:FOO forKey:BAR inRequest:newRequest];</p> <p>I am not exactly certain of what is going on here, but from my experience I had two NSURLProtocol implementations. One needed property (FOO) and the other didn't. </p> <p>Core Code sets (FOO) NSURLProtocol #1 gets (FOO) and handles the COMM itself --- no issue</p> <p>NSURLProtocol #2 doesn't access (FOO) and hands of the COMM to a SESSION -- shows the error above</p> <p>Commenting out the Core Code that sets the (FOO) property solves the problem for NSURLProtocol #2. Obviously if you are using 3rd-party code, this would be more difficult to manage.</p> <p>BTW, in my case this "ERROR" didn't break the follow of logic and operated more as a warning.</p>
34,947,769
0
<p>This should do it:</p> <pre><code>perl -ne '/ZTFN00\D+(\d+)/ &amp;&amp; print $1,"\n"' yourfile </code></pre> <p>If your 'number' is always separated by whitespace ( where there 00 after ZTFN isn't) then you can use that as your test:</p> <pre><code>perl -ne 'print m/\b(\d+)\b/,"\n"' yourfile </code></pre>
37,818,981
0
<p>By default the body on the page has this css:</p> <pre><code>body { display: block; margin: 8px; } body:focus { outline: none; } </code></pre> <p>at the top of your css file just add:</p> <pre><code>body { margin:0; } </code></pre> <p>this way you're working with 0 margins to begin with.</p>
8,442,931
0
Margin on table <p>I have a margin-top problem on my <code>&lt;table&gt;</code>. The <code>&lt;p&gt;</code> is staggered for every line. I have tried to define the table in css, but it doesn't work.</p> <p><a href="http://whatsyourproblem.dk/?page_id=89" rel="nofollow">http://whatsyourproblem.dk/?page_id=89</a> </p>
19,661,658
0
Show Wordpress Posts Associated with Certain Author <p>Suppose I want to show posts from one certain author on the main index of a wordpress website, how would I go about this ?? Below is a loop from the twenty thirteen theme:</p> <pre><code>&lt;?php $curauth = (isset($_GET['liamhodnett'])) ? get_user_by('liamhodnett', $author) : get_userdata(intval($author)); ?&gt; &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt; &lt;li&gt; &lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link: &lt;?php the_title(); ?&gt;"&gt; &lt;?php the_title(); ?&gt;&lt;/a&gt;, &lt;?php the_time('d M Y'); ?&gt; in &lt;?php the_category('&amp;');?&gt; &lt;/li&gt; &lt;?php endwhile; else: ?&gt; &lt;p&gt;&lt;?php _e('No posts by this author.'); ?&gt;&lt;/p&gt; &lt;?php endif; ?&gt; </code></pre>
22,643,899
0
<p>Darrell, if you run embedded there are no ports and no config files. </p> <p>You just provide store-directories and optionally database config to your <code>GraphDatabaseService</code> instances which are (in Spring Data Neo4j) created as spring beans.</p> <p>Unfortunately there is no compatible way between 1.9 and 2.0 as the public constructors of <code>EmbeddedGraphDatabase</code> were removed in 2.0 and I added a <code>GraphDatabaseServiceFactoryBean</code> in SDN 3.0 / Neo4j 2.0.</p> <p>To run a server with an embedded Neo4j you'd probably have to go the way of extending <code>CommunityBootstrapper</code>. But here is no out of the box way integrating this in Spring right now.</p> <p>So to make it work, I'd probably create a subclass of <code>CommunityBootstrapper</code> which starts the server, but can be passed in the <code>GraphDatabaseService</code> from the outside.</p> <p>See my in-memory-server project for some hints: <a href="https://github.com/jexp/neo4j-in-memory-server" rel="nofollow">https://github.com/jexp/neo4j-in-memory-server</a></p>
43,219
0
<p>We use <a href="http://www.sqlmanager.net/en/products/dbcomparer" rel="nofollow noreferrer">DB Comparer</a> from EMS - they have a large range of tools each specifically targeted for a particular platform (they support SQL Server, MySQL, Interbase/Firebird, PostgreSQL, Oracle etc).</p> <p>The program allows you to compare 2 databases, and generate scripts for going from each database schema to the other. It works out dependencies and each of the script components are shown in a sort-of visual way (it's really a glorified owner-drawer listbox, I think). You can run bits of the script against the relevant database, save scripts down to files, etc etc.</p> <p>We use it mostly for keeping our development SQL Server 2005 databases in line with each other.</p> <p>It's not free, but there is a trial version available and it's not particularly expensive given what it does.</p> <p>We have quite a number of EMS tools here and they're all pretty good - much prefer using their <a href="http://www.sqlmanager.net/en/products/mssql/manager" rel="nofollow noreferrer">SQL Manager for SQL Server</a> tool to the ones that come with SQL Server, or any of the commercial offerings we looked at a couple of years ago (Toad, Redgate, Embarcadero etc from memory, I think).</p>
30,455,219
0
catch mongo requests from app server <p>I have a MVC .net application, running on IIS, that uses mongo. The mongo servers are sharded, and not in my control. I want to see the request that my application server sends to mongo (the queries in the mongo syntax).</p> <p>I tries fiddler, but I saw that the communication to mongo is through TCP, so I tried wireshark. In wireshark I see the request, but is how do I see the full request?</p> <p>Thanks for the help!</p> <p>Edit: The answer that was suggested does not answer what I wanted. I want to see from the application server the requests. It will help me follow what happens in certain situations. Also because we work with 4 mongo servers I don't know with will handle each request.</p>
5,590,206
0
<p>I believe your instinct to create shorter segments with joints connecting them is correct and yes, the number of bodies you end up creating for a length of rope will have an effect on the performance.</p> <p>To know whether it will work for your particular situation, I would suggest creating a rope with variable length segments and make a decision based off benchmarking the performance as to how smooth you can make the rope by increasing the number of segments.</p>
35,359,541
0
<p>I think you are looking for this: <a href="https://www.git-notifier.com/" rel="nofollow">https://www.git-notifier.com/</a></p> <p>The email notifications are for free, but to send SMS to your mobile it is not for free. Hope it helps.</p>
2,338,843
0
ActiveRecord Claims No Adaptor Specified <p>When I try to run the following, I get an error back from ActiveRecord stating that the connector hasn't been found.</p> <pre><code>require 'activerecord' ActiveRecord::Base.establish_connection( :adaptor =&gt; "sqlite3", :database =&gt; "db.sqlite3" ) </code></pre> <p>Error Message:</p> <pre><code>&gt;&gt; ActiveRecord::Base.establish_connection("adaptor" =&gt; "sqlite3-ruby") ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/ gems/activerecord/2.2.2/lib/active_record/connection_adapters/abstract/ connection_specification.rb:64:in `establish_connection' </code></pre> <p>Is the ActiveRecord gem broken, or is the initial code incorrect?</p>
27,295,570
0
HTTP POST is not working from Java <p>I am trying to do an http post. Same code was working.But now it is not hitting my servlet now, but giving http response code 200. From browser same url is hitting the servlet. Is there anything that restricting my post?. Please help me on it. Sorry for bad english.</p> <pre><code>int timeout=3000; String url="http://localhost:8020/WiCodeDynamic/WiCode?json="; String requestUrl="{\"vspCredentials\":{\"id\":\"TET\",\"password\":\"test\"}}"; URL x = new URL(url); HttpURLConnection connection =(HttpURLConnection)x.openConnection(); connection.setRequestMethod("POST"); //;charset=utf-8 connection.setRequestProperty("Content-type","application/json"); connection.setDoOutput(true); connection.setConnectTimeout(timeout); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream())); bw.write(requestUrl); bw.flush(); int resp_code = connection.getResponseCode(); String resp_msg = connection.getResponseMessage(); System.out.println("resp_code="+resp_code); System.out.println("resp_msg="+resp_msg); </code></pre> <p>brs,</p>
34,818,481
0
<p><code>from app.models import Entry</code></p> <p>You must import Entry from the models module of the app.</p> <p>You may also need to add relative imports in your <code>__init__</code> for any custom modules.</p> <p>add to your <code>__init__</code></p> <p><code>from .models import *</code></p> <p>edit: Another useful debugging tip - is to use the <code>dir()</code> function to see what is included in a package. In your case, the imports are working so you can run something like</p> <p><code>dir(app)</code></p> <blockquote> <p>With an argument, attempt to return a list of valid attributes for that object.</p> </blockquote> <p>for instance here is a returned list for a flask app I wrote.if You cant see your moudle here, add the import.</p> <p><a href="https://i.stack.imgur.com/0YD4N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0YD4N.png" alt="enter image description here"></a></p>
9,814,125
0
Hosted video - fullwidth preview on starred post? <p>When you post a YouTube video to your timeline and STAR the post, the video preview displays fullwidth. Same goes for a video uploaded to Facebook when starred. </p> <p>We self-host our video (flowplayer) and playing in-line works fine, but when we star a post with our own inline video, we get a small thumbnail preview with description text on the right. <strong>Any ideas what drives the fullwidth behaviour?</strong> </p> <p>Thanks!</p>
1,482,487
0
<p>You could programmatically extract the jar file, <a href="http://www.devx.com/tips/Tip/22124" rel="nofollow noreferrer">http://www.devx.com/tips/Tip/22124</a>, the update one file that will prevent the application from running anymore, then rejar it.</p> <p>The other option would be to just delete some critical class from the jar file, but neither of these will prevent it from being run again, as they can copy the jar file.</p> <p>You can't update a registry as there isn't a platform independent way to do that.</p>
14,565,895
0
<p>This behaviour is fixed in the latest <a href="https://github.com/jzaefferer/jquery-validation/archive/master.zip" rel="nofollow">jquery-validate.js on github</a>. The bug was reported as </p> <blockquote> <p>'E-mail validation fires immediately when text is in the field'</p> </blockquote> <p><a href="https://github.com/jzaefferer/jquery-validation/issues/521" rel="nofollow">bug report and discussion here</a> </p>
26,267,570
0
How to select rows from Table X who share the least relationships with Table Y? <p>suppose we have the following two tables</p> <pre><code>TABLE: PEOPLE +----+------+ | id | name | +----+------+ | 1 | john | +----+------+ | 2 | mike | +----+------+ | 3 | derp | +----+------+ TABLE: Images +----+-----------+----------+ | id | person_id | image | +----+-----------+----------+ | 1 | 3 | img1.jpg | +----+-----------+----------+ | 2 | 3 | img2.jpg | +----+-----------+----------+ | 3 | 2 | img3.jpg | +----+-----------+----------+ </code></pre> <p>I need to a query that selects all people from <code>people</code> table and orders them ASC by the ones that have the least images in the images table</p> <p>So the order of the returned rows would be</p> <pre><code>John Mike Derp </code></pre>
15,822,140
0
<p>You probably want to do a <code>LEFT JOIN</code> and a <code>GROUP_CONCAT</code> and <code>HAVING</code> to get the info you are looking for:</p> <pre><code>SELECT i.id, i.title, GROUP_CONCAT( l.stockcode SEPARATOR ',' ) extras FROM items i LEFT JOIN ledger l ON i.id = l.itemid WHERE i.id = 123 HAVING SUM(l.qty) &gt; 0 </code></pre> <p>See this <a href="http://sqlfiddle.com/#!2/4db68/4" rel="nofollow">SQL Fiddle</a></p>
25,096,117
0
<pre><code>$ cat file [foo] name = 3 name = 17 [bar] name = 24 name = 5 $ awk -v id="foo" '/\[/{f=index($0,"["id"]")} f' file [foo] name = 3 name = 17 $ awk -v id="bar" '/\[/{f=index($0,"["id"]")} f' file [bar] name = 24 name = 5 </code></pre> <p>The above just sets a flag (<code>f</code> for found) when it finds a line containing <code>[foo]</code>, for example, and clears it when it finds the next line containing a <code>[</code>. When <code>f</code> is set it prints the line.</p> <p>Note also that unlike any possible sed solution, the above will be unaffected by RE metacharacters or delimiter characters in the search variable (e.g. <code>., ?, *, +, /, (, etc.</code>) since it is looking for a STRING not a regular expression.</p>
6,277,869
0
<p>You could disable rich-text features of the editor so that HTML tags and characters don't get added to the content.</p>
31,872,653
0
How can i determine that CollapsingToolbar is collapsed? <p>I need to know when CollapsingToolbar from material design library is collapsed.</p>
28,302,016
0
How can I simulate events like Series1DblClick or Chart1ClickSeries when programatically creating Charts and Series on the runtime? <p>In a small Delphi program I create few TCharts and TBarSeries programmatically on the runtime but then I want to be able to click on a bar of the chart and fire, for example, a Chart1ClickSeries event to display information of that bar. Is that possible??</p>
40,642,093
0
<p>Your best bet is to:</p> <ol> <li>Review all of the docs (<a href="https://netsuite.custhelp.com/app/home" rel="nofollow noreferrer">NetSuite SuiteAnswers</a>).</li> <li>Install the SuiteScript IDE (needs Eclipse).</li> <li>Get in and mess around with sample use cases. Then ask about those, including a sample of the code you have tried.</li> </ol>
15,280,048
0
<p>You are only stopping the animation of certain classes. To achieve a "global" stop in animation, you will have to clear the animation queue for all elements that will be potentially animated in your JS function.</p> <p>This will mean doing something along the line of:</p> <pre><code>$(document).ready(function() { var activeNews = "01"; $(".newsNav.forward").click(function(event) { event.preventDefault(); // Pre-emptively stops all animation $(".newsItem").stop(true, true); // Note the removal of the .stop() method before each animation if (activeNews == 01) { $(".newsItem.01").fadeOut(250, function() { $(".newsItem.02").fadeIn(250); }); activeNews = 02; } else if (activeNews == 02) { $(".newsItem.02").fadeOut(250, function() { $(".newsItem.03").fadeIn(250); }); activeNews = 03; } else if (activeNews == 03) { $(".newsItem.03").fadeOut(250, function() { $(".newsItem.01").fadeIn(250); }); activeNews = 01; } }); }); </code></pre>
26,857,394
0
<p>It will be pretty straight forward with jQuery. Below Fiddle will help you.</p> <p><a href="http://jsfiddle.net/17g6q8k0/2/" rel="nofollow">http://jsfiddle.net/17g6q8k0/2/</a></p> <pre><code>var sourceSwap = function () { var $this = $(this); var newSource = $this.data('alt-src'); $this.data('alt-src', $this.attr('src')); $this.attr('src', newSource); } $(function() { $('img[data-alt-src]').each(function() { new Image().src = $(this).data('alt-src'); }).hover(sourceSwap, sourceSwap); }); </code></pre>
40,486,918
0
Are AWS Security Group Port Ranges Inclusive or Exclusive <p>AWS security groups allow a port range to be specified for permitted traffic, written in the form <code>1234-5678</code>: would that be inclusive of ports <code>1234</code> and <code>5678</code>, or exclusive of either/both of those ports?</p> <p>The <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html#adding-security-group-rule" rel="nofollow noreferrer">documentation</a> doesn't seem to describe this.</p>
17,254,798
0
Check Which Website is Visited <p>I've been having trouble finding a way to check if the user of the program is visiting a specific website. If I wanted to open a pop up box telling me which website I was currently on, what would be the best way to do it?</p> <p>I've been thinking about various ways but I can never come to a definite conclusion. Thought about checking which browser is open by browsing the processes or checking the window, but how would I find it out? Even if I didn't find out exact website address but just the name, would be fine.</p> <p>For example, right now the window open says 'Check Which Website is Visited - Stack Overflow - Mozilla Firefox', is there a way to get that from a programming standpoint? Like somehow check and read what windows are currently open. </p> <p>Thanks for any help.</p>
23,812,057
0
<p>Your empty view needs to be set to <code>android:visibility="gone"</code> and be at the same level as your <code>ListView</code> in your activity/fragment layout file.</p>
28,604,276
0
<p>It seems one of <code>GetSuppliers()</code> ` is not executed till the part where you set</p> <pre><code>con.Close() </code></pre> <p>You have two alternatives:</p> <p>1.Open the connection only once and use it in every method without closing it and close it on <code>Application.Exit</code>:</p> <pre><code> public Add() { InitializeComponent(); con.Open(); } ......... private void Add_Closing(object sender, EventArgs e) { con.Close(); } </code></pre> <ol start="2"> <li><p>Set this check in every attempt to open con:</p> <p>if (con.State == ConnectionState.Closed) { con.Open(); }</p></li> </ol>
744,275
0
<p>On the whole topic of IE6, whenever you get to that point of moving IT out of the past, you could use this: </p> <p><a href="http://code.google.com/p/ie6-upgrade-warning/" rel="nofollow noreferrer">http://code.google.com/p/ie6-upgrade-warning/</a></p>
5,656,805
0
<p>I had a similar problem using Star Impact Printer, spend over two days using all codes. At end resolve it by using RawPrinterHelper class available from Microsoft. Here is the code which I have used to open the cash Drawer attached to the printer. s = Chr(&amp;H7); RawPrinterHelper.SendStringToPrinter(receiptprinter, s); You can substitute s for the full Receipt text. It should do graphics as well , but I have not tried it.</p>
32,068,342
0
<p>You can use,</p> <p>Your html,</p> <pre><code>&lt;table&gt; &lt;tr class="" role="row"&gt; &lt;td class="e-rowcell e-templatecell" role="gridcell" style="text-align: center;"&gt; &lt;input type="checkbox" class="XAxisrowCheckbox"&gt; &lt;/td&gt; &lt;td class="e-rowcell e-hide" role="gridcell" style="text-align: left;"&gt;0&lt;/td&gt; &lt;td class="e-rowcell" role="gridcell" style="text-align: left;"&gt;Location ID&lt;/td&gt; &lt;/tr&gt; &lt;tr class="e-alt_row" role="row" aria-selected="true"&gt; &lt;td class="e-rowcell e-templatecell e-selectionbackground e-active" role="gridcell" style="text-align: center;"&gt; &lt;input type="checkbox" class="XAxisrowCheckbox"&gt; &lt;/td&gt; &lt;td class="e-rowcell e-hide e-selectionbackground e-active" role="gridcell" style="text-align: left;"&gt;1&lt;/td&gt; &lt;td class="e-rowcell e-selectionbackground e-active" role="gridcell" style="text-align: left;"&gt;Location Name&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Create class called <code>red</code>,</p> <pre><code>.red { background-color: red; } </code></pre> <p>Simply apply class when Checkbox is checked</p> <pre><code>$(document).on('click', '.XAxisrowCheckbox', function () { $(this).parents("tr").toggleClass("red", this.checked); }); </code></pre> <p><a href="http://Fiddle" rel="nofollow"><strong>Fiddle Demo</strong></a></p>
40,670,046
0
<p>The error says it all: fgets() expects three arguments. You are giving it one. </p> <p>So, call it like this:</p> <pre><code>fgets(buffer, 256, stdin) </code></pre> <p><em>buffer</em> is where the input is to be stored, <em>256</em> is the size of the buffer, <em>stdin</em> is the stream to read from. </p> <p>Also, <a href="http://stackoverflow.com/questions/3209909/how-to-printf-unsigned-long-in-c">use %lu</a> instead of %d as the format specifier for unsigned long. </p> <p><strong>Edit</strong>: <a href="http://stackoverflow.com/questions/2524611/how-can-one-print-a-size-t-variable-portably-using-the-printf-family">Use the z modifier</a> as <code>%zu</code> for the value returned by <code>strlen</code>, which is of type <code>size_t</code></p>
23,918,462
0
angular directive unit testing with jasmine with template and link <p>I have a directive as below which i want to cover as part of my jasmine unit test but not sure how to get the template value and the values inside the link in my test case. This is the first time i am trying to unit test a directive.</p> <pre><code>angular.module('newFrame', ['ngResource']) .directive('newFrame', [ function () { function onAdd() { $log.info('Clicked onAdd()'); } return { restrict: 'E', replace: 'true', transclude: true, scope: { filter: '=', expand: '=' }, template: '&lt;div class="voice "&gt;' + '&lt;section class="module"&gt;' + '&lt;h3&gt;All Frames (00:11) - Summary View&lt;/h3&gt;' + '&lt;button class="btn" ng-disabled="isDisabled" ng-hide="isReadOnly" ng-click="onAdd()"&gt;Add a frame&lt;/button&gt;' + '&lt;/section&gt;' + '&lt;/div&gt;', link: function (scope) { scope.isDisabled = false; scope.isReadOnly = false; scope.onAdd = onAdd(); } }; } ]); </code></pre>
18,857,214
0
<p>I also ran into the same issue. It would seem that the <code>transactionReceipt</code> on the <code>originalTransaction</code> will always return nil when restoring purchases. From the Discussion in the apple docs for <code>transactionReceipt</code>:</p> <p><a href="https://developer.apple.com/library/ios/documentation/StoreKit/Reference/SKPaymentTransaction_Class/Reference/Reference.html#//apple_ref/occ/instp/SKPaymentTransaction/originalTransaction" rel="nofollow">Discussion</a><br> The contents of this property are undefined except when <code>transactionState</code> is set to <code>SKPaymentTransactionStateRestored</code>.</p> <p>Since during a restore (of a consumable item) the <code>transactionState</code> is always set to <code>SKPaymentTransactionStatePurchased</code>, the <code>originalTransaction.transactionReceipt</code> property will always be nil.</p>
2,112,442
0
Streaming Flash Video Problem - Clipping <p>I have a simple flash video player that streams the video from a streaming media server. The stream plays fine and I have no problems with playing the video and doing simple functions. However, my problem is that on a mouse over of the video, I have the controls come up and when I do a seek or scrub on the video, I get little weird boxes that show over the video - like little pockets - of the video playing super fast (you can basically see it seeking) until it gets to the point it needs to be at and then these little boxes disappear. Is anybody else having these problems and if so, how do I fix this? I thought it might be some kind of masking problem, but I haven't been able to figure it out. Please Help!!!</p>
28,795,269
0
<pre><code>$newArray = []; foreach($array as $value) { foreach($value as $key =&gt; $data) { $newArray[$key][] = $data; } } var_dump($newArray); </code></pre> <p>or </p> <pre><code>$newArray = []; foreach($array as $value) { $newArray = $newArray + $data; } var_dump($newArray); </code></pre>
21,782,032
0
<p>Based on my understanding, <strong>Navigation</strong> with <strong>ScopedRegions</strong> would not be a straight forward feature of <strong>Prism</strong>. There are some workarounds posted however, in order to accomplish it in a quite simple way.</p> <p>You can look at the following post and discussion thread for handling <strong>ScopeRegionManagers</strong> across <strong>Navigation</strong>:</p> <ul> <li><a href="http://blogs.southworks.net/aadami/2011/11/30/prism-region-navigation-and-scoped-regions/" rel="nofollow">Prism Region Navigation and Scoped Regions</a></li> <li><a href="https://compositewpf.codeplex.com/discussions/236849" rel="nofollow">Navigation and ScopedRegions</a></li> </ul> <p>Basically, Agustin Adami's proposal would be to obtain the scoped <strong>RegionManager</strong> from the <strong><em>Region.Add()</em></strong> method, through the <strong>NavigationResult</strong> passed in the navigation callback from the <strong><em>RequestNavigate()</em></strong> method.</p> <p>The Navigation call then would look as follows:</p> <pre><code>this.regionManager.RequestNavigate( "MainRegion", new Uri("HelloWorldView?createRegionManagerScope=true", UriKind.Relative), (result) =&gt; { var myRegionManager = result.ExtractRegionManager(); myRegionManager.RequestNavigate("NestedRegion", new Uri("View1", UriKind.Relative)); }); </code></pre> <hr> <p><strong>UPDATE:</strong></p> <p>One possible approach for setting the scoped <strong>RegionManager</strong> into the child <strong>ViewModel</strong> would be by using a <strong>Shared Service</strong> and get the scoped <strong>RegionManager</strong> from there.</p> <p>The <strong>Main ViewModel</strong> would store the <strong>RegionManager</strong> as follows:</p> <pre><code>... bool createRegionManagerScope = true; var scopedRegionManager = region.Add(view, null, createRegionManagerScope); var dictionary = ServiceLocator.Current.GetInstance&lt;ScopedRegionManagersSharedDictionary&gt;(); dictionary[Names.ScopedRegionManagerName] = scopedRegionManager; this.regionManager.RequestNavigate( Names.MainRegion, new Uri("HelloWorldView", UriKind.Relative)); </code></pre> <p>And then, the child <strong>ViewModel</strong> should implement <strong>INavigationAware</strong> in order to retreive and set the scoped <strong>RegionManager</strong> on the <strong><em>OnNavigatedTo()</em></strong> method like shown below:</p> <pre><code>void OnNavigatedTo(NavigationContext navigationContext) { var dictionary = ServiceLocator.Current.GetInstance&lt;ScopedRegionManagersSharedDictionary&gt;(); this.regionManager = dictionary[Names.ScopedRegionManagerName]; ... } </code></pre> <p>I hope this helps, Regards.</p>
12,451,523
0
<p>What's probably happening is that your URL has escaped characters in it (%3D%3D) and your $_GET is the unescaped characters so they don't match. str_replace can work on very large strings without a problem.</p> <p>If you want to get rid of that value, just do this:</p> <pre><code>$query_params = $_GET; unset($query_params['stepvars']); $new_link = http_build_query($query_params); </code></pre> <p>That will work even if the param is the first one (?stepvars=...)</p>
32,835,746
0
HTML 5 Section and Main semantic tags use <p>While studying the HTML 5 semantic tags, I've ran upon some doubts on how to proper utilize the <em>main</em> and <em>section</em> tags, and since the <a href="http://www.w3schools.com/html/html5_semantic_elements.asp" rel="nofollow">W3Schools</a> reference seems a little vague and other references on the Web seems to diverge I would like to know if there is a proper guideline to the following questions or if its pretty much up to the programmer:</p> <ol> <li>Does the <em>main</em> tag also has the meaning of grouping related elements or in that case should it be within a <em>section</em> tag?</li> <li>Does it make sense to wrap single elements, such as an image, into a <em>section</em> tag?</li> <li>It's pretty common to have a <em>header</em> and <em>footer</em> of the page (not inside any section), in that case, should the remaining in between those tags be wrapped inside a <em>section</em> tag, as if delimiting the "content" of the page? </li> </ol>
12,137,875
0
<p><strong>HTML :</strong></p> <pre><code>&lt;ul class="UL_tag"&gt; &lt;li&gt;Text 1&lt;/li&gt; &lt;li&gt;Text 2&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.google.com" class="description"&gt;Link to GOOGLE&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="UL_tag"&gt; &lt;li&gt;Text 1&lt;/li&gt; &lt;li&gt;Text 2&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.yahoo.com" class="description"&gt;Link to Yahoo&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>Jquery:</strong></p> <pre><code> var d = $('.UL_tag li').children('a')[1]; // If you remove first href element change it to value "1" to "0" $(d).hide(); </code></pre> <p><strong>See this Demo:</strong> <a href="http://jsfiddle.net/7aNRZ/8/" rel="nofollow">http://jsfiddle.net/7aNRZ/8/</a></p>
31,124,625
0
<p>Sounds like you are getting back an empty response, so that null check always resolves to true. Try checking if the count of the <code>NSArray</code> is greater than 0 instead of <code>if(self.jobs != nil)</code></p> <p>Just change <code>if(self.jobs != nil)</code> to <code>if([self.jobs count] &gt; 0)</code>. </p> <pre><code>if([self.jobs count] &gt; 0) { [self.tableView reloadData]; } else { UIAlertView* alert_view = [[UIAlertView alloc] initWithTitle: @"Failed to retrieve data" message: nil delegate: self cancelButtonTitle: @"cancel" otherButtonTitles: @"Retry", nil]; [alert_view show]; } </code></pre> <p>You might also want to do a null check before you try and do the count to avoid any null reference exceptions:</p> <pre><code>if(self.jobs != nil &amp;&amp; [self.jobs count] &gt; 0) </code></pre>
27,319,283
0
<p>If you took time to read the FineManual for <code>pandas.DataFrame.to_sql</code>, you would have found out by yourself:</p> <blockquote> <p>if_exists : {‘fail’, ‘replace’, ‘append’}, default ‘fail’</p> <pre><code> fail: If table exists, do nothing. replace: If table exists, drop it, recreate it, and insert data. append: If table exists, insert data. Create if does not exist. </code></pre> </blockquote> <p><a href="http://pandas.pydata.org/pandas-docs/version/0.15.1/generated/pandas.DataFrame.to_sql.html" rel="nofollow">http://pandas.pydata.org/pandas-docs/version/0.15.1/generated/pandas.DataFrame.to_sql.html</a></p> <p>For the record, it took me exactly 23s to find this once I had confirmation you were talking about Pandas. </p>
29,645,387
0
Send by mail a query result with a job in SQL Server <p>I'm trying to send an email by a SQL Server job with the result of a query.</p> <p>The query works perfectly and I face an issue when I pass a TABLE in the <code>@query</code> parameter of <code>sp_send_dbmail</code></p> <p>Here is my code : </p> <pre><code>DECLARE @res TABLE ( SiteCode [nvarchar](50), DateLastODV [datetime] ); INSERT INTO @res SELECT SiteCode ,MAX(DateODV) AS DateLastODV FROM Configuration.ODVCompteur where year(DateODV) = 2015 group by SiteCode order by DateLastODV desc EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Foo', @recipients = '[email protected]', @subject = 'Foooooooo', @query = @res, @Attach_Query_result_as_file = 0 </code></pre> <p>I got this error (in french but can easily be translate if needed) : </p> <blockquote> <p>Line 0: Procedure: sp_send_dbmail, Msg 206, Level 16, State 2: Conflit de types d'opérandes : table est incompatible avec nvarchar(max)</p> </blockquote>
34,902,538
0
<p>I won't recommend to use <code>$resource</code>. It's the object that keeps link to the promise and when promise resolved it'll also contain data itself. So if you want to do some actions when data comes you'll have to assing a callback to that promise anyway. Use <code>$http</code> instead. It's lower level angular abstraction for async requests. And <a href="http://stackoverflow.com/questions/11850025/recommended-way-of-getting-data-from-the-server">here</a> is the way you can use <code>$http</code>.</p>
27,900,886
0
<p>The file's content includes <code>$variables</code> wich are expanded. To avoid variable expansion, I had to use single-quote escapes <code>'END'</code>.</p>
2,269,323
0
Is Passing a Parameter to a method the same as creating an object? <p>I am learning Servlets and JSP. I am wondering about the "doGet" and other methods that may be overidden. The "doGet" takes 2 params - HTTPServletRequest request, and HTTPServletResponse response. This is my question: The request and response objects are used within the method body but I do not see any object creation e.g. request = new HTTPServletRequest. Are these objects created elsewhere e.g. in the superclass? This is just a Java question really as I often wonder about this with Applets also, i.e. the Graphics g object is passed to the "paint" method but I don't see it's creation anywhere?</p> <p>GF</p>
13,113,477
0
<p>Perhaps this is something you are looking for:</p> <pre><code>from numpy.random import randint n = 50 R = randint(0,2,n) def get_number_of_zeros(x): return sum(0 == ele for ele in x) while(len(R) &gt; 0): number_of_zeros = get_number_of_zeros(R) print 'number of zeros is {}'.format(number_of_zeros) R = randint(0, 2, number_of_zeros) </code></pre> <p>Result:</p> <pre><code>number of zeros is 25 number of zeros is 11 number of zeros is 7 number of zeros is 4 number of zeros is 1 number of zeros is 1 number of zeros is 1 number of zeros is 0 </code></pre>
814,697
0
<p>I assume you're talking about something like <a href="http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/" rel="nofollow noreferrer">Roger Alsing's program</a>.</p> <p>I implemented a version of this, so I'm also interested in alternative fitness functions, though I'm coming at it from the perspective of improving performance rather than aesthetics. I expect there will always be some element of "fade-in" due to the nature of the evolutionary process (though tweaking the evolutionary operators may affect how this looks).</p> <p>A pixel-by-pixel comparison can be expensive for anything but small images. For example, the 200x200 pixel image I use has 40,000 pixels. With three values per pixel (R, G and B), that's 120,000 values that have to be incorporated into the fitness calculation for a single image. In my implementation I scale the image down before doing the comparison so that there are fewer pixels. The trade-off is slightly reduced accuracy of the evolved image.</p> <p>In investigating alternative fitness functions I came across some suggestions to use the <a href="http://en.wikipedia.org/wiki/YUV" rel="nofollow noreferrer">YUV colour space</a> instead of RGB since this is more closely aligned with human perception.</p> <p>Another idea that I had was to compare only a randomly selected sample of pixels. I'm not sure how well this would work without trying it. Since the pixels compared would be different for each evaluation it would have the effect of maintaining diversity within the population.</p> <p>Beyond that, you are in the realms of computer vision. I expect that these techniques, which rely on feature extraction, would be more expensive per image, but they may be faster overall if they result in fewer generations being required to achieve an acceptable result. You might want to investigate the <a href="http://pdiff.sourceforge.net/" rel="nofollow noreferrer">PerceptualDiff</a> library. Also, <a href="http://www.lac.inpe.br/~rafael.santos/JIPCookbook/6050-howto-compareimages.jsp" rel="nofollow noreferrer">this page</a> shows some Java code that can be used to compare images for similarity based on features rather than pixels.</p>
8,534,840
0
<p>After some experimentation, I have found a way to specify a custom skipper and will outline it here:</p> <pre><code>template&lt;typename Iterator&gt; struct pl0_skipper : public qi::grammar&lt;Iterator&gt; { pl0_skipper() : pl0_skipper::base_type(skip, "PL/0") { skip = ascii::space | ('{' &gt;&gt; *(qi::char_ - '}') &gt;&gt; '}'); } qi::rule&lt;Iterator&gt; skip; }; template&lt;typename Iterator, typename Skipper = pl0_skipper&lt;Iterator&gt;&gt; struct pl0_grammar : public qi::grammar&lt;Iterator, Skipper&gt; { /* The rules use our skipper */ qi::rule&lt;Iterator, Skipper&gt; start; qi::rule&lt;Iterator, Skipper&gt; block; qi::rule&lt;Iterator, Skipper&gt; statement; }; </code></pre> <p>The secret lies in the call of the parser. For some reason, when you want to parse this using <code>parse_phrase</code>, you have to give a skipper grammar object. I was not aware of this:</p> <pre><code>typedef std::string::const_iterator iterator_t; typedef parser::pl0_grammar&lt;iterator_t&gt; grammar; typedef parser::pl0_skipper&lt;iterator_t&gt; skipper; grammar g; skipper ws; iterator_t iter = str.begin(); iterator_t end = str.end(); bool r = phrase_parse(iter, end, g, ws); </code></pre> <p>This works.</p>
1,975,980
0
<p>I would set a class variable — eg. <code>@@my_variable</code> — inside the configure block. The configure block exists for code you want to run at start up, so setting your variable their makes sense. Your Sinatra application is a subclass of <code>Sinatra::Base</code>, so using a class variable in this situation seems appropriate.</p>
27,271,020
0
Invalid regular expression: Invalid group <p>I'm trying to write a regex with a negative lookahead that detects files which end with <code>.apk</code> but not with <code>-unaligned.apk</code>. Here it is.</p> <pre><code>/(?s)^((?!\-unaligned).)*\.apk$/ </code></pre> <p>However, when I use it in Node (or in the Chrome developer tools, too), it throws:</p> <pre><code>SyntaxError: Invalid regular expression: /(?s)^((?!\-unaligned).)*\.apk$/: Invalid group </code></pre> <p>I've tested it in <a href="http://regex101.com" rel="nofollow">Regex101</a> with a test list of files, and it works perfectly, but after moving to "production" code, it throws an error like that.</p>
14,492,933
0
Non binary decision tree to binary decision tree (Machine learning) <p>This is homework question, so I just need help may be yes/No and few comment will be appreciated!</p> <ul> <li>Prove: Arbitrary tree (NON binary tree) can be converted to equivalent binary decision tree.</li> </ul> <p>My answer: Every decision can be generated just using binary decisions. Hence that decision tree too. I don't know formal proof. Its like I can argue with Entropy(Gain actually) for that node will be E(S) - E(L) - E(R). And before that may be it is E(S) - E(Y|X=t1) - E(Y|X=t2) - and so on.</p> <p>But don't know how to say?!</p>
5,448,829
0
<p>you can add the accepted tags to strip_tags as second parameter</p> <p>ex.</p> <pre><code>strip_tags($text, '&lt;br&gt;'); </code></pre>
3,273,629
0
<p>You are right. Parallelization makes it work faster.</p> <p>In fact, the x264 encoder provides parallel encoding ability.</p> <p><a href="http://www.videolan.org/developers/x264.html" rel="nofollow noreferrer">http://www.videolan.org/developers/x264.html</a></p>
8,678,371
0
How to convert GPS degree to decimal and vice-versa in jquery or javascript and PHP? <p>does someone know how to convert GPS degree to decimal values or vice versa?</p> <p>I have to develop a way where users can insert an address and get the GPS values (both degree and/or decimal), but the main thing i need to know is how to convert the values, cause users can also insert GPS values (degree or decimal). Because i need to get the map from google maps this needs decimal.</p> <p>I've tryed some codes but i get big numbers...like this one:</p> <pre><code>function ConvertDMSToDD(days, minutes, seconds, direction) { var dd = days + minutes/60 + seconds/(60*60); //alert(dd); if (direction == "S" || direction == "W") { dd = '-' + dd; } // Don't do anything for N or E return dd; } </code></pre> <p>Any one?</p> <p>Thank you.</p>
25,243,483
0
Bash - Wait with timeout <p>I have a problem with bash programming. I have this code:</p> <pre><code>#!/bin/bash tmpfile="temp.txt" ./child.sh &amp; sleep 4s </code></pre> <p>but I want to get the exit code of <code>child.sh</code>. I know that is possible with the costructor <code>wait</code>. There are any constructor with wait+timeout?</p> <p>Thanks</p>
5,565,156
0
<p>We have to maintain on an old system here (20 years and older).</p> <p>ESQL is used massively in here. The most of the problems we had while moving the software to a new OS (it was an 15 year old hpux) where with the ESQL code.</p> <p>The new software we are writing are all making use of the C++ library. This gives us more readable code + our IDE doesn't say 'invalid syntax' all the time. etc.. The C++ library is in general terms very equal as how I connect to a database in .NET or Java.</p> <p>Using the C++ library whe have an improvement of speed (if used wisely) and much less errors.</p> <p>ESQL is deprecated by my point of view. But since we have entered an time where a lot of the written software is to update/upgrade or maintain existing systems, it is very handy to have basic knowledge of old techniques!</p>
30,860,074
0
<p>What sstan is pointing out is that you are lacking the semicolon at the end of each statement.</p> <p>Try:</p> <pre><code>INSERT INTO report_header ( report_number, company_id, user_id, entry_date) VALUES ( 6797, 15967, 84, TRUNC(SYSDATE)); INSERT INTO report_detail (part_id, condition_id, uom_id, dvc_id, cqh_id, alt_part_id, entry_date, qty_quoted, qty_req, unit_cost, unit_price, customer_price, route_code) VALUES ((SELECT part_id from parts where pn = '2366'),15,1,3,(select max(report_id) from report_header), (SELECT part_id from parts where pn = '2366'),'11-JUN-2015',1,1,0,1895,1895,'O'); SELECT * from Dual; </code></pre> <p>Note the ";" delimiting each separate statement.</p>
14,554,552
0
How to Use Arrow Keys to Navigate a Vertical Page <p>I have a webpage with photos on it. I would like the viewer to be able to use the arrow keys (up, down, left, right) to advance. Typically the down key scrolls about 10 pixels. I'd like the down key and the right key to advance to the next photo, or say, 1000 pixels. I'd like the up and the left key to do the same, but in reverse, so scroll back up the page those same 1000 pixels. I thought to assign each set of photos an anchor (#) tag, and have the page scroll to the next tag. I hardly know HTML, CSS, Javascript, and Jquery, so I'd need a patient response to help me solve this.</p> <p>The page I'm working with is <a href="http://pavelrozman.com" rel="nofollow">my personal site</a> and I'd like to apply this same type of keyboard navigation on all the pages on my site.</p>
39,307,840
0
<p>If you want to restart the NGINX process, restart the container by running the command:</p> <pre><code>docker restart &lt;container name&gt; </code></pre> <p><a href="https://blog.docker.com/2015/04/tips-for-deploying-nginx-official-image-with-docker/" rel="nofollow">https://blog.docker.com/2015/04/tips-for-deploying-nginx-official-image-with-docker/</a></p>
13,826,975
0
<p>Since you can't refactor as suggested, you should check what type you need to return based on the <code>type</code> member that you assign in the <code>init()</code> function. I assume this will work, but you haven't shown where <code>type</code> is defined:</p> <pre><code>const void* Investment::getItem() const { switch(type) { case BUILDING_TYPE: case UNIT_TYPE: return &amp;unitType; case UPGRADE_TYPE: return &amp;upgradeType; case TECH_TYPE: return &amp;techType; } return NULL; } </code></pre> <p>Doing this however, means that the caller of <code>getItem()</code> has to be able to perform the appropriate downcast. Given that you don't provide this explicitly, this is going to be a constant source of confusion of users of your code.</p> <h1>However:</h1> <p>If you are passing around <code>void*</code> and expecting users of your class to downcast to the correct type, this is almost always an indication of bad design in <code>C++</code>. The correct approach would be to refactor this into a proper polymorphic class hierarchy as suggested by @juanchopanza in his answer.</p>
32,573,413
0
<p>Usually the best way to get data from a server to the front end is as a JSON string/object then we can easily manipulate that just like you're doing already.</p> <p>I think you're pretty much there you're just missing one part.</p> <p>In this below example i'm listing the same users in a table and menu and on click of the table row the selected user in the drop down is defaulted.</p> <p>For example with this sample table data.</p> <p>JS:</p> <pre><code>var users = [{ ID: 0, LNAME: "First", FNAME: "Senior" }, { ID: 1, LNAME: "Second", FNAME: "Sir" }, { ID: 2, LNAME: "Third", FNAME: "Chap" }, { ID: 3, LNAME: "Fourth", FNAME: "Mr" }]; mag.module('userName', { view: function(state) { state.tr = state.option = users.map(function(user) { return { _selected: user.ID == state.index ? true : null, _text: user.FNAME + ' ' + user.LNAME, _value: user.ID } }); state.$tr = { _onclick: function(e, i) { state.index = i; state.span = users[i].FNAME + users[i].LNAME } } } }); </code></pre> <p>HTML:</p> <pre><code>&lt;div id="userName"&gt; &lt;table&gt; &lt;tr&gt;&lt;/tr&gt; &lt;/table&gt; &lt;hr/&gt; &lt;label for="fullName"&gt;Select User: &lt;span&gt;&lt;/span&gt;&lt;/label&gt; &lt;select class="form-control" name="userName"&gt; &lt;option&gt;&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p>Here is the full working example: <a href="http://jsbin.com/bokiqebezo/1/edit?html,js,output" rel="nofollow">http://jsbin.com/bokiqebezo/1/edit?html,js,output</a></p> <p>Hope this helps!</p>
19,724,039
0
Match Schedule Generator Algorithm <p>I'm working on a schedule generator where every team plays a match with each other teams. My Database table and the output I need like below, <img src="https://i.stack.imgur.com/pf2tZ.png" alt="enter image description here"></p> <p>What I have tried so far is</p> <pre><code> &lt;% ResultSet rsteams = clmmodel_database.selectQuery("select count(ct.teamid) as teamcount, teamid,teamname from clm_team ct"); while(rsteams.next()){ int teamcount = rsteams.getInt("teamcount"); int n = teamcount - 1; int numofmatches = n*(n+1)/2; %&gt; &lt;h1&gt;Team Count = &lt;%out.print(teamcount);%&gt;&lt;/h1&gt; &lt;h1&gt;Number of Matches = &lt;%out.print(numofmatches);%&gt;&lt;/h1&gt; &lt;table&gt; &lt;%for(int i =0;i&lt;n;i++){%&gt; &lt;tr&gt; //Here I need to display the matches row by row &lt;/tr&gt; &lt;%}%&gt; &lt;/table&gt; &lt;%}%&gt; </code></pre> <p>Which retrieves the team count and the number of matches to be played. Please help me on this.</p>
32,366,138
0
implicit parameters and generic types <p>i'm trying to understand the behavior of the compiler in this situation</p> <pre><code>object ImplicitTest extends App { def foo[T](implicit x: (String =&gt; T)): T = ??? implicit val bar = (x: String) =&gt; x.toInt foo } </code></pre> <p>the code above does not compile and gives the following error:</p> <blockquote> <p>ambiguous implicit values: both method $conforms in object Predef of type [A]⇒ &lt;:&lt;[A,A] and value bar in object ImplicitTest of type ⇒ String ⇒ Int match expected type String ⇒ T</p> </blockquote> <p>as the error says my implicit value is conflicting with another implicit defined in Predef... based on this it seems there is no way to declare an implicit parameter to a function converting a value from a known type to an unknown (generic) type. </p> <p>Is this due to some technical limitation on the compiler or is just the way it is supposed to work, and i'm violating some constraints i'm not aware of?</p>
3,663,772
0
<p>I used WMI to do this, found an example on the web, and this is what it looked like.</p> <pre><code> private ManagementScope _session = null; public ManagementPath CreateCNameRecord(string DnsServerName, string ContainerName, string OwnerName, string PrimaryName) { _session = new ManagementScope("\\\\" + DnsServerName+ "\\root\\MicrosoftDNS", con); _session.Connect(); ManagementClass zoneObj = new ManagementClass(_session, new ManagementPath("MicrosoftDNS_CNAMEType"), null); ManagementBaseObject inParams = zoneObj.GetMethodParameters("CreateInstanceFromPropertyData"); inParams["DnsServerName"] = ((System.String)(DnsServerName)); inParams["ContainerName"] = ((System.String)(ContainerName)); inParams["OwnerName"] = ((System.String)(OwnerName)); inParams["PrimaryName"] = ((System.String)(PrimaryName)); ManagementBaseObject outParams = zoneObj.InvokeMethod("CreateInstanceFromPropertyData", inParams, null); if ((outParams.Properties["RR"] != null)) { return new ManagementPath(outParams["RR"].ToString()); } return null; } </code></pre>
15,588,929
0
CSS: :hover and Sibling Selector <p>I have a case where my design requires me to declare this class:</p> <pre class="lang-css prettyprint-override"><code>.panel { position: fixed; top: 100vh; height: 90vh; margin: 0px; padding: 0px; width: 100%; transition-property: top; transition-duration: 1s; } .panel:before { background-color: inherit; top: -1.5em; width: 10em; text-align: center; font-weight: bold; content: attr(id); position: absolute; border-bottom: none; border: .5em solid black; border-top-color: inherit; border-left-color: inherit; border-right-color: inherit; border-bottom: none; border-radius: 25%; border-bottom-right-radius: 0%; border-bottom-left-radius: 0%; } </code></pre> <p>In short, panels are tabs that fly in when targeted via an <code>&lt;a href="panel id"&gt;foo&lt;/a&gt;</code> style link.</p> <p>In their default state panels sit just under the bottom of the screen, This creates a row of hidden panel objects whose before's appear as tabs across the bottom of the screen.</p> <p>HTML for these panels is <code>&lt;section id="about" class="panel color"&gt;...&lt;/section&gt;</code> (where the color classes are effectively presentational for the moment, but will be upgraded to reflect specific tab purposes.</p> <p>So, the challenge I'm trying to solve is that status bars will block the panel tabs which feels wrong, and I believe the solution is to bump them up a little bit (3 or 4 VH) when any link is hovered. This preserves status bar integrity, link integrity and the look of the site; treating the status bar as if it were a window resize.</p> <p>I had believed that <code>a:hover ~ * .panel { top: 97vh; }</code> was the correct solution to do this, but it doesn't seem to be firing.</p>
33,614,301
0
<p>Try </p> <pre><code>Sub HelloWord() Dim wordApp As Object Set wordApp = GetObject(, "Word.Application") MsgBox wordApp.Activedocument.FullName End Sub </code></pre> <p>Once you've got a handle on the the wordApp, you can access all the objects in the model as normal.</p> <p>The downvote might be because this doesn't sound like a very efficient solution - might it be better to get the Excel data into a Word document or format the Excel document in an acceptable way. You're invoking two pretty chunky apps here to do one thing.</p>
2,474,667
0
<p>You would probably want to use a PHP syntax file such as: <a href="http://www.vim.org/scripts/script.php?script_id=1571" rel="nofollow noreferrer">http://www.vim.org/scripts/script.php?script_id=1571</a></p> <p>FWIW: Personally I am enjoying learning vim at the moment but still prefer netbeans for PHP development because it has many features that I need, such as automatic scp to a remote server and remote debugging with XDebug.</p>
26,066,966
0
<p><strong>try this</strong> </p> <pre><code>try { $pdo = new PDO('mysql:host=localhost;dbname=yourdbname', 'dbuser' , 'password'); $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXECPTION); $pdo-&gt;exec('SET NAME "utf8"'); } catch (PDOException $e) { $error= 'error text'; include 'errorpage.php'; exit(); } $success = 'success'; include 'page.php'; </code></pre>
37,315,341
0
<p>To use a closure in this situation try something like </p> <pre><code>func getCityDetail (completion:()-&gt;()){ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) { //background thread, do ws related stuff, the ws should block until finished here dispatch_async(dispatch_get_main_queue()) { completion() //main thread, handle completion } } } </code></pre> <p>then you can use it like </p> <pre><code>objWebService.getCityDetail { //do something when the ws is complete } </code></pre>
26,361,807
0
<p>Googling for "css customized radio buttons" yielded a lots of useful results, such as <a href="http://www.hongkiat.com/blog/css3-checkbox-radio/" rel="nofollow">this</a>, here is a <a href="http://jsfiddle.net/dghjLra2/" rel="nofollow">jsfiddle</a> based on that tutorial, code provided below. Obviously, this is kind of workaround solution rather than native way of styling the radio buttons which to my knowledge doesn't exist.</p> <p>HTML:</p> <pre><code>&lt;div class="radio"&gt; &lt;input id="male" type="radio" name="gender" value="male"/&gt; &lt;label for="male"&gt;Male&lt;/label&gt; &lt;input id="female" type="radio" name="gender" value="female"/&gt; &lt;label for="female"&gt;Female&lt;/label&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>label { display: inline-block; cursor: pointer; position: relative; padding-left: 25px; margin-right: 15px; font-size: 13px; } input[type=radio] { display: none; } label::before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; position: absolute; left: 0; bottombottom: 1px; background-color: #aaa; box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8); } .radio label::before { border-radius: 8px; } input[type=radio]:checked + label::before { content: "\2022"; color: #f3f3f3; font-size: 30px; text-align: center; line-height: 18px; } </code></pre>
28,999,831
0
<p>First of all, Thomas Jungblut's answer is great and I gave me upvote. The only thing I want to add is that the Combiner will always be run <strong>at least</strong> once per Mapper if defined, unless the mapper output is empty or is a single pair. So having the combiner not being executed in the mapper is possible but highly unlikely. </p>
21,392,529
0
Cascading multi-value parameter issue in SSRS 2008 <p>Basically I have built a report using SSRS 2008, the report has cascading parameters, the independent one is a multi-value parameter (work units) populated with values from a database query, the dependent parameter (job positions contained in respective work units) also gets values from a query with a where clause as follows:</p> <pre><code>WHERE position.unitId IN (@units) </code></pre> <p>@units being the multi-value parameter. The default value for units is the query itself - all of which the user has access to. So upon opening the report, all available units are selected and all respective job positions are retrieved - works fine. But a aser can also have no access to any units, which makes the dependent query fail, cause no units were retrieved hence @units contains no values. I would have thought the query would not fire until @units has a value present.. anyways I have tried to check the contents of @units before querying for job positions in various ways:</p> <p>*replacing @units parameter with the following expression: =IIF(Parameters!units.Count = 0, "00000000-0000-0000-0000-000000000000", Parameters!units.Value)</p> <p>*having another parameter containing a comma seperated string of the @units values and checking if the lenght of that is greater than 0 before executing the dependent dataset, etc.</p> <p>But now, when I open up the report, the drop down list of job position is empty, disabled and remains so until the values of units are changed or the report is run. After that they refresh alright it seems. So my question is, what may be the cause of the control being disabled (units are retrieved, so why does an expression as a parameter value for job positions messes it up?) and how to deal with this the right way, can`t seem to find something really of the same nature online. </p> <p>Any help will be greatly appreciated.</p>
29,749,150
0
How can i see my document settings.xml (maven) <p>I'm trying to see my informations (username &amp; url) in settings.xml but there is no document in my folder .m2, I try to display it with ls -la but nothing to do. How can we get those informations?</p>
2,151,770
0
<p>Maybe you can install PHPMailer as a Vendor and create a Component called "Mail"...</p> <p>And don't forget to authenticate with your <strong>SMTP server</strong>! :)</p>
16,254,122
0
<p>You could create another list in the correct order, by something like:</p> <pre><code>// Given that 'Person' for the sake of this example is: public class Person { public string FirstName; public string LastName; } // And you have a dictionary sorted by Person.FirstName: var dict = new SortedDictionary&lt;string, Person&gt;(); // ...initialise dict... // Make list reference a List&lt;Person&gt; ordered by the person's LastName var list = (from entry in dict orderby entry.Value.LastName select entry.Value).ToList(); // Use list to populate the listbox </code></pre> <p>This has the advantage of leaving the original collection unmodified (if that's important to you).</p> <p>The overhead of keeping references to the objects in two different collections is not very high, because it's only one reference per object (plus some fixed overhead for the <code>List&lt;&gt;</code> implementation itself).</p> <p>But remember that the objects will be kept alive as long as either of the collections are alive (unless you explicitly clear the collections).</p> <hr> <p>Compilable sample:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; namespace Demo { public static class Program { private static void Main() { dict = new SortedDictionary&lt;string, Person&gt;(); addPerson("iain", "banks"); addPerson("peter", "hamilton"); addPerson("douglas", "adams"); addPerson("arthur", "clark"); addPerson("isaac", "asimov"); Console.WriteLine("--------------"); foreach (var person in dict) Console.WriteLine(person.Value); var list = (from entry in dict orderby entry.Value.LastName select entry.Value).ToList(); Console.WriteLine("--------------"); foreach (var person in list) Console.WriteLine(person); } private static void addPerson(string firstname, string lastname) { dict.Add(firstname, new Person{FirstName = firstname, LastName = lastname}); } private static SortedDictionary&lt;string, Person&gt; dict; } public class Person { public string FirstName; public string LastName; public override string ToString(){return FirstName + " " + LastName;} } } </code></pre>
38,206,662
0
How to cancel printing in ReportViewer1.Print Event? <p>I created ReportViewer1. It will show preview and I need to cancel print out to a printer when the user clicks a Print Button on the toolbar. </p> <p>Like this </p> <pre><code>Private Sub ReportViewer1_Print(sender As Object, e As ReportPrintEventArgs) _ Handles ReportViewer1.Print Me.ReportViewer1.CancelRendering(0) ''/ &lt;----Cancel Printing RaiseEvent Click_Print(False) End Sub </code></pre> <p>But CancelRendering is not working because it shows dialogSetting for the selected printer.</p>