pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
23,254,996 | 0 | apply the edge detection in an image segmentation <p>I have two questions about snake edge detection. The first question is, in openCV there is a function cvSnakeImage(src,points,.......), what does the points parameter mean?</p> <p>The second questions is: I want to apply this function on the part surrounded by an edge that I have already made, how can I do this?</p> <p>This is my code for edge detection:</p> <pre><code>cvCanny(img_bw, img_canny , thresh, thresh * 50, 3); cvFindContours(img_canny, contour, &contours, sizeof(CvContour), CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE); </code></pre> |
34,886,605 | 1 | TensorFlow network not training? <p>I had a really weird time with TensorFlow the last days and can not think of what's going wrong atm.</p> <p>I have built this network: <a href="http://pastebin.com/GZaX4aYN" rel="nofollow">link</a>. It is a copy of TensorFlow's MNIST example.</p> <p>Basically, what I did, is altering the network from taking 28x28x1 images (MNIST greyscale) to 600x800x1 images (some images I took on my own, webcam with a relatively clean background and one object at different locations).</p> <p>What I wanted to do is playing around with such a CNN and have it output the x-location of the object in the image. So one single output neuron.</p> <p>However, no matter what I tried, the network is always outputting 1.0. Even (when you look at my testing section at the end of the code) when I feed all ones, all zeros or all random numbers into the network.</p> <p>Of course, since I have only 21 labeled training and 7 labeled test pictures I expected the performance to be really bad (since 800x600 pixel images are huge for neural networks and locating an object isn't easy).</p> <p>...but I have no idea at all why the network always outputs 1.0 even if it is fed with nonsense. Any ideas?</p> |
33,855,005 | 0 | Get frame by frame data from mp4 using C# and .NET 2.0 <p>I'm currently developing using Unity 3D, however my background is Apple development. In iOS/OSX development I can use <code>AVFoundation</code> to load an mp4 and get frame by frame data from it as it plays in BGRA format.</p> <p>I was wondering what the equivalent of this is for .NET (Unity uses .NET 2.0)?</p> <p>I know it's possible to call functions in an Objective-C++ file from unity but I need a way to do this on any platform not just iOS.</p> |
6,708,019 | 0 | Convert String to Variable Name <p>I need get combobox by string. Not worked.</p> <pre><code> for (int i = 0; i < Slots.Count; i++) { var field = (ComboBox)this.GetType().GetField("cbSlots" + i).GetValue(this); field.DataSource = Slots[i.ToString()]; } </code></pre> |
20,951,392 | 0 | <p>Assign to learningTime the System.currentTimeMillis() value so it's 0 > 3000</p> <pre><code>learningTime = System.currentTimeMillis() </code></pre> <p>And, anyway you will block the main thread with this code. </p> <p>That can be an example of Handler</p> <pre><code>final Handler handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { handler.postDelayed(this, 3000); } }; handler.postDelayed(runnable, 3000); </code></pre> <p><a href="http://developer.android.com/reference/android/os/Handler.html" rel="nofollow"><code>Handler class</code></a> <a href="http://developer.android.com/reference/java/lang/Runnable.html" rel="nofollow"><code>Runnable</code></a> <a href="http://developer.android.com/reference/android/os/Handler.html#postDelayed%28java.lang.Runnable,%20long%29" rel="nofollow"><code>Handler postDelayed</code></a></p> <p>Anyway, you don't need anymore <code>learningTime</code> and <code>i</code> (?)</p> |
2,984,846 | 0 | Set "Image File Execution Options" will always open the named exe file as default <p>As <a href="http://untidy.net/blog/2009/11/03/replacing-notepad-with-pn-via-image-file-execution-options/" rel="nofollow noreferrer">this link suggests</a>, I want replace <code>Notepad.exe</code> with <code>Notepad2.exe</code> using "<strong>Image File Execution Options</strong>" function by run the command</p> <pre><code>reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"c:\windows\Notepad2.exe\" /z" /f </code></pre> <p>But when I run <strong>notepad</strong> it still opens the file </p> <blockquote> <p>c:\windows\notepad.exe</p> </blockquote> <p>in notepad2.exe as a text file by default. </p> <p>Is there a way to avoid that?</p> <p>I know using this tech Notepad.exe will as the first param passed to Notepad2.exe. but I don't know how to avoid this :(</p> |
10,994,687 | 0 | How can I design input without knowing in advance how many values will be entered? <p>I want to input based on how many values a user inputs, without expecting an exact number of values. </p> <p>In my program I want user to input integer(s) but the problem is that I want to allow the user to either input one or two space separated integers.</p> <p>So,if user enters two space separated integers,they should get stored in variables a and b,and if he enters just one number before pressing enter then it should get stored in a,and the program should proceed further without waiting for the second number.</p> <p>What is the best way to do that?</p> |
9,920,174 | 0 | <p>Try to use a subquery with a LIMIT clause, e.g. -</p> <pre><code>SELECT i_s.pid, p_r.range_id as PriceRangeID, COUNT(p_r.range_id) as PriceGroupTotal FROM (SELECT * FROM indx_search WHERE i_s.word = 'memory' ORDER BY i_s.pid ASC LIMIT 0 , 20) i_s LEFT JOIN windex_mem w_m ON w_m.word = i_s.word LEFT JOIN price_range p_r ON p_r.pid = i_s.pid GROUP BY i_s.pid, PriceRangeID </code></pre> |
25,465,706 | 0 | <p>Here is code that handles it:</p> <pre><code> page = Mechanize.new.get "http://page_u_need" page.iframe_with(id: 'beatles').content </code></pre> |
39,516,498 | 0 | <p>I agree, there are better ways to create a header for CCDA documents, however, if you'd like to stick with your solution here is the missing part:</p> <pre><code>var clinicalDocument = new XML ("<clinicalDocument></clinicalDocument>"); clinicalDocument['realmCode']['@code']="US"; clinicalDocument['typeId']['@extension']="POCD_HD000040"; clinicalDocument['typeId']['@root']="2.16.840.1.113883.1.3"; createSegment('templateId', clinicalDocument); createSegment('templateId', clinicalDocument, 1); createSegment('templateId', clinicalDocument, 2); clinicalDocument['templateId'][0]['@root']="2.16.840.1.113883.10.20.22.1.1"; clinicalDocument['templateId'][1]['@root']="2.16.840.1.113883.10.20.24.1.1"; clinicalDocument['templateId'][2]['@root']="2.16.840.1.113883.10.20.24.1.2"; clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@codeSystemName']="Healthcare Provider Taxonomy"; clinicalDocument['documentationOf']['serviceEvent']['performer']['assignedEntity']['code']['@displayName']="Adult Medicine"; logger.info("Data : "+clinicalDocument); </code></pre> |
36,803,162 | 0 | <p>Youd need to pad your data with at least order n zeros; then you could set stride[n]==-stride[m] to achieve the intended effect, and avoid allocating order n*m zeros.</p> <p>But something tells me there must be a more elegant solution to your problem, if you take a bigger-picture view.</p> |
7,538,168 | 0 | <p>the function <code>Ei</code> does either not exist or is not in your matlab path.</p> <p><strong>Edit:</strong> this function seems to be new in matlab 2011b, so if you are using an older version of matlab, the function won't be there -> error.</p> <p><strong>Edit2:</strong> do you have the <strong>Symbolic Math Toolbox</strong> installed?</p> |
30,483,486 | 0 | <p>Try it like this:</p> <pre><code>window.open('','_self','');window.close(); </code></pre> |
30,679,215 | 0 | <p>Try using foreach loop.</p> <pre><code>$game = $_POST['game_rate']; // with the proviso $ _ POST ['game_rate'] is an array $game_opt = $_POST['game_opt']; $index = 0; foreach($game as $g){ $query = "INSERT INTO t_game(game_rate, game_opt) VALUES('$g', '".$game_opt[$index]."')"; // Execute the query variabel $index++; } </code></pre> |
1,023,344 | 0 | <p>Maybe the <code>models</code> module has an <code>__all__</code> which does not include what you're looking for. Anyway, <code>from ... import *</code> is <strong>never</strong> a good idea in production code -- we always meant the <code>import *</code> feature for interactive exploratory use, <em>not</em> production use. Specifically import the module you need -- use that name to qualify names that belong there -- and you'll be vastly happier in the long run!-)</p> |
4,121,764 | 0 | <p>I don't know what happened, but I disabled the USB WiFi dongle and switched to a cabled network, and it started working. don't know what the reasons were, but I am happy now that it worked.</p> <p>May be this is useful to others too!</p> |
34,800,652 | 0 | <p>The issue is that your app does not have a module named <code>uwsgi</code>. You change the directory to <code>/home/user/appname</code> but it looks like the actual module would be <code>appname.uwsgi</code> since the <code>uwsgi.py</code> file lives within <code>/home/user/appname/appname/uwsgi.py</code>.</p> <p>Typically though, you don't need to specify both <code>--wsgi-file</code> and <code>--module</code> so I would either do</p> <pre><code>uwsgi --http :9010 --chdir /home/user/appname --wsgi-file /home/user/appname/appname/wsgi.py </code></pre> <p>or</p> <pre><code>uwsgi --http :9010 --chdir /home/user/appname --module appname.uwsgi </code></pre> <p>I personally prefer the second.</p> |
40,472,828 | 0 | <pre><code>public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); final RelativeLayout relativeLayout = new RelativeLayout(this); final TextView tv1 = new TextView(this); tv1.setText("tv1 is here"); // Setting an ID is mandatory. tv1.setId(View.generateViewId()); relativeLayout.addView(tv1); final TextView tv2 = new TextView(this); tv2.setText("tv2 is here"); // We are defining layout params for tv2 which will be added to its parent relativelayout. // The type of the LayoutParams depends on the parent type. RelativeLayout.LayoutParams tv2LayoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); //Also, we want tv2 to appear below tv1, so we are adding rule to tv2LayoutParams. tv2LayoutParams.addRule(RelativeLayout.BELOW, tv1.getId()); //Now, adding the child view tv2 to relativelayout, and setting tv2LayoutParams to be set on view tv2. relativeLayout.addView(tv2); tv2.setLayoutParams(tv2LayoutParams); //Or we can combined the above two steps in one line of code //relativeLayout.addView(tv2, tv2LayoutParams); this.setContentView(relativeLayout); } } </code></pre> |
10,919,275 | 0 | <p>Seems like there is a bug in for this:</p> <p><a href="http://mvcdonutcaching.codeplex.com/workitem/2533" rel="nofollow">http://mvcdonutcaching.codeplex.com/workitem/2533</a></p> |
19,943,620 | 0 | Strange parallel loop behaviour int v long int <p>I have some code i'm running in parallel using an OMP for loop, up to large numbers. The code (with unimportant bits removed) is as follows (apologies if it's a mess/hard to follow):</p> <pre><code>long int primePos=-1; unsigned long long int odd; int primeFactor; while(fileNumber<=nFiles) { percPrev=0; compCounter=0; #pragma omp parallel for shared(numberElements, iStart, iEnd,tau, wall0) schedule (guided) private(primePos,odd,primeFactor) for(unsigned long long int i=iStart;i<=iEnd;i++){ #pragma omp atomic tau++; odd=2*i-1; if(!IsPrime(odd)){ primeFactor = getPrimeFactor(odd); for(long int j=0;j<PrimeDatL;j++){ if(PrimeDataT[j]==primeFactor){ primePos=j; break; } } #pragma omp critical { if(compCounter+1>numberElements){ cout<<"Array overflow, exiting."<<endl; exit(0); } InsertElement(odd,primeFactor,pHVector,primePos); compCounter++; } } } iStart=iEnd+1; iEnd=min(iEnd+numberElements,maxVal); fileNumber++; } </code></pre> <p>The idea is that I go through all the odds up to <code>2^n</code>, if they're not prime I take the smallest prime factor and put it, along with the odd, in a vector which is arranged in a particular fashion. The variable <code>primePos</code> simply denotes which spot in this vector it goes into, and isn't a particularly large number so it was originally simply an <code>int</code> type. </p> <p>However, for larger values of n ~33, I found that InsertElement() was throwing an exception because <code>primePos</code> was huge, much larger than it could possibly be as defined in the for loop which searches for the position of <code>primeFactor</code> in <code>PrimeDataT</code>. This was rectified (well, it compiles and runs and for low values of n i can verify in mathematica that it's correct) by changing <code>primePos</code> from <code>int</code> to <code>long int</code>, but i've no idea why that should be the case and I'd like to know before I continue, in case I'm missing something important.</p> <p>tl;dr = how can primePos take a value larger than PrimeDatL if it is declared as an <code>int</code> instead of <code>long int</code>? Thanks in advance!</p> |
20,890,855 | 0 | Adding a ContactsContract.CommonDataKinds.Event to Android contacts, does not show up <p>I'm trying to add a birthday event to contacts but the event <strong>doesn't show up</strong> when displaying the contact in the People app. When going into 'Edit' mode of the contact, an event DOES show up, but no selected date (see attached screenshot) as if the format is wrong.</p> <p>When inspecting the contacts2.db in an sqlite viewer, it seems that the date are formatted just fine, like other events/birthdays that are properly showing (see attached image. First row is a manually entered birthday through the app, and the second row, was added by my app and doesn't show)</p> <p>Here is the code I am using, which follows the SampleSyncAdapter from the $ANDROID_HOME sdk</p> <pre><code>public ContactOperations addBirthday(Date date) { mValues.clear(); if(date!=null) { mValues.put(ContactsContract.CommonDataKinds.Event.TYPE, ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY); mValues.put(ContactsContract.CommonDataKinds.Event.START_DATE, BIRTHDATE_FORMATTER.format(date)); mValues.put(ContactsContract.CommonDataKinds.Event.MIMETYPE, ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE); addInsertOp(); } return this; } private void addInsertOp() { if (!mIsNewContact) { mValues.put(ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID, mRawContactId); } ContentProviderOperation.Builder builder = newInsertCpo(ContactsContract.Data.CONTENT_URI, mIsSyncOperation, mIsYieldAllowed); builder.withValues(mValues); if (mIsNewContact) { builder.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, mBackReference); } mIsYieldAllowed = false; mBatchOperation.add(builder.build()); } </code></pre> <p><img src="https://i.stack.imgur.com/8YqnP.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/x7jIe.png" alt="enter image description here"></p> |
11,004,202 | 0 | Pan class in Flash AS3 <p>I have a movieclip and I am going to add a pan feature to it. I want to add the pan as it's own class that the movieclip can reference.</p> <p>When I create the pan class, I send the movieclip to it so I have it's position properties at all times.</p> <p>What is the best way to access the stage in the pan class? I will need to be able to get the stage mouseX, mouseY, stageWidth, and stageHeight.</p> <p>Right now, I have the pan class extend a sprite object and actually add it as a child of the movieclip I want to pan.</p> <p>Would it be better to just send the stage itself into the pan class as well or is there a better way than this?</p> |
26,264,729 | 0 | <p>how about that:</p> <pre><code>value = value > 0 ? value: ~value + 1 </code></pre> <p>its based on the fact that negative numbers are stored as 2's complement to there positive equivalent, and that one can build the 2's complement by first building the 1's complement and adding 1, so </p> <pre><code> 5 -> 0000 0101b -5 -> (1111 1010b) + 1 -> 1111 1011b </code></pre> <p>what I did was basically to reverse this, so</p> <pre><code>-5 -> 1111 1011b 5 -> (0000 0100b) + 1 -> 0000 0101b </code></pre> <p>I know it's a bit late but just had the same issue and landed here, hope this helps.</p> |
22,388,214 | 0 | <p>Yes, this is really supported, but it has been broken since February 3rd. It has now been fixed!</p> |
38,891,401 | 0 | nested fetch api react native giving unpredictable response for custom operation <p>hi i am trying to fill array with custom data using multiple apis in react native but unable to do so as nested fetch api giving unpredicatable result my final array is always empty .</p> <p>Any help would be appreciated </p> <p>Thanks in advance below is my code please tell what i am doing wrong here..</p> <pre><code>fetchSubcategories(category_id){ var url=GLOBAL.BASE_URL+'/categories?filter[where][categoryId]='+GLOBAL.CATEGORY_ID+'&filter[where][category_type]=subcategory&filter[order]=name ASC'; const set = []; const subcategoriesArray=[]; fetch(url) .then((response) => response.json()) .then((responseData) => { for (var i = 0; i < responseData.length; i++) { set.push(responseData[i]); } console.log('response subcategories : '+JSON.stringify(set,null,2)); }) .then(()=>{ for(var j=0;j<set.length;j++){ var name=set[j].name; var id=set[j].id; fetch(url) .then((response) => response.json()) .then((responseData) => { var subcategory={ name:name, id:id, products:[] } subcategoriesArray.push(subcategory); }).done() } }) .done() console.log('final custom josn array : '+JSON.stringify(subcategoriesArray,null,2)); } </code></pre> <p>Note : urls used above giving the proper result on my end the only thing is final subcategoriesArray should be filled.</p> |
24,344,310 | 0 | <p>An installable onOpen will probably be the best solution since your <code>onOpen</code> function needs authorization to run (access spreadsheet Service).</p> <p>Just change the function name to avoid double firing.</p> <p>sample code from your example :</p> <pre><code>var ss = SpreadsheetApp.getActiveSpreadsheet(); var activeSheet = ss.getActiveSheet(); function installableOnOpen() { insertEmptyRow(); var menuEntries = [ {name: "My Menu", functionName: "myFunction"} ]; ss.addMenu("First menu", menuEntries); } function insertEmptyRow(){ if(activeSheet.getRange(3, 5).getValue() !== '') { activeSheet.insertRows(3); Logger.log("activeSheet.getRange(3, 1).getValues() = " + activeSheet.getRange(3, 1).getValue() ); } } </code></pre> <p><a href="https://docs.google.com/spreadsheets/d/164qJ8xjwuSrh6Qn7WFGVvdKQgrQA2XwCDugq0pwjv7U/edit?usp=sharing" rel="nofollow">test spreadsheet with view rights, make a copy to use and/or modify.</a></p> |
3,507,866 | 0 | <p>You can overcome the issue of mysql's case-sensitive <code>REPLACE()</code> function by using <code>LOWER()</code>. </p> <p>Its sloppy, but on my end this query runs pretty fast. </p> <p>To speed things along I retrieve the resultset in a select which I have declared as a derived table in my 'outer' query. Since mysql already has the results at this point, the replace method works pretty quickly.</p> <p>I created a query similar to the one below to search for multiple terms in multiple tables and multiple columns. I obtain a 'relevance' number equivalent to the sum of the count of all occurrances of all found search terms in all columns searched</p> <pre><code>SELECT DISTINCT ( ((length(x.ent_title) - length(replace(LOWER(x.ent_title),LOWER('there'),''))) / length('there')) + ((length(x.ent_content) - length(replace(LOWER(x.ent_content),LOWER('there'),''))) / length('there')) + ((length(x.ent_title) - length(replace(LOWER(x.ent_title),LOWER('another'),''))) / length('another')) + ((length(x.ent_content) - length(replace(LOWER(x.ent_content),LOWER('another'),''))) / length('another')) ) as relevance, x.ent_type, x.ent_id, x.this_id as anchor, page.page_name FROM ( (SELECT 'Foo' as ent_type, sp.sp_id as ent_id, sp.page_id as this_id, sp.title as ent_title, sp.content as ent_content, sp.page_id as page_id FROM sp WHERE (sp.title LIKE '%there%' OR sp.content LIKE '%there%' OR sp.title LIKE '%another%' OR sp.content LIKE '%another%' ) AND (sp_content.title NOT LIKE '%goes%' AND sp_content.content NOT LIKE '%goes%') ) UNION ( [search a different table here.....] ) ) as x JOIN page ON page.page_id = x.page_id WHERE page.rstatus = 'ACTIVE' ORDER BY relevance DESC, ent_title; </code></pre> <p>Hope this helps someone</p> <p>-- Seacrest out</p> |
19,399,920 | 0 | <p>I assume what you want to do is that when the button is clicked, it should open the same URL that was present in href. If this is the scenario, you can just add an onclick event handler to the button i.e onclick="navigate('<em>Your URL here</em>');". </p> <p>You can also set the onclick event to call a javascript function which in turn can open a modal/normal popup window for you</p> |
33,692,598 | 0 | Removing 'Allow' response header <p>I have a web-app developed using Spring-MVC, Spring-Security and hosted on Tomcat 7. As a security measure, I have also whitelisted only certain HTTP methods in web.xml as follows:</p> <pre><code><security-constraint> <web-resource-collection> <web-resource-name>restricted methods</web-resource-name> <url-pattern>/*</url-pattern> <http-method-omission>GET</http-method-omission> <http-method-omission>POST</http-method-omission> <http-method-omission>DELETE</http-method-omission> </web-resource-collection> <auth-constraint /> </security-constraint> </code></pre> <p>At this point, what I would expect is that if I made an excluded http method call to any endpoint, then I would get a 403 response - and this setup works. But the 403 response also includes a "Allow" header as follows:</p> <pre><code>Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH </code></pre> <ol> <li>Is blacklisting OPTIONS not a supported/recommended thing?</li> <li>Why is the list of allowed http methods different from what I have configured?</li> <li>I'm assuming Tomcat is the one adding the Allow header to the response - is that right?</li> <li>And how can I configure tomcat (or spring if that is adding the header) to not add this header to the response?</li> </ol> |
16,485,114 | 0 | <p>You can first delete, then write. </p> <p><code>hadoop fs -rmr <path></code> removes everything under given path in hdfs including the path itself</p> <p><code>rm -rf <path></code> removes in local file system. </p> <p>Make sure that there is no other file in the directory.</p> |
14,485,233 | 0 | Using JavaScript which I wrote in html in an asp.net page <p>I am currently engaged in doing a registration page. I first did it up in html and it let me move between my login, registration and forgot password forms, which were all located on the same page in html, but the form just changed shape and features through the JavaScript to become a login form password form and registration form depending on which link is clicked.</p> <p>It worked fine in html, but in asp.net, it doesn't work at all.</p> <p>Am new to asp.net, as have always worked in html.</p> <p>Does anyone know how to get the javaScript code working in asp.net.</p> <p>The Javascript code is at the end of this asp.net page</p> <pre><code> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="registration.aspx.cs" Inherits="DocStore_asp.registration" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>DocStore Registration & Login Page</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="description" content="Expand, contract, animate forms with jQuery wihtout leaving the page" /> <meta name="keywords" content="expand, form, css3, jquery, animate, width, height, adapt, unobtrusive javascript"/> <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/> <link rel="stylesheet" type="text/css" href="registrationcss/registrationstyle.css" /> <script src="js/cufon-yui.js" type="text/javascript"></script> <script src="js/ChunkFive_400.font.js" type="text/javascript"></script> <script type="text/javascript"> Cufon.replace('h1', { textShadow: '1px 1px #fff' }); Cufon.replace('h2', { textShadow: '1px 1px #fff' }); Cufon.replace('h3', { textShadow: '1px 1px #000' }); Cufon.replace('.back'); </script> </head> <body> <form id="form1" runat="server"> <div class="wrapper"> <h1>DocStore Registration & Login </h1> <h2></h2> <div class="content"> <div id="form_wrapper" class="form_wrapper"> <form class="register active" action="registered_users.aspx" method="post" id="regusers" > <h3>Register</h3> <p></p> <h2>Please fill out the form below to register for a DocStore Account. Access your account today!</h2> <p><strong> - Note: Fields with an asterik (*) are required.</strong></p> <p><strong> - Note: Password must contain at least 8 characters.</strong></p> </form> <div class="column"> <div> <label>*Company Name:</label> <input type="text" name="company_name"/> <span class="error">This is an error</span> </div> <div> <label>*Company Address:</label> <input type="text" name="company_address" /> <span class="error">This is an error</span> </div> <div> <label>*Address Line 2:</label> <input type="text" name="address_line2" /> <span class="error">This is an error</span> </div> </div> <div class="column"> <div> <label>*Town:</label> <input type="text" name="town"/> <span class="error">This is an error</span> </div> <div> <label>*City:</label> <input type="text" name="city"/> <span class="error">This is an error</span> </div> <div> <label>*County:</label> <input type="text" name="county"/> <span class="error">This is an error</span> </div> </div> <div class="column"> <div> <label>*First Name</label> <input type="text" name="first_name"/> <span class="error">This is an error</span> </div> <div> <label>*Surname</label> <input type="text" name="surname" /> <span class="error">This is an error</span> </div> <div> <label>*Email Address</label> <input type="text" name="useremail"/> <span class="error">This is an error</span> </div> </div> <div class="column"> <div> <label>*Username</label> <input type="text" name="username"/> <span class="error">This is an error</span> </div> <div> <asp:Label ID="lblpassword" runat="server" Text="Password"></asp:Label> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" > </asp:TextBox> <asp:RegularExpressionValidator ID="valPassword" runat="server" ErrorMessage="Password must contain between 8 - 15 characters" ControlToValidate="txtpassword" ValidationExpression="[a-zA-Z'.\s]{8,15}$"></asp:RegularExpressionValidator> </div> <div> <label>*Re-enter Password</label> <input type="password" name="re_password" /> <span class="error">This is an error</span> </div> </div> <div class="bottom"> <div class="remember"> <input type="checkbox" /> <span>Email me DocStore updates</span> </div> <input type="submit" value="Register" /> <a href="registration.aspx" rel="login" class="linkform">You have a DocStore account already? Log in here</a> <a href="home.aspx">Return to DocStore HomePage</a> <div class="clear"></div> </div> </div> </div> </div> </form> <form class="login" action="registered_users.aspx" method="post" id="regusers1" > <h3>Login</h3> <p><strong> <i> *Please enter your username and password in order to access your account.</i></strong></p> <div> <label>Username:</label> <input type="text" name="username" /> <span class="error">This is an error</span> </div> <div> <label>Password: <a href="registration.aspx" rel="forgot_password" class="forgot linkform">Forgot your password?</a></label> <input type="password" /> <span class="error">This is an error</span> </div> <div class="bottom"> <div class="remember"><input type="checkbox" /><span>Keep me logged in</span></div> <input type="submit" value="Login"/> <a href="registration.aspx" rel="register" class="linkform">Don't have a DocStore account yet? Register here</a> <div class="clear"></div> </div> </form> <form class="forgot_password" action="registered_users.aspx" method="post" id="regusers2" > <h3>Forgot Password</h3> <div> <label>Username or Email:</label> <input type="text" /> <span class="error">This is an error</span> </div> <div class="bottom"> <input type="submit" value="Send reminder"/> <a href="registration.aspx" rel="login" class="linkform">Suddenly remebered account details?<br/> Log in here</a> <a href="registration.aspx" rel="register" class="linkform">You don't have a DocStore account yet? Register here</a> <div class="clear"></div> </div> <!--/div--> </form> <div class="clear"></div> <!-- The JavaScript --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(function () { //the form wrapper (includes all forms) var $form_wrapper = ('<%= #form_wrapper.ClientID) %>'); //the current form is the one with class active $currentForm = $form_wrapper.children('form.active'), //the change form links $linkform = $form_wrapper.find('.linkform'); //get width and height of each form and store them for later $form_wrapper.children('form').each(function (i) { var $theForm = $(this); //solve the inline display none problem when using fadeIn fadeOut if (!$theForm.hasClass('active')) $theForm.hide(); $theForm.data({ width: $theForm.width(), height: $theForm.height() }); }); //set width and height of wrapper (same of current form) setWrapperWidth(); /* clicking a link (change form event) in the form makes the current form hide. The wrapper animates its width and height to the width and height of the new current form. After the animation, the new form is shown */ $linkform.bind('click', function (e) { var $link = $(this); var target = $link.attr('rel'); $currentForm.fadeOut(400, function () { //remove class active from current form $currentForm.removeClass('active'); //new current form $currentForm = $form_wrapper.children('form.' + target); //animate the wrapper $form_wrapper.stop() .animate({ width: $currentForm.data('width') + 'px', height: $currentForm.data('height') + 'px' }, 500, function () { //new form gets class active $currentForm.addClass('active'); //show the new form $currentForm.fadeIn(400); }); }); e.preventDefault(); }); function setWrapperWidth() { $form_wrapper.css({ width: $currentForm.data('width') + 'px', height: $currentForm.data('height') + 'px' }); } /* I need to check the which form was submited, and give the class active to the form I want to show */ $form_wrapper.find('input[type="submit"]') .click(function (e) { e.preventDefault(); }); }); </script> </body> </html> </code></pre> |
35,596,247 | 0 | <p><code>enter code here</code> <code>enter code here</code>s="hello fattie i'm a fattie too" <code>enter code here</code>#this code is unsure bbut manageabele <code>enter code here</code>looking word= "fattie" <code>enter code here</code>li=[] <code>enter code here</code>for i in range(len(s)): <code>enter code here</code> if s.startswith(lw, i): <code>enter code here</code> print (i) <code>enter code here</code> space = s[:i].count(" ") <code>enter code here</code> hello = space+1 <code>enter code here</code> print (hello) <code>enter code here</code> li.append(hello) <code>enter code here</code>print(li)</p> |
18,420,033 | 0 | Use data from view in javascript <p>I was wondering if it's possible to use data from the view in my javascript code? This is what I have:</p> <p>View "<strong>index.phtml</strong>":</p> <pre><code><?php $event = $this->event; ?> <script> // HERE I WANT TO USE $event var data = <?=$event?>; </script> </code></pre> <p>But that doesn't work!</p> |
11,903,235 | 0 | <p><a href="http://developer.android.com/guide/components/fragments.html" rel="nofollow"><code>Fragments</code></a> will solve all your problems here.</p> <p>There are many great examples and the link i posted will help you get started.</p> <p><a href="http://stackoverflow.com/questions/5710573/need-a-fragments-example">Here is a similar post with many examples as answers.</a></p> |
4,568,732 | 0 | Windows Phone 7 Development <p>I am currently developing application that does following:</p> <ol> <li>Read Inbox (using MAPI) & SMS Interception (incoming & outgoing)</li> <li>Read CallLog (using P/Invoke e.g. PhoneOpenCallLog) and intercept call log</li> <li>File System Notification</li> <li>Reading Installed Appications (using XML Provisioning)</li> <li>Configre VPN and Email (using XML Provisioning)</li> <li>Perform all configuration programatically that is shown in Settings menu (using Registry).</li> </ol> <p>And most important, my application will always <strong>run in background</strong> (which is not supported in WP 7), tracking user activity.</p> <p>I have read that there will not be Native code (C++) support as well as P/Invoke support in WP 7. Are there any <strong>managed APIs</strong> available to perform all of the above tasks?</p> |
33,865,131 | 0 | How to deleted record as false in SQL Server from winforms UI using c#? <p>I have a problem to set deleted record as false in my SQL Server.I tried a lot.</p> <p>My problem is i have a table in some Of the columns id,name etc...id as primary key constraint. When the user delete the record? so that record should be present on the table. i will make that record as false in my table?</p> <p>In future he want to add the record with the deleted id? we give the chance to add a record with that id?</p> <p>plz tell me the example of doing this? i tried a lot but i don't know. because primary key doesn't accept duplicates so i strucked here.</p> <p>My delete stored procedure:</p> <p>If user press the delete button in my UI:</p> <p>This stored procedure is execute in my back-end:</p> <pre><code>update table set id=id*-1, flag=1 where id=@id and flag=0; </code></pre> <p>In front i have shown record is deleted.</p> <p>But if he want to add the record with that deleted id. Primary key voilation error from my database.when he insert the record.</p> <p>Thanks</p> |
17,694,998 | 0 | <p>The problem is in your second <code>setTimeout</code> call, you are invoking the function <code>win_open</code> then passing the value returned by it to <code>setTimeout</code> as the callback</p> <p>You need</p> <pre><code>function link_redirect(linkaddress) { overlay(); setTimeout(function() { overlay(); win_open(linkaddress) }, 2000); //return false; } </code></pre> |
3,900,262 | 0 | <p>If you have <code>template<class T> class X;</code> you don't expect <code>X<3></code> to work and deduce that <code>T</code> is <code>int</code>, do you? The same is here <code>IsFunc<FunctionA></code> is invalid, but <code>IsFunc<void()></code> is fine. HTH</p> |
21,709,561 | 0 | How get Admin credentials? I am the Admin already <p>My new computer have Windows 8.1 64-bit Spanish version; the previous one had Windows XP and I never messed before with Credentials, Privileges, etc. In my computer there is just one user account that is marked as Administrator: "They have access to all files and programs stored in the computer". However, if I open a command-line window and execute <code>chkdsk</code> I get this:</p> <pre><code>Microsoft Windows [Versión 6.2.9200] (c) 2012 Microsoft Corporation. Todos los derechos reservados. C:\Users\Antonio> chkdsk Acceso denegado porque no tiene privilegios suficientes. Invoque esta utilidad ejecutándola en modo elevado. </code></pre> <p>That is: "Access denied because you have not enough privileges. Invoke this utility executing it in elevated mode". I tried to use <code>runas</code> command, but I don't understand what parameters I must give.</p> <p>I get the same result when I execute <code>fsutil</code> with these options:</p> <pre><code>C:\Users\Antonio> fsutil fsinfo ntfsInfo C: Error: Acceso denegado. </code></pre> <p>How can I execute these programs in my computer? TIA</p> |
16,261,909 | 0 | <p>Found the issue...</p> <pre><code> <td> <div class="button-bar"> <button class="btn btn-danger" data-bind="click: deleteOffice, disable: hasChanges">Delete </button> </div> </td> </code></pre> <p>I changed the button tag for <code><a href></code> , applied the same style and problem fixed!</p> |
40,413,586 | 0 | <p>So what's happening is your <code>draw::before/draw::after</code> elements are 0px tall at the start of your transition. That means the border radius is going to be very skewed. </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>button { background: none; border: 0; box-sizing: border-box; color: #f45e61; font-size: inherit; font-weight: 700; padding: 200px; text-align: center; margin: 20px; position: relative; vertical-align: middle; } button::before, button::after { box-sizing: border-box; content: ''; position: absolute; width: 100%; height: 100%; } .draw { -webkit-transition: color 0.25s; transition: color 0.25s; border-radius: 70px; } .draw::before, .draw::after { border-radius: 70px; border: 30px solid transparent; width: 0; height: 0; } .draw::before { top: 0; left: 0; } .draw::after { bottom: 0; right: 0; } .draw:hover { color: #60daaa; } .draw:hover::before, .draw:hover::after { width: 100%; height: 100%; } .draw:hover::before { border-top-color: #60daaa; border-right-color: #60daaa; -webkit-transition: width 1.25s ease-out, height 1.25s ease-out 1.25s; transition: width 1.25s ease-out, height 1.25s ease-out 1.25s; } .draw:hover::after { border-bottom-color: #60daaa; border-left-color: #60daaa; -webkit-transition: border-color 0s ease-out 2.5s, width 1.25s ease-out 2.5s, height 1.25s ease-out 3.75s; transition: border-color 0s ease-out 2.5s, width 1.25s ease-out 2.5s, height 1.25s ease-out 3.75s; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><h1>CSS Border Transitions</h1> <button class="draw">draw</button></code></pre> </div> </div> </p> <p>After enlarging/slowing down the animation you can see what the issue is. I would also recommend putting a transition on the right/left border until the height is transitioning to avoid the 'drawing point' being a weird shape. </p> <p>Here is another example of what I mean by the border-radius being skewed: </p> <p><a href="https://i.stack.imgur.com/db1rE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/db1rE.png" alt="Skewed"></a></p> <p><a href="http://codepen.io/anon/pen/mOdOyQ" rel="nofollow noreferrer">http://codepen.io/anon/pen/mOdOyQ</a></p> |
23,586,442 | 0 | <p>make the input a span and change your DOM query to alter "innerHTML": <code> function count() { x += 1; document.getElementById( "counting" ).innerHTML = x; } </code></p> |
13,147,778 | 0 | <p>Use <a href="http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCIQFjAA&url=http%3A%2F%2Factionbarsherlock.com%2F&ei=EUWQUOT-BKXmiwLN5oHgDQ&usg=AFQjCNEKyOYK1H-iAiI67o4J8dIPJNL9TA&sig2=bBemH9Of9AkgJ6uiBJhwZA" rel="nofollow">ActionBarSherlock</a> and the <a href="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCIQFjAA&url=https%3A%2F%2Fgithub.com%2FChristopheVersieux%2FHoloEverywhere&ei=HEWQUL6iEaGcjAK43oD4DQ&usg=AFQjCNHjHK7GWfkXusOoRZ6dh3X4VXYCTg&sig2=MmcuMrDALTMnyCAeY2Xzjg" rel="nofollow">HoloEverywhere</a> libraries, as well as the <a href="http://developer.android.com/tools/extras/support-library.html" rel="nofollow">Android Support</a> libraries.</p> |
17,942,700 | 0 | Do temporary files get deleted even while the app is running? <h2>Background</h2> <p>On android, you can create temporary files as such (link <a href="http://developer.android.com/guide/topics/data/data-storage.html#InternalCache" rel="nofollow">here</a> and <a href="http://developer.android.com/reference/java/io/File.html#createTempFile%28java.lang.String,%20java.lang.String,%20java.io.File%29" rel="nofollow">here</a> for documentation) :</p> <pre><code>final File temp = File.createTempFile("myFile", ".tmp", context.getCacheDir()); </code></pre> <p>I'm developing an app that uses temporary files and when it's done with them (and on start of the app), it deletes them.</p> <h2>The question</h2> <p>The documentation says :</p> <blockquote> <p>When the device is low on internal storage space, Android may delete these cache files to recover space.</p> </blockquote> <p>Does it mean that files can get deleted even while my app is still running? In which cases would android be allowed to delete the files? </p> <p>In other words , can I assume that as long as I have the app running , android won't delete the files by itself, even if other apps create their own temporary files?</p> |
13,553,946 | 0 | <p>If you can't find a method, you can build one using ruby's <em>include?</em> method.</p> <p>Official documentation: <a href="http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-include-3F" rel="nofollow">http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-include-3F</a></p> <p>Usage:</p> <pre><code>array = [1, 2, 3, 4] array.include? 3 #=> true </code></pre> <p>Then, you can do a loop:</p> <pre><code>def array_includes_all?( array, comparision_array ) contains = true for i in comparision_array do unless array.include? i contains = false end end return contains end array_includes_all?( [1,2,3,2], [1,2,2] ) #=> true </code></pre> |
15,938,490 | 0 | <p>This approach will work with PostgreSQL but it'll tend to be pretty inefficient as you're updating each row twice - each update requires <em>two</em> transactions, two commits. The cost of this can be mitigated somewhat by using a <code>commit_delay</code> and possibly disabling <code>synchronous_commit</code>, but it's still not going to be fast unless you have a non-volatile write-back cache on your storage subsystem.</p> <p>More importantly, because you're committing the first update there is no way to tell the difference between a worker that's still working on the job and a worker that has crashed. You could probably set the token to the worker's process ID if all workers are on the local machine then scan for missing PIDs occasionally but that's cumbersome and race-condition prone, not to mention the problems with pid re-use.</p> <p>I would recommend that you adopt a <em>real</em> queuing solution that is designed to solve these problems, like ActiveMQ, RabbitMQ, ZeroMQ, etc. <a href="http://wiki.postgresql.org/wiki/PGQ_Tutorial" rel="nofollow">PGQ</a> may also be of significant interest.</p> <p>Doing queue processing in a transactional relational database <em>should</em> be easy, but in practice it's ridiculously hard to do well and get right. Most of the "solutions" that look sensible at a glance turn out to actually serialize all work (so only one of many queue workers is doing anything at any given time) when examined in detail. </p> |
6,352,813 | 0 | <p>Why not make the views layer-backed? You can then just apply an affine transform to the view's layer.</p> <pre><code>yourView.layer.transform = CATransform3DMakeRotation(M_PI_4, 0, 0, 1.0); </code></pre> |
5,591,702 | 0 | <p>Any tutorial on building a VB6.0 form will do. <a href="http://www.google.com.au/search?q=custom+messagebox+vb6" rel="nofollow">Google</a> is your friend.</p> <p>Try this one: <a href="http://www.vbforums.com/showthread.php?t=445165" rel="nofollow">http://www.vbforums.com/showthread.php?t=445165</a></p> |
26,950,797 | 0 | <p>If you only need to find direct members, you can use Attribute Scope Query (ASQ). This requires domain/forest functional level of 2003 (forgot domain or forest).</p> <pre><code>DirectoryEntry groupEntry = new DirectoryEntry("LDAP://<server>/<group DN>", "user", "pwd"); DirectorySearcher searcher = new DirectorySearcher(groupEntry); searcher.SearchScope = SearchScope.Base; searcher.AttributeScopeQuery = "member"; searcher.Filter = "(&(objectCategory=person)(objectClass=user))"; searcher.PropertiesToLoad.Clear(); searcher.PropertiesToLoad.Add("name"); searcher.PropertiesToLoad.Add("mail"); searcher.PropertiesToLoad.Add("displayName"); foreach (SearchResult result in searcher.FindAll()) { Console.WriteLine(result.Path); } </code></pre> <p>For nested group members, you may use the LDAP_MATCHING_RULE_IN_CHAIN matching rule. This requires domain/forest functional level of 2008 R2 (again, forgot domain or forest).</p> <pre><code>DirectoryEntry rootEntry = new DirectoryEntry("GC://<server>", "user", "pwd"); DirectorySearcher searcher = new DirectorySearcher(rootEntry); searcher.SearchScope = SearchScope.Subtree; searcher.Filter = "(&(objectCategory=person)(objectClass=user)(memberOf:1.2.840.113556.1.4.1941:=<group DN>))"; searcher.PropertiesToLoad.Clear(); searcher.PropertiesToLoad.Add("name"); searcher.PropertiesToLoad.Add("mail"); searcher.PropertiesToLoad.Add("displayName"); foreach (SearchResult result in searcher.FindAll()) { Console.WriteLine(result.Path); } </code></pre> <p><strong>Limitations:</strong></p> <ul> <li>Both methods don't handle primary group membership</li> <li>ASQ don't work across domain, an exception will be thrown if member from another domain is found. So normally you can only perform this for global groups.</li> </ul> |
11,574,829 | 0 | How to find icons for app bar in metro windows 8? <p>How to find icons for app bar in metro windows 8 ? And how can i add custom icons ?</p> |
5,349,040 | 0 | <p>If I guess right the DBUtils is returning new instance for each call of getConnection(). And as the DBUtils class is a utility class so it shouldn't be maintaining any state. In this scenario no you dont need any addition efforts for synchronization. </p> |
10,443,986 | 0 | Make custom types appear in Xcode's documentation popup <p>I want to achieve the similar result for my own code:</p> <p><img src="https://i.stack.imgur.com/WziGi.png" alt="enter image description here"></p> |
25,592,517 | 0 | <p>More precisely, <code>() -> ()</code> means a closure taking a tuple with 0 values as argument and returning a tuple with zero values. Which is equivalent to saying: a closure taking no arguments and with no return value (or returning <code>void</code>)</p> |
11,774,984 | 0 | How to give alt and title for background image? <p>How to give alt and title for background image? Is it possible?</p> <pre><code><div id="cont"></div> #cont { background:#FFF url(../images/post.png) no-repeat; } </code></pre> |
9,339,848 | 0 | <p>Umm... I'm either missing something extremely obvious or everyone else is.</p> <p>You want to date operations? Use <code>to_date</code> and <code>to_char</code>. I'm going to assume this <code>ss:sss</code> means, seconds, then fractional seconds. You date appears to be a string so we need to convert it twice:</p> <pre><code>update b set first = to_char( to_date( my_date, 'yyyy/mm/dd-hh:mi:ss:ff3') ,'yyyy-mm-dd hh:mi:ss' ) </code></pre> <p>Generally, when using dates it's far, far easier to only use <a href="http://psoug.org/reference/date_func.html" rel="nofollow">date functions</a> and the provided <a href="http://ss64.com/ora/syntax-fmt.html" rel="nofollow">formats</a>.</p> <p>As an added point if you have a date, store it as a date. It'll save a world of bother later on.</p> |
7,195,886 | 0 | <p>A regular expression substitution will do it. Look at the gsub() function.</p> <p>This gives you what you want (it removes any instance of '[' or ']'):</p> <pre><code>gsub("\\[|\\]", "", n) </code></pre> |
2,277,896 | 0 | <p>This isn't really an aggregation, it's just a groupwise maximum. <code>ROW_NUMBER</code> is the easiest way to write these queries:</p> <pre><code>;WITH CTE AS ( SELECT Query, CreatedTime, UpdatedTime, <other_columns>, ROW_NUMBER() OVER ( PARTITION BY Query ORDER BY CreatedTime DESC, UpdatedTime DESC ) AS RowNum FROM Somethings WHERE CreatedTime >= '20100101' AND CreatedTime < '20100201' ) SELECT * FROM CTE WHERE RowNum = 1 </code></pre> <p>It's not necessarily the most efficient, but it's reasonably good in most cases. And the nice thing is that you can modify this to do top 2 per group, top 3, etc., and you have complete control over ties.</p> <p>(P.S. I hope you don't actually name the column "Query")</p> |
14,289,000 | 0 | <p>Windows Azure machines are yours for the using so if you want a different time zone, go right ahead and set it.</p> <p>The easiest approach is to create a very simple startup task and use <strong>tzutil</strong>, the Windows Time Zone Utility. We use the following:</p> <pre><code>tzutil /s "GMT Standard Time" </code></pre> <p>This is installed by default only on the Windows Server 2008 R2 or Windows Server 2012 images.</p> <p>Full details are here: <a href="http://wely-lau.net/2011/06/26/setting-timezone-in-windows-azure-3/" rel="nofollow">http://wely-lau.net/2011/06/26/setting-timezone-in-windows-azure-3/</a></p> |
38,708,554 | 0 | Meteor-Bootstrap jQuery wrong version <p>I do have the following message in the console:</p> <pre><code>Uncaught Error: Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v3.0.0 </code></pre> <p>In .meteor > version file it says it's <code>jquery@1.11.9</code>.</p> <ul> <li>I did tried to meteor remove and the install again both jquery and boostrap separately.</li> <li>Also tried to manualy change current version in .meteor version file to 1.9.1 first in terminal it says: <br><code>jquery upgraded from 1.9.1 to 1.11.9</code><br> But after server restart the current version is back to 1.11.9</li> </ul> <p>What can be done to retrieve the favor of the javascript gods?</p> |
19,557,119 | 0 | <p>Given the format <code>$ _( int, int )___ .</code> where <code>_</code> is an arbitrary amount of whitespace use </p> <pre><code>int n = 0; int result = scanf("$ (%d,%d ) .%n", &int1, &int2); if ((result != 2) || (n == 0)) { ; // failed, handle error. } </code></pre> <p>Let's break the scanf() format down</p> <p><code>"$"</code> match a <code>'$'</code><br> <code>" "</code> match 0 to unlimited number of whitespace.<br> <code>"("</code> match <code>'('</code><br> <code>"%d"</code> match any amount of leading whitespace, then look for an <code>int</code>, storing in the corresponding <code>int *</code>.<br> <code>","</code> match <code>','</code><br> <code>")"</code> match <code>')'</code><br> <code>"."</code> match <code>'.'</code><br> <code>"%n"</code> Save the number of <code>char</code> parsed so far into the corresponding <code>int *</code>. Acting on this directive does not affect the <code>scanf()</code> result.</p> <p>Liberal use of <code>%n</code> could be intersperse should more specific scanning be require than suggested in this solution.</p> |
39,530,708 | 0 | <p>A couple of things to check.</p> <ul> <li><p>The pyenv tool doesn't install Python with a shared library by default. That could result in problems as mod_wsgi wants a shared library. You need to explicitly tell pyenv to build Python with a shared library.</p></li> <li><p>A home directory on many Linux systems is not readable to other users. When mod_wsgi is being initialised, it is running as the Apache user and will not be able to see inside of the home directory. There isn't an issue when the mod_wsgi module is loaded by Apache as Apache is running as root at that point.</p></li> </ul> <p>There are other issues with your configuration where don't follow best practices, but the above, especially the second item is likely the cause of your problem.</p> |
6,607,522 | 0 | <p>I don't know about such tool. You can write your own generator using database metadata info: <code>Connection.getMetadata()</code></p> |
34,404,561 | 0 | <p>This call </p> <pre><code>scanf_s("%s",msg); </code></pre> <p>is missing the size argument. Change to</p> <pre><code>scanf_s("%s", msg, (unsigned)sizeof msg); </code></pre> <p>You are also doing this</p> <pre><code>for(i=0;msg[i]!=NULL;i++) m[i]=msg[i]; </code></pre> <p>which generates a compiler warning, because <code>NULL</code> is pointer value, not a char value. But its biggest sin is not copying the <code>'\0'</code> string terminator. What do have against <code>strcpy()</code> or even <code>strdup()</code>?</p> |
614,439 | 0 | <p>As of NHibernate 2.1, the <a href="http://nhforge.org/blogs/nhibernate/archive/2008/11/09/nh2-1-0-bytecode-providers.aspx" rel="nofollow noreferrer">proxy factory is pluggable</a>. Here are some proxy providers supported:</p> <ul> <li>Castle.DynamicProxy</li> <li>LinFu</li> <li>Spring.NET</li> </ul> <p>So proxying will be actually out of NHibernate's responsibility, and the answer to this question really depends on the selected proxy factory.</p> |
29,632,356 | 0 | <p>You just need to multiply your concepts by your documents:</p> <pre><code>(20(currentConceptCount*currentDocumentCount) * 10(previousTime)) / 100(previousConceptCount*previousDocumentCount) </code></pre> |
37,709,154 | 0 | <p>in project.json you need this dependency</p> <pre><code>"Microsoft.Extensions.Localization": "1.0.0-rc2-final", </code></pre> <p>in Startup.cs in ConfigureServices you need code like this:</p> <pre><code> services.AddLocalization(options => options.ResourcesPath = "GlobalResources"); services.Configure<RequestLocalizationOptions>(options => { var supportedCultures = new[] { new CultureInfo("en-US"), new CultureInfo("en"), new CultureInfo("fr-FR"), new CultureInfo("fr"), }; // State what the default culture for your application is. This will be used if no specific culture // can be determined for a given request. options.DefaultRequestCulture = new RequestCulture(culture: "en-US", uiCulture: "en-US"); // You must explicitly state which cultures your application supports. // These are the cultures the app supports for formatting numbers, dates, etc. options.SupportedCultures = supportedCultures; // These are the cultures the app supports for UI strings, i.e. we have localized resources for. options.SupportedUICultures = supportedCultures; // You can change which providers are configured to determine the culture for requests, or even add a custom // provider with your own logic. The providers will be asked in order to provide a culture for each request, // and the first to provide a non-null result that is in the configured supported cultures list will be used. // By default, the following built-in providers are configured: // - QueryStringRequestCultureProvider, sets culture via "culture" and "ui-culture" query string values, useful for testing // - CookieRequestCultureProvider, sets culture via "ASPNET_CULTURE" cookie // - AcceptLanguageHeaderRequestCultureProvider, sets culture via the "Accept-Language" request header //options.RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(async context => //{ // // My custom request culture logic // return new ProviderCultureResult("en"); //})); }); </code></pre> <p>in Configure you need code something like this:</p> <pre><code>var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>(); app.UseRequestLocalization(locOptions.Value); </code></pre> <p>I have some <a href="https://github.com/joeaudette/cloudscribe.Web.Localization" rel="nofollow">working demo code here</a>, if you need more</p> |
1,706,678 | 0 | ncurses and stdin blocking <p>I have <em>stdin</em> in a <code>select()</code> set and I want to take a string from <em>stdin</em> whenever the user types it and hits <kbd>Enter</kbd>.</p> <p>But select is triggering <em>stdin</em> as ready to read before <kbd>Enter</kbd> is hit, and, in rare cases, before anything is typed at all. This hangs my program on <code>getstr()</code> until I hit <kbd>Enter</kbd>.</p> <p>I tried setting <code>nocbreak()</code> and it's perfect really except that nothing gets echoed to the screen so I can't see what I'm typing. And setting <code>echo()</code> doesn't change that.</p> <p>I also tried using <code>timeout(0)</code>, but the results of that was even crazier and didn't work.</p> |
13,107,368 | 0 | Is it possible to caputre the rendering audio session from another process? <p>I am taking my first dives in to the WSASAPI system of windows and I do not know if what I want is even possible with the windows API.</p> <p>I am attempting to write program that will record the sound from various programs and break each in to a separate recorded track/audio file. From the reseacrch I have done I know the unit I need to record is the various <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd370796%28v=vs.85%29.aspx" rel="nofollow">audio sessions</a> being rendered to a endpoint, and the normal way of recording is by taking the render endpoint and performing a loopback. However from what I have read so far in the MSDN the only interaction with sessions I can do is through <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd368246%28v=vs.85%29.aspx" rel="nofollow">IAudioSessionControl</a> and that does not provide me with a way to get a copy of the stream for the session.</p> <p>Am I missing something that would allow me to do this with the WASAPI (or some other windows API) and get the individual sessions (or individual streams) before they are mixed together to form the endpoint or is this a imposable goal?</p> |
24,635 | 0 | <p>I use FCKEditorOnRails plugin: <a href="http://github.com/UnderpantsGnome/fckeditor_on_rails/tree/master" rel="nofollow noreferrer">http://github.com/UnderpantsGnome/fckeditor_on_rails/tree/master</a></p> <p>Note that you can generally drop in the latest version of FCKEditor without much tweaking if you're running into bugs in the older version.</p> |
2,004,576 | 0 | <p><a href="http://checkstyle.sourceforge.net/" rel="nofollow noreferrer">CheckStyle</a> to enforce coding standard, <a href="http://cobertura.sourceforge.net/" rel="nofollow noreferrer">Cobertura</a> for checking code coverage.</p> <p>On a related note also check the book <a href="http://oreilly.com/catalog/9780596527938" rel="nofollow noreferrer">Java Power Tools</a><br> which covers around 30 open source tools that help to do better development with Java</p> |
1,151,823 | 0 | <p>try avoiding unnecessary postbacks to pages, there are a lot of features you can implement by using things like jQuery or ExtJs framework. Learn how to do AJAX calls and pass info between your app and the server via JSON result sets.</p> <p>Also, install apps like FireBug and YSlow and use these to analyze your application and follow their recommendations on how to speed up your app. Good luck!</p> |
8,605,454 | 0 | <p>Your code gives me the following compiler error, skipping some bits</p> <pre><code>/usr/include/boost/spirit/home/support/action_dispatch.hpp:142:13: error: no matching function for call to ‘action_dispatch<>::do_call( const main()::<lambda(const string&)>&, action_dispatch<>::fwd_tag<std::vector<char>>, ... </code></pre> <p>which boils down to that the argument passed to your lambda is <code>vector<char></code>, not <code>string</code></p> <p>So, replace <code>string</code> with <code>vector<char></code>:</p> <pre><code>(+qi::alpha)[[](const std::vector<char>& s) { cout << std::string(s.begin(), s.end()) << '\n'; }] </code></pre> |
14,629,617 | 0 | <p>In this particular case, it depends. If using a namespace alias does the trick, by all means prefer it to macros, for all of the usual reasons. But the two do radically different things. You cannot open a namespace using its alias, i.e.: </p> <pre><code>namespace XYZ_ver1 {} namespace XYZ = XYZ_ver1; namespace XYZ { // Illegal! } </code></pre> <p>This works with a macro; in fact, you can define the macro before the namespace has ever appeared. If you need this, then you need to use a macro.</p> |
17,498,099 | 0 | <p>MNagel has the correct link for this, but to reiterate, you want to look at using something like:</p> <pre><code>CREATE PROC dbo.MyProc WITH EXECUTE AS 'SomeUser' AS BEGIN --Proc --Do Stuff END --Proc GO </code></pre> <p>"Execute As" has some other gotchas along the way. You have to allow others to impersonate the specified user and that user would need the appropriate select permissions to the underlying tables.</p> <p>If you want to mass grant permissions, you can do that at the Schema level instead of the object level - something like:</p> <pre><code>GRANT SELECT, EXEC ON Schema::dbo TO MyRole; </code></pre> <p>I've used that before to greatly simplify a lot of grant statements for our roles. We have very few overrides for the more general roles so this helps quite a bit.</p> |
35,380,420 | 0 | <p>if your project R file not generated automatically then this are the possibility i mention below.</p> <ul> <li><p>If the R .* can not be generate means that you have some issue into the res/ folder. Check for errors in res/ folder.</p></li> <li><p>Invalid file name: must contain only [a-z0-9_.] all the res/* filename should be named with lowercase character, underscore and number between 0 and 9</p></li> <li><p>Go to Project and hit Clean. This should, among others, regenerate your R.java file.</p></li> <li><p>Also get rid of any import android.R.* statements and then do the clean up I mentioned.</p></li> <li><p>Check your latest updates in SDK manager if possible some remain to update.</p></li> <li><p>Also check target build was set to Android 2.1 (SDK v7) where his layout XML used Android 2.2 (SDK v8) elements (layout parameter match_parent), due to this there was no way for Eclipse to correctly generate the R.java file which caused all the problems.</p></li> </ul> |
23,047,620 | 0 | Bad syntax on MySQL query <p>it says unexpected "="... What should I rewrite? Thanks</p> <pre><code>$result = mysql_query("SELECT * FROM soubory, users WHERE id='".$id."'" AND soubory.users_id = users.id ); </code></pre> |
39,573,914 | 0 | <p>Your error is telling you what the problem is. In your application.conf you should set <code>akka.actor.provider = "akka.cluster.ClusterActorRefProvider"</code>. If you want to use a 1 node cluster on your laptop you should also set <code>akka.cluster.min-nr-of-members = 1</code>.</p> |
4,976,101 | 0 | <p>Maybe you're looking for <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx" rel="nofollow"><code>SmtpClient</code></a>?</p> |
7,714,571 | 0 | <p>Make sure to #define GLEW_STATIC in the project before including GLEW in Windows. Then you can just include the entire source code in your project files. Otherwise, you need to have the proper GLEW DLL file in with your executable.</p> |
12,579,508 | 0 | <p>The problem was solved by making another emulator targeting another platform version. I was working on Android 4 with Google APIs. I made another emulator 2.3 API 10 with Google API.</p> <p>Thanks for people suggestions here for trying another emulator or restarting it.</p> |
970,808 | 0 | <p>Had a OnMouseDown event handler that was put in to make it so when you right clicked on a row that row would be selected. At some point this was changed to not just handle right clicks but any click. Apparently, selecting the row interfered with the check box being edited. </p> <p>Fix was to change it to only be on right click.</p> |
23,290,313 | 0 | Getting the average of not null fields <p>I'm using Crystal reports in my application </p> <pre><code>average({ConsultationDetail.viandenord} ) </code></pre> <p>I need to get the avearge of not null field <code>viandenord</code> </p> <ol> <li>How can i change the formula to get this result?</li> <li>What is the best way to do that?</li> </ol> |
2,015,277 | 0 | extend Application.cfc, but not from the root <p>I have:</p> <pre><code>1. inetpub/wwwroot/ProjectName/Application.cfc 2. inetpub/wwwroot/ProjectName/Admin/Application.cfc </code></pre> <p>I want #2 to extend #1 and override the onRequest function. I've looked into Sean Corfields's ApplicationProxy.cfc solution, but that is if your project is in the root folder, which mine isn't.</p> |
22,297,066 | 0 | <p>You have to remove the line <code>editable: true,</code></p> <p>Here is a working example. use this <code>script tag</code>.</p> <pre><code><script> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); var Xmas95 = new Date("25 Dec, 1995 23:15:00"); alert('vidda : '+ Xmas95); $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, //editable: true, events: [ { title: 'All Day Event', start: '20140210' }, { title: 'Long Event', start: new Date(y, m, d-5), end: new Date(y, m, d-2) } ], dayClick: function(date, allDay, jsEvent, view) { alert('Clicked on the entire day: ' + date); console.log(date); } }); }); </script> </code></pre> <p>this should work fine. The dragging facility will cut off by removing <code>editable:true</code> and <strong>dayClick</strong> can be achieved by the relevant code. </p> |
28,846,159 | 0 | <p>I have identified a workaround. </p> <p>I'm using a tuple for the constraint and handling it myself in the didApplyConstraints handler. </p> <p>The format for the custom constraint assumes that the range begins at the first value and travels <em>counter clockwise</em> until the second value. It makes no allowances for constraint values above PI or below -PI. This solution also doesn't deal with total ranges greater than 2*PI. </p> <p>Ranges that do not cross the +/- PI boundary are "normal" and can be handled normally.</p> <p>Ranges that DO cross the +/- PI boundary are "goofy" and must be handled as a special case (if possible). </p> <p>A solution to the special case seems impossible unless you are tracking angular velocity with an SKPhysicsBody (or manually). This value is required to identify which boundary the node likely "crossed" and should thus be constrained to.</p> <pre><code>// constraint = (CGFloat(M_PI/2), -CGFloat(M_PI/2)) override func didApplyConstraints() { var r = rotationSprite.zRotation if constraint.0 < constraint.1 { // regular constraint, easy to handle. rotationSprite.zRotation = min(max(r, constraint.0),constraint.1) } else // "goofy" constraint that crosses PI boundary { if r < constraint.0 && r > constraint.1 { if rotationSprite.physicsBody?.angularVelocity < 0 { // clockwise, crossed first value (so long as absolute angular vel is < 2PI rotationSprite.zRotation = constraint.0 } else if rotationSprite.physicsBody?.angularVelocity > 0 // counter clockwise, crossed second value (so long as absolute angular vel is < 2PI { rotationSprite.zRotation = constraint.1 } else { // If 0 velocity (or no velocity), no way to find out which boundary was crossed. rotationSprite.zRotation = constraint.0 // Probably better to default to closest angle } rotationSprite.physicsBody?.angularVelocity = 0 // Alternately, multiply by a negative restitution factor. } } } </code></pre> |
30,287,433 | 0 | <p>Don't use Flask's development server in production. Use a proper WSGI server that can handle concurrent requests, like <a href="http://gunicorn.org/" rel="nofollow" title="Gunicorn">Gunicorn</a>. For now try turning on the server's threaded mode and see if it works.</p> <pre><code>app.run(host="x.x.x.x", port=1234, threaded=True) </code></pre> |
19,281,511 | 0 | <pre><code>toProvider(new TypeLiteral<FooProvider<Bar>>() { }); </code></pre> |
40,198,180 | 0 | How to the change color of links to specific file extensions with a userscript? <p>My school website has homework download links and I want to distinguish them by coloring them different colors.<br> EG: Microsoft Word files would be blue and .RTF files would be green.<br> Since I'm new to this none of my scripts are working. </p> <p>My script:</p> <pre><code>// ==UserScript== // @name Homework Help // @namespace http://tampermonkey.net/ // @version 0.1 // @description Color links for different file extensions // @author You // @match (My School Website) // @grant none // ==/UserScript== function getFileExtension(filename) { return filename.split('.').pop(); } (function() { 'use strict'; // Your code here... var links = document.getElementByTagName("a"); var element; for (var i = 0; i < links.lenth(); i++){ element = rtfs[i]; if( getFileExtension(element.href) == "rtf" ){ element.style.color = "green"; } } })(); </code></pre> <p>I tried googling it but found no solution.</p> |
9,439,569 | 0 | <p>Well, maybe... but most probably not.</p> <p>But if it does, it's not "because both are UNIX" it's because:</p> <ul> <li>Mac computers happen to use the same processor nowadays (this was very different in the past)</li> <li>You happen to use a program that has no dependency on any library at all (very unlikely)</li> <li>You happen to use the same runtime libraries </li> <li>You happen to use a loader/binary format that is compatible with both.</li> </ul> |
2,774,789 | 0 | PDF generated with jasperreport not showing well on Linux but yes on Mac, could the os be related? <p>A PDF I generate with jasper reports renders Ok in my MAC but some labels show wrong on Linux. For example, I have a static label that doesn't show completely on linux (only a part of the whole word) but yes on Mac. Can the OS be somehow related? What is the usual source of this kind of problems? </p> |
22,567,320 | 0 | Django edit user profile <p>I'm trying to create an "Edit Profile" form in the fronted. What happens is that my form(i'm not 100% sure) tries to create a user instead of finding the current user and update his profile. So I think that's the issue. Checked many questions here but none was clear enough. The fields I'm trying to edit are email, first name and last name. (Also I would like to add uda</p> <p>forms.py</p> <pre><code>class UpdateProfile(forms.ModelForm): username = forms.CharField(required=True) email = forms.EmailField(required=True) first_name = forms.CharField(required=False) last_name = forms.CharField(required=False) class Meta: model = User fields = ('username', 'email', 'first_name', 'last_name') def clean_email(self): username = self.cleaned_data.get('username') email = self.cleaned_data.get('email') if email and User.objects.filter(email=email).exclude(username=username).count(): raise forms.ValidationError('This email address is already in use. Please supply a different email address.') return email def save(self, commit=True): user = super(RegistrationForm, self).save(commit=False) user.email = self.cleaned_data['email'] if commit: user.save() return user </code></pre> <p>views.py</p> <pre><code>def update_profile(request): args = {} if request.method == 'POST': form = UpdateProfile(request.POST) form.actual_user = request.user if form.is_valid(): form.save() return HttpResponseRedirect(reverse('update_profile_success')) else: form = UpdateProfile() args['form'] = form return render(request, 'registration/update_profile.html', args) </code></pre> |
36,565,567 | 0 | Excel VBA activate objects if checkbox ticked <p>I have got a piece of code that works which changes a input field from disabled to enabled and changes the colour from gray to white if the corresponsding checkbox is ticked.</p> <p>Is there a way to loop this or call it for all checkboxes & input fields without having a seperate piece of code for each pair?</p> <p>The code I have is:</p> <pre><code>Private Sub CheckBox1_Click() If CheckBox1.Value = True Then tb01.Enabled = True tb01.BackColor = vbWhite Else: tb01.Enabled = False tb01.BackColor = vb3DLight End If End Sub Private Sub CheckBox2_Click() If CheckBox2.Value = True Then tb02.Enabled = True tb02.BackColor = vbWhite Else: tb02.Enabled = False tb02.BackColor = vb3DLight End If End Sub </code></pre> <p>edit: This code is in a UserForm</p> |
4,476,564 | 0 | <p>First, you are checking if the object instance is in the collection, but you are only creating one instance once (outside the while loop). Therefore, when you check if <code>!myPartyGroupList.Contains(partyGroup)</code>, it will return false the first time, so you will add the obj to the collection and then it will return false every time.</p> <p>I would use a Dictionary using an Id property as the Dictionary key.</p> <p>like this:</p> <pre><code>Dictionary <int,PartyGroup> myPartyGroupList = new Dictionary <int,PartyGroup>(); using (AseDataReader reader = command.ExecuteReader()) { while (reader.Read()) { int id=Convert.ToInt32(reader["party_group_id"]); if (!myPartyGroupList.ContainsKey( id )) { PartyGroup partyGroup = new PartyGroup(); partyGroup.PartyGroupID = id; partyGroup.PartyGroupName = reader["party_group_name"].ToString(); partyGroup.PersonList = myPersonList; myPartyGroupList.Add(id, partyGroup); // key, value? check param order here } } } </code></pre> |
35,699,252 | 0 | <p>You might as well disable it from being clicked and it does not listen to action anymore</p> |
11,126,825 | 0 | Metro App reading HTML formatted string <p>I have a metro app and want to bind a <code><TextBlock></code> element to a string which contains some HTML formatting elements. I seem to remember there being a converter for this kind of thing pre-WinRT, but I can't find any reference to this in the WinRT namespace.</p> <p>Here's an example of the string:</p> <pre><code>This is<br>a string with some formatting<br>elements<img src="http://image-url"> </code></pre> <p>At the minute I'm just binding this to a TextBlock and getting a poorly formatted piece of markup. Without writing a mini-converter myself, is there a way to deal with this for WinRT?</p> |
36,516,637 | 0 | <p>It is a very clear algorithm and seems you got it right. So for changing the way of accessing the characters, why didn't you use the <code>String#charAt</code> method?</p> <p>Also you may want to change the return type of the method from String <code>"YES"</code> or <code>"NO"</code> to <code>true</code> or <code>false</code> of type <code>boolean</code>:</p> <pre><code>static boolean isValidBracketString(String string) { Stack<Character> stack = new Stack<>(); for(int i=0; i< string.length(); i++){ if(string.charAt(i) == '{' || string.charAt(i) == '[' || string.charAt(i) == '('){ stack.push(string.charAt(i)); } else if(string.charAt(i) == '}' || string.charAt(i) == '}' || string.charAt(i) == ')') { if(stack.size() == 0) return false; switch(stack.pop()){ case '(': if(string.charAt(i) != ')') return false; break; case '[': if(string.charAt(i) != ']') return false; break; case '{': if(string.charAt(i) != '}') return false; break; } } } return stack.size() == 0; } </code></pre> |
24,963,927 | 0 | Gnuplot:Same Loop for input and output file <p>I would like to do the following thing</p> <p>set output 'error0.tex'<br> plot 'error0.dat' using 1:2 title 'Error x', \<br> error0.dat' using 1:3 title 'Error y'<br> ...<br> ...<br> set output 'error10.tex'<br> plot 'error10.dat' using 1:2 title 'Error x', \<br> error10.dat' using 1:3 title 'Error y' </p> <p>Is there any simple way to get this?</p> <p>So i get 10 different files with 2 graphs in it.</p> |
30,738,999 | 0 | <p>If you are creating a class that extends an Adapter, you can use parent variable to obtain the context.</p> <pre><code>public class MyAdapter extends ArrayAdapter<String> { private Context context; @Override public View getView(int position, View convertView, ViewGroup parent) { context = parent.getContext(); context.getResources().getColor(R.color.red); return convertView; } } </code></pre> <p>You can do the same with RecyclerView.Adapter, but instead of getview() you will use onCreateViewHolder().</p> |
39,067,891 | 0 | Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference <p>i am getting this Error </p> <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.activeandroid.TableInfo.getIdName()' on a null object reference </code></pre> <p>when i disable <strong>Instant Run</strong> i did not get any error my project works fine.</p> <p>But i want to keep <strong>instant Run</strong> <strong>Enabled</strong>. I find some where that if i want to <strong>enabled Instant Run</strong> i have to un-check the </p> <blockquote> <p>ReStart the Activity on code changes</p> </blockquote> <p>but this did not work for me.</p> <p>Any solution for this is highly appreciated.</p> |
10,185,458 | 0 | Finding Bitrate of video file <p>How can we find bitrate of a video file in c++? Can we do this by file handling?</p> <p>Thanks</p> |