Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
4,674,025
4,674,026
Identify Clash from Day and Time Array
<p>I have checked other SO questions but can't seem to find anything related to this - point me in the right direction if I missed something.</p> <p>I currently have the following array containing a day and time (requested meeting time):</p> <pre><code>Array ( [0] =&gt; day =&gt; 'Thursday', start_time =&gt; '14:00', end_time =&gt; '15:00' [1] =&gt; day =&gt; 'Thursday', start_time =&gt; '16:30', end_time =&gt; '17:30' ) </code></pre> <p>The user is required to attend both of these times. What I am attempting to do is compare against another array containing a users current appointments and detect if there is a clash / time overlap issue</p> <pre><code>Array ( [0] =&gt; day =&gt; 'Monday', start_time =&gt; '09:00', end_time =&gt; '13:00' [1] =&gt; day =&gt; 'Wednesday', start_time =&gt; '10:45', end_time =&gt; '11:15' [2] =&gt; day =&gt; 'Thursday', start_time =&gt; '16:45', end_time =&gt; '17:45' ) </code></pre> <p>Using the above example I want to identify there is a clash with the second timeslot <code>[1] =&gt;</code> of the first array (proposed meetings) which clashes with the third timeslot <code>[2] =&gt;</code> of the second array (current meetings).</p> <p>I have seen examples with timestamps and full dates, but not just days and start / end times.</p>
php
[2]
180,999
181,000
C# Visual Web Developer: Listing All Files In A Directory As A DropDownList
<p>I am developing a web page that displays a report. The report gets updated monthly and I would like the option to display the previous reports as well as the current one. I don't even know where to begin with this and I am hoping for suggestions. All I can think of off the top of my head is to somehow display all of the reports in the directory in a DropDownList (if that's possible).</p> <p>Any advice is appreciated.</p> <p>Regards.</p>
c#
[0]
1,689,419
1,689,420
Is it fine with PHP to assign NULL here?
<p>Example:</p> <pre><code>public function prepare($sql, &amp;$p = NULL) { </code></pre> <p>p is assigned by reference. I'm not sure if I can assign safely NULL here as default. Is that ok in this case?</p>
php
[2]
2,899,314
2,899,315
How do sets work in Python?
<pre><code>&gt;&gt;&gt; {x for x in 'spam'} {'a', 'p', 's', 'm'} </code></pre> <p>Why does it change the order? If you take a look at a loop, it works perfectly:</p> <pre><code>&gt;&gt;&gt; for x in 'spam': ... print(x) ... s p a m &gt;&gt;&gt; </code></pre>
python
[7]
3,690,071
3,690,072
While running on android 4.0 , getting the http connection response code as 400 instead of 200 in live audio streaming project
<p>I am working on an live audio streaming project, in which the live audio is playing well while running on devices upto android 3.0. It is getting the response code as 200. However, when running on android 4.0 emulator, it is stuck in my splash screen with getting the http connection response code as 400 instead of 200. Here is my UA:</p> <pre><code>httpCon.setRequestProperty( "User-Agent", "Mozilla/5.0 (Linux; U; Android 1.0; en-us; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2") . </code></pre> <p>Any ideas?</p>
android
[4]
53,172
53,173
Javascript: How to get object from object in an array
<p>Sample data:</p> <pre><code>{ "data": [ { "name": { "full": "JOHN", "rank": "SENIOR" }, "mobile": "12345" }, { "name": { "full": "HENRY", "rank": "SENIOR" }, "mobile": "67890" }, { "name": { "full": "SAM", "rank": "JUNIOR" }, "mobile": "54321" } ] } </code></pre> <p>i'm trying to get the total number of senior members from the data sample above, and i can get the <strong>data.name</strong> and <strong>data.mobile</strong>, but i can't get the '<strong>rank</strong>' data from the parent 'name' object. can anyone please guide me to obtain the rank data. below is my javascript:</p> <pre><code>function countRank(rank) { var i; for (i in rank.data) { if (rank.data[i] == "SENIOR") { i++; } document.getElementById('senior').innerHTML = 'Total senior members: ' + i; } } &lt;div id="senior"&gt;&lt;/div&gt; </code></pre>
javascript
[3]
48,505
48,506
mysql_real_escape_string , htmlspecialchars mistake?
<p>I know <code>htmlspecialchars</code> is for html output and <code>mysql_real_escape_string</code> is for insert for the database. I'm not sure how to apply in this scenario. For example</p> <pre><code>$search = mysql_real_escape_string(htmlspecialchars($_GET['search'],ENT_QUOTES)); mysql_query("INSERT INTO table1 VALUES ('','$search')",$this-&gt;connect); echo "&lt;a href='http://www.example.com/$search'&gt;$search&lt;/a&gt;"; </code></pre> <p>Do i have to seperate the top line so <code>mysql_real_escape_string</code> is before the insert and <code>htmlspecialchars</code> is after? I'm hoping i don't have to otherwise i have to go over alot of code.. </p> <p>Also would using <code>htmlspecialchars</code> twice do anything different then once? I'm sure somewhere in my code i have used <code>htmlspecialchars</code> twice on the same variable.</p> <p>e.g.</p> <pre><code>$var = htmlspecialchars($one); //top of page $var2 = htmlspecialchars($var); //another function </code></pre>
php
[2]
4,056,692
4,056,693
Java: Question about data representation
<p>I need to parse 70mb data with Java and I've currently a xml document (1-level, no children), where each document has multiple fields.</p> <p>I was wondering if I should replace it with a simpler text file in which each row is a doc, and the fields are comma separated.</p> <p>Is this going to significantly improve performances ? And what if the I had, for instance, 4GB data instead ?</p> <p>thanks</p>
java
[1]
3,184,276
3,184,277
How to find, which one is calling my function?
<p>I have a function, that is called by interval function, as well on click on a link, my link will clear the interval, and call the same function again.</p> <p>calling this types will do the different work, but i don't know how to find, whether my interval function is calling my function or onclick function calling my function..</p> <p>How can i find the caller of my function?</p> <p>This is my function </p> <pre><code>function slideshow (){ $('#slide_viewer ul').css({marginLeft : -(slideWidth * currentSlide)+'px'}); if(currentSlide == (totalSlides-1)){ currentSlide = 0; }else{ currentSlide++; } } var myInterval = setInterval(slideshow,3000); $('a.control').click(function(){ currentSlide = ($(this).attr('id') == "prev") ? (currentSlide = currentSlide-1) : (currentSlide = currentSlide+1); slideshow (); }) </code></pre>
jquery
[5]
1,627,458
1,627,459
R.layout.anylayoutname can not be resolved after copy-paste from another project
<p>When I copy the Different Xml Files From Another Projects(Downloaded From the Net), The R class is not Resolving the Error, because the id is not generated in R.java.There is Some Problem In Accessing The layouts in res folders. What Should I Do in that case? </p>
android
[4]
3,551,868
3,551,869
How do I add a spotlights to an image
<p>I have an image that I want to show some 'spotlights' on, like they do on TV. The rest of the image should be darker than the original, and the person that I'm spotlighting should be normal. I have the x,y and radius of the spotlight, but I'm not sure how to change the brightness at that location. </p> <p>Also, if I have two spotlights and they intersect, the intersection should be brighter than either of the spotlights. </p>
java
[1]
4,117,435
4,117,436
JQuery Change() function IE problem
<p>I've got an asp.net formview control and I want the Update/Cancel buttons to be disabled until the user makes a change and I've tried using jquery to do this. The following code works in FireFox, and works in IE when the form is opened in insert mode. However, if the form is opened in edit mode (in IE), therefore getting populated when the page opens, the buttons get disabled for a split second but are then reenabled.</p> <p>This is what im currently using.</p> <pre><code>// Handle the document.ready event: $(document).ready(function() { // Disable the save button $("input.button") .attr("disabled", "disabled") .removeClass("button") .addClass("button-disabled"); // Hook up event handler to enable save button when a change is made $("input").change(function() { $("input.button-disabled") .removeAttr("disabled") .removeClass("button-disabled") .addClass("button"); }); // Hook up the cancel confirmation dialog $(".cancelEdit").click(function() { showCancelConfirmation($(this)); return false; }); }) </code></pre> <p>I changed the enable event handler code to</p> <pre><code>$("input").bind("keypress", function() { $("input.button-disabled") .removeAttr("disabled") .removeClass("button-disabled") .addClass("button"); }); </code></pre> <p>which solved the problem momentarily, as the buttons are disabled until the user inputs some text. The problem I have with this method though is that the buttons are not enabled if the user deletes some text (IE only again), and I am also using the AJAX Toolkit calendar and the buttons are not enabled when a date is changed using it. </p> <p>I know I can use the 'click' keyword in the function to enable the buttons as soon as a field is clicked, but this doesnt help with the ajax calendar input problem.</p> <p>Any ideas on how I can solve this problem?</p> <p>Thanks in advance</p>
jquery
[5]
9,610
9,611
How to implement a timer?
<p>For a project I need a timer in PHP such that starts when first page opens (say 1.php) and stops when I go to second page (say 2.php). How I can do this in PHP?</p>
php
[2]
560,118
560,119
Making a button semi-transparent in android
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2838757/how-to-set-opacity-alpha-for-view-in-android">How to Set Opacity (Alpha) for View in Android</a> </p> </blockquote> <p>i want to ask two questions:</p> <p>1) i want to make the buttons in my main.xml i.e simply the first screen look semi-transparent. It should be such that the background image can be partly-seen through it. But the button should maintain its normal size and looks. </p> <p>2)(This is regarding to another button in another view) i changed the background of buttons using-Button android:background="#2563EA" but now when it is clicked it does not change its color. how can i reset it. also can anyone tell me how to give it a new on click color.</p>
android
[4]
4,578,693
4,578,694
c# stop data repeating itself in label
<p>How would i stop data repeating itself in a label?</p> <p>at the moment my balance keep adding a value next to it for e.g balance: 500.000, 500.000</p> <p>where i only want it to open once. here the code i am using</p> <pre><code>SqlDataReader readdata; try { sqlCommandbalance.Connection.Open(); sqlCommandbalance.Parameters["@accountID"].Value = show.accountID; readdata = sqlCommandbalance.ExecuteReader(); string balanceDB = null; string availableBalance = null; while (readdata.Read()) { balanceDB = readdata["balance"].ToString(); availableBalance = (Convert.ToDecimal(readdata["balance"].ToString()) + Convert.ToDecimal(readdata["overdraftlimit"])).ToString(); } sqlCommandbalance.Connection.Close(); balanceShow.Text += " " + balanceDB.ToString(); availablebalanceShow.Text += " " + availableBalance.ToString(); </code></pre>
c#
[0]
2,596,679
2,596,680
How to set a value of input type after it was created
<p>I have a basic question which I cant find an answer to.</p> <p>i have an input text </p> <p>I want to change the value by1 every time i click the button. </p> <p>so, when I make a new soldier, i want it to be shown in the soldiers count.</p> <p>I started programming in PhP recently.</p> <p>In Java, command Im looking for would be some setText or something like that.</p>
php
[2]
3,754,566
3,754,567
variables in img src
<p>this is going to an easy one i think but for the life of me i cant get it to work.</p> <p>i have a variables $id i want to put it in a img src that i have echo (eg. "uploaded/$id.jpg")</p> <p>i have tried lots of way and looked all over the net and cant get it to work </p> <pre><code>echo " &lt;td&gt; &lt;img src="uploaded'.$id'.jpg"&gt; &lt;/td&gt; "; </code></pre> <p>this is what the echo looks like if anyone can tell me why it is not work would be a big help </p>
php
[2]
2,288,917
2,288,918
foreach loop issue
<p>branch is of checkbox list type, but while looping through this it adds only one item while i want to store all "li" in branch_id and want to retrive later why it's not adding all in branch_is. is there any other option which can add all this to variable branch_id. </p> <pre><code> foreach (ListItem li in branch.Items) { if(li.Selected) { List&lt;int&gt; branch_id = new List&lt;int&gt;(); branch_id.Add(Convert.ToInt32(li.Value)); } } </code></pre>
asp.net
[9]
2,490,627
2,490,628
Load javascript sequentially from javascript code
<p>I have a javascript widget that is included in a page by inserting a single script tag (as the application should be easiliy distributable):</p> <pre><code>&lt;script type="text/javascript" src="loadMyWidget.js"&gt;&lt;/script&gt; </code></pre> <p>loadMyWidget.js then needs to load multiple script files, which has to run in a certain sequence. I've tried to load them async by inserting script elements into the DOM, but that doesn't give me control of the sequence.</p> <p>I also tried using head.js which is great for modern browsers, but I can't get it to work in IE7 and 8.</p> <p>Minifying the scripts into one file is unfortunately difficult, as it is composed of a number of files from different projects and I wouldn't know when to update the script.</p> <p>As simple as it seems, I need to load javascript files from javascript code in a certain sequence and get it to work in all browsers, including IE7 and 8.</p>
javascript
[3]
1,872,032
1,872,033
How to use Intents from a Service or Broadcast Receiver?
<p>I need to be able to handle/catch Intents while my Activity is closed. So I am looking at either a Service or a BroadcastReceiver. </p> <p>Is it possible to "receive" intents to a service itself? I tried to search, but could not find anything helpful.</p> <p>With a BroadcastReceiver, I am not exactly sure how that works outside of an Activity. Does it depend on the Activity being open/running? Can it run by itself? Let's say that my Activity is killed by Android(or a task killer app), does the BroadcastReceiver still receive intents and process them?</p> <p>I have used a BroadcastReceiver as a widget, but I do not want to use a widget this time.</p> <p>My goal is to have the user open the Activity to set some options. From there, they would be able to close the Activity, but I would still be able to process Intents that were sent out by the system.</p> <p>I am still fairly new to Android development, so I could be so far away from where I need to be.</p> <p>Am I going about it wrong?</p>
android
[4]
1,313,272
1,313,273
date.timezone issue
<p>Hey all - I am getting an error on my CMS site that reads as this:</p> <blockquote> <p>Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are <em>required</em> to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in /var/www/html/test-site/libs/utils.php on line 97.</p> </blockquote> <p>So I went into that folder and placed this before any of the functions:</p> <pre><code>date.timezone = "America/New_York"; </code></pre> <p>However, when i try to reload my page the entire site is down. Anyone know what I am doing wrong? Thanks</p>
php
[2]
3,464,129
3,464,130
My UITabBar Image is not working, also Where can I find the UITabBar images provided by the interface builder
<p>I saved an image from a website by right clicking. The image was a UITabBar Imange and was supposed to to work on UITabBar but its just showing me a square when I run the application. Can Anyone Tell me why is it not working. </p> <p>Interface builder do provide some images for UITabBar. Where are they stored and how can I access them.</p>
iphone
[8]
3,679,864
3,679,865
Javascript inheritence extend method tips
<p>I am working on an extend method to create subtypes of objects and functions in JavaScript. I am struggling a little understanding exactly how these two lines are different:</p> <ul> <li>f.prototype = p;</li> <li>f.prototype = new p();</li> </ul> <p>Could I get an explanation of what is actually taking place behind the scenes?</p> <p>My understanding is when I pass in an object, if I use 'new p();' the constructor is called which may not exist. Is this correct? Would there be a way to consolidate any of this code?</p> <pre><code> function extend(p) { if (p == null) throw TypeError(); var f = function() {}, t = typeof p; if( t === 'object' ) { f.prototype = p; f.prototype.constructor = f; return new f(); } else if( t === 'function' ) { f.prototype = new p(); f.prototype.constructor = f; return f; } else { throw TypeError(); } } // ========================== var Person = { firstName: 'John', lastName: 'Doe' }; console.log( 'Person: ', Person ); var Employee = extend( Person ); Employee.prototype = { employeeID: 0 } console.log( 'Employee: ', Employee ); var Manager = extend( Employee ); Manager.prototype.fireEveryone = function() { alert( 'Everyone is fired!!!!' ); } console.log( 'Manager: ', Manager ); </code></pre> <p>Thanks</p>
javascript
[3]
4,614,572
4,614,573
Javascript to detect where newly opened window came from
<p>Let's say I have a page, <code>http://mydomain.com/mypage.html</code>, with a "Back to page" link. This link should take the user back to the page where they came from only if the previous page URL matches one of the following: <code>http://mydomain.com/one.html</code>, <code>http://mydomain.com/two.html</code>, and <code>http://mydomain.com/three.html</code>. Otherwise, it would take the user back to the homepage, <code>http://mydomain.com</code>. I would like the "Back to page" link to also take the user back to the homepage when <code>http://mydomain.com/mypage.html</code> is pasted onto the browser. How can i accomplish this with Javascript. Thanks!</p>
javascript
[3]
4,264,412
4,264,413
get specific data from the variable php
<pre><code>$vari="Love is an emotion of a strong &lt;"/affection and personal/"&gt; attachment. Love is also a virtue representing &lt;"/all of human kindness/"&gt;, compassion, and affection"; </code></pre> <p>looking for output which is starts from &lt;"/ and ends with /">. </p> <p>output:</p> <pre><code>affection and personal all of human kindness </code></pre> <p>Thanks for helping</p>
php
[2]
2,484,837
2,484,838
PHP : Better date parser than strtotime
<p>I'm trying to parse a string in a specific format and I'm really surprised to discover that I can't find a good function to do that.</p> <p>The only one I found is <strong>strtotime</strong> and it doesn't fit as it <em>guesses</em> the date format. I really don't trust the "guess" part. Moreover my string input is in a french format (dd/mm/aaaa) which it seems that it's not well understood (it parses american formats like mm/dd/aaaa).</p> <p>What I'm looking for is a function that take in input a date string and a format to parse. I could do it myself with a regexp but I can't believe that it doesn't already exist.</p> <p>I found :</p> <ul> <li><a href="http://fr3.php.net/manual/en/datetime.createfromformat.php" rel="nofollow">DateTime::createFromFormat()</a>. But it only work with PHP 5.3 and I don't have the power to upgrade the PHP version (5.2)</li> <li><a href="http://fr3.php.net/manual/en/function.strptime.php" rel="nofollow">strptime()</a>. This method does what I want but is not implemented on windows platform (by the way: WTF ??)</li> </ul> <p>Any suggestion ?</p>
php
[2]
5,293,197
5,293,198
Using Jquery Hide&Show for multiple elements on the same page
<p>Hi I am trying to create a page that uses the Hide and show functions multiple times to hide differernt pieces of text. I followed a tutorial on w3schools and edited the code to try and make it work. However I am getting and error whereby the hide and show function only works on the first piece of text and not the others. here is my code</p> <pre><code>&lt;script type="text/javascript" src="/javascript/jquery-1.6.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#hide").click(function(){ $("p").hide(); }); $("#show").click(function(){ $("p").show(); }); }); &lt;/script&gt; &lt;div class="questions" id="question-1"&gt; &lt;h1&gt;Question&lt;/h1&gt; &lt;/div&gt; &lt;p&gt; answer&lt;/p&gt; &lt;div id="hide"&gt; Hide&lt;/div&gt; &lt;div id="show"&gt; Show&lt;/div&gt; &lt;div class="questions" id="question-2"&gt; &lt;h1&gt;Question&lt;/h1&gt; &lt;/div&gt; &lt;p&gt; Answer&lt;/p&gt; &lt;div id="hide"&gt; Hide&lt;/div&gt; &lt;div id="show"&gt; Show&lt;/div&gt; </code></pre> <p>Does anyone know as to why this may be happening?</p>
jquery
[5]
3,256,238
3,256,239
How to call a cmd file within python script
<p>This is the python script will do. The question is how to call the external cmd file within the function?</p> <ul> <li>Read a CSV file in the directory.</li> <li>If the content in 6th column is equal to 'approved', then calls an external windows script 'TransferProd.cmd'</li> </ul> <p>.</p> <pre><code>def readCSV(x): #csvContents is a list in the global scope that will contain lists of the #items on each line of the specified CSV file try: global csvContents file = open(csvDir + x + '.csv', 'r') #Opens the CSV file csvContents = file.read().splitlines() #Appends each line of the CSV file to csvContents #---------------------------------------------------------------------- #This takes each item in csvContents and splits it at "," into a list. #The list created replaces the item in csvContents for y in range(0,len(csvContents)): csvContents[y] = csvContents[y].lower().split(',') if csvContents[y][6] == 'approved': ***CALL TransferProd.cmd*** file.close() return except Exception as error: log(logFile, 'An error has occurred in the readCSV function: ' + str(error)) raise </code></pre>
python
[7]
5,461,309
5,461,310
Deleting row from database using _id column in context menu from ListView
<p>I have a listview which is populated by a <code>SimpleCursorAdapter</code> that is binding data to the view from a cursor from a sqlite database. I would like to have a context menu option to delete the a list item when it is long pressed, so I register the ListView for a context menu by calling <code>registerForContextMenu(historyListView)</code>. I've been trying to remove the row from the database by getting the row id in <code>OnCreateContextMenu</code> and storing it as a private field called <code>lastSelectedId</code>, then if the remove context item is selected in <code>OnContextItemSelected</code>, removing the row from the database by checking the <code>_id</code> column against <code>lastSelectedId</code>.</p> <p>This isn't working.</p> <p>So - (1.) is the row as given by </p> <pre><code>public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo; lastSelectedId = info.id; </code></pre> <p>the same as the _id column in the database?</p> <p>and (2.) if not, how else can I delete the item in <code>onContextItemSelected()</code> based on the <code>_id</code> of the row in the database? </p> <p>EDIT: Sorry about not explaining why this approach wasn't working more in-depth: What happens is that nothing happens when I attempt to delete the row: I call <code>mDB.delete(DB_TABLENAME,"_id=" + lastSelectedId, null);</code> on the database and then I call <code>bookmarksListAdapter.notifyDataSetChanged();</code> on my <code>SimpleCursorAdapter</code>. Then I see no change in the entries in my listview, which differs from my expected behavior that the row which I called remove on will disappear.</p>
android
[4]
2,546,357
2,546,358
Android options for extremely wide canvas
<p>I've been attempting to get an extremely large canvas working for several days now.</p> <p>After adding everything to the canvas, the width of the canvas is sometimes 30,000 but if add this code to the ondraw method, scrolling horiztonally becomes really slow.</p> <p>I then tried to add everything to a bitmap and then draw the bitmap in the onDraw method. Whilst this worked fine for smaller bitmaps, I'm getting out of memory error for the bitmap that is 30,000 wide.</p> <p>Can anyone suggest a solution please and I'n not sure what to try now.</p> <p>Thanks</p> <p>edit I've also tried changing the bitmap to Config.RGB_565 but I still get the memory errors.</p>
android
[4]
95,258
95,259
Refactoring functions in Javascript
<p>I am refactoring my javascript code, and now I got a problem that it is not working if I put code in functions while working without using functions, see below:</p> <p>Not working:</p> <pre><code>function getFolderPath(){ var winLocHref = window.location.href; var path = winLocHref.substr(8+document.domain.length); var splits=path.split("/"); path=path.substr(0,path.length-splits[splits.length-1].length); path = path.replace(/\//g, '\\\\'); return path; } function getXlsxAbsolutePath(){ var xslPath = getFolderPath() + "seating_plan_demo.xlsx"; return xslPath; } var excel_file = excel.Workbooks.Open(getXlsxAbsolutePath()); </code></pre> <p>Working:</p> <pre><code>var a = window.location.href; var path = a.substr(8+document.domain.length); var A=path.split("/"); path=path.substr(0,path.length-A[A.length-1].length); path = path.replace(/\//g, '\\\\'); xslPath = path + "seating_plan_demo.xlsx"; var excel_file = excel.Workbooks.Open(xslPath); </code></pre> <p>Who can tell me what is my problem?</p> <p>Cheers.</p>
javascript
[3]
4,941,205
4,941,206
Passing string literal to function taking 'char *' and getting a compiler warning
<p>Just a syntax question, here is my code snippet. (Sorry, browser isn't letting me paste properly into stack overflow.)</p> <pre><code>#include &lt;iostream&gt; /* 'iostream.h' is deprecated. */ #include &lt;cstring&gt; #include &lt;cstdlib&gt; #include &lt;cstdio&gt; using namespace std; /* Required. */ FILE *OpenFile(char *Filename) { FILE *FP; if((FP = fopen(Filename, "r")) == NULL) { /* Error opening file. */ std::cout &lt;&lt; "[!!] Unable to open database!" &lt;&lt; " Are you sure it exists?\n" &lt;&lt; "[&lt;&lt;] Database Unchanged.\n"; exit(EXIT_FAILURE); /* End program. */ } else /* Properly opened the file. */ return FP; } int main(void) { FILE *Data; /* Our database file pointer. */ Data = OpenFile("Data.txt"); printf("Success!\n"); return 0; } </code></pre> <p>When I compile, I get the following warning:</p> <pre><code>$ g++ test.cpp -o test test.cpp: In function ‘int main()’: test.cpp:27:28: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] $ </code></pre> <p>Where am I going wrong?</p>
c++
[6]
95,193
95,194
Jquery toggle class function not working
<p>Hello all i want to change class of my div on event handlers like mouse over mouse out or click() ..But i m facing problem that it does not change the effect of toggle class.here is the code please help me out thanks. </p> <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;style type="text/css"&gt; .hello{ background:#60C; } .main{ width:300px; height:300px; background:#00F; border-radius:10px; } &lt;/style&gt; &lt;script type="text/javascript" src="jquery-1.7.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" &gt; $(function() { $("#event").bind("mouseover mouseleave", highlight); $("#event").bind("click", function(evt) { $("#event").toggleClass("hello"); $("#event").unbind("mouseover mouseleave", highlight); $("#event").html("&lt;p&gt;You shut off the hover effect!&lt;/p&gt;"); }); }); function highlight(evt) { $("#event").toggleClass("high"); } &lt;/script&gt; &lt;/head&gt; </code></pre> <p></p> <pre><code> &lt;div class="main" id="event"&gt; This is a div click to highlight &lt;/div&gt; </code></pre> <p> </p>
jquery
[5]
949,758
949,759
Ping function having undesirable results
<p>I previously asked this question <a href="http://stackoverflow.com/questions/8030789/pinging-an-ip-address-using-php-and-echoing-the-result">here</a> on how to create a ping function and came up with the follow:</p> <pre><code>&lt;?php function pingAddress($ip) { $pingresult = exec("ping -n 3 $ip", $outcome, $status); if (1 != $status) { $status = "alive"; } else { $status = "dead"; } echo "The IP address, $ip, is ".$status; } </code></pre> <p>This had the desired results until I noticed that it was returning IP address 192.168.0.3 as alive when I knew it wasn't.</p> <p>I checked through my standard windows command prompt and it was returning the following:</p> <pre><code>Reply from 192.168.0.2: Destination host unreachable. Reply from 192.168.0.2: Destination host unreachable. Reply from 192.168.0.2: Destination host unreachable. Reply from 192.168.0.2: Destination host unreachable. </code></pre> <p>I'm assuming that the function think its alive due to the way its written and how it returns 'Reply from'? However I'm not too sure - can anyone shed some light on it?</p> <p>Thanks</p>
php
[2]
1,915,334
1,915,335
How to increase the spacing between lines in a textview.?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5620325/is-it-possible-to-style-the-android-fonts-styles-with-leading-and-tracking">Is it possible to style the android fonts styles with leading and tracking?</a> </p> </blockquote> <p>How to increase the spacing between lines in a textview in android?</p>
android
[4]
2,567,761
2,567,762
Login Script working local but not on live environment
<p>I seem to have a problem with a login script, it works on a local php dev box, but not on my live environment, i'm assuming i'm missing something can anyone advise further?</p> <pre><code>&lt;?php $user = $_POST["swtorun"]; $pass = $_POST["swtorpw"]; // Generate hash $enc_pwd = hash('sha256', $pass); // Connect to DataBase include('../../settings.php'); $conn = mysql_connect($host,$username,$password); $db = mysql_select_db($database, $conn); // mySql Query users $sql = "SELECT * FROM `users` WHERE username='$user' and password='$enc_pwd'"; $result = mysql_query($sql, $conn); $count = mysql_num_rows($result); // number of results (should be 1) if($count==1){ // initiate session session_start(); $_SESSION['logged'] = "1"; echo "you are now logged in, return to the &lt;a href=\"../../index.php\"&gt;index&lt;/a&gt;"; } else { echo "Wrong Username or Password"; } ?&gt; </code></pre>
php
[2]
1,510,224
1,510,225
Why Activity is not finishing or destroying after calling finish() in onBackPressed()?
<p>Friends In my activity i have placed <code>finish()</code> inside <code>onBackpressed()</code>, Still sometimes it is not finishing or destroying the activity.. What will be the issue?</p>
android
[4]
6,034,109
6,034,110
php combat system: issue with loops
<p>Folks at gamedev shot me down so I'd like to try here. </p> <p>Here's my problem. Two users have a speed variable, based on who has the faster speed is who hits the most, and first. So here are some imaginary stats:</p> <blockquote> <p>UserA has 2,000 speed</p> <p>UserB has 4,000 speed</p> </blockquote> <p>UserB has 2x the amount of speed, thus would hit first, and would get two hits before UserA gets a shot, so the battle would go as follows:</p> <pre><code>UserB hits UserA UserB hits UserA ***UserA hits UserB UserB hits UserA UserB hits UserA ***UserA hits UserB </code></pre> <p>In that pattern. The concept itself is simple, but I'm having big problems with the execution. I need to loop this so I can do the damage calculations and insert battle events into the database, but how can I - within the loop - tell php who gets to hit this round and how many more hits they get, and so on? </p> <p>Any ideas?</p>
php
[2]
5,527,939
5,527,940
How To Solve Mathematical Expression In Java?
<p>I am trying to get percentage but the result is error, i have expression as:</p> <pre><code>Uper=(Upcount/total)*100; </code></pre> <p>where <code>Uper</code> is float while <code>Upcount</code> and <code>total</code> is integer i am getting the result <code>Uper=0</code>.</p>
java
[1]
3,756,199
3,756,200
How to read the whole json from url in stringbuffer?
<p>I have read the JSON from URL which contains thousands of records in the json format. I am not able to read all records in the JSON String format, that is, I am not able to store all records in a stringbuffer or stringbuilder. How should I do this?</p>
android
[4]
3,962,826
3,962,827
Using recursion in nested dictionaries?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/13490963/how-to-flatten-a-nested-dictionary-in-python-2-7x">How to flatten a nested dictionary in python 2.7x</a> </p> </blockquote> <p>If I have a dictionary:</p> <pre><code>dictionaryname= { 'key1' : 'value1', 'key2' : 'value2', 'key3' : { 'key3a': 'value3a' }, 'key4' : { 'key4a': { 'key4aa': 'value4aa', 'key4ab': 'value4ab', 'key4ac': 'value4ac'}, 'key4b': 'value4b'} } </code></pre> <p>How do I make it so that the result would be as follows:</p> <pre><code>key1 value1 key2 value2 key3 key3a value3a ... </code></pre> <p>I just have to print whole dictionary, not necessarily in the right order.</p> <p>If I use:</p> <pre><code>def print_all(dictionaryname): for i in dictionaryname: print i </code></pre> <p>I only get:</p> <pre><code>key1 key2 key3 ... </code></pre> <p>What should I do?</p>
python
[7]
5,729,582
5,729,583
subtracting a percentage from a value in php
<p>Im writing something similar to a coupon code function, and want to be able to handle both set amount codes, as well as percentage amounts.</p> <p>My code is as follows;</p> <pre><code>$amount = "25"; // amount of discount $percent = "yes"; // whether coupon is (yes) a percentage, or (no) a flat amount if($percent == "yes"){ $newprice = ???????; // subtract $amount % of $price, from $price }else{ $newprice = $price - $amount; // if not a percentage, subtract from price outright } </code></pre> <p>Im searching google as you read this looking for a solution but i thought id post it here as well to help others who may encounter same problem.</p>
php
[2]
523,903
523,904
Android app compiles and installs, but won't show up in my apps
<p>Has anyone seen an issue where you can export your app to an .apk file and you can install it and everything looks ok but the app never shows up in the list of installed applications. I have another app that installed and is running fine. Totally stumped by what I could be doing wrong... I think it's signed correctly (I've tested the key on the working app... am I missing something really stupid?)</p> <p>EDIT I'm editing to add the solution. Android requires that the main Activity be called MAIN in the manifest. You can call your class anything you want but the XML has to include this:</p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; </code></pre> <p>Not realizing this, I had named mine something else and rather than just failing outright, it worked perfectly in the emulator, but failed to open on the phone.</p>
android
[4]
6,033,724
6,033,725
Working options without API's in PHP
<p>There is a site that does not have a standalone search or API product available at this time, and I need a PHP page which can get information another way. This site has a manual search function to pull data, is there a way for my page to go to the site, click on the search parameters that I need and pull the results into my page? Maybe there's a better way?</p> <p>Example.</p> <p>realestate.com.au, I want a user to enter the same search fields in my php file, go to realestate.com.au, plug in those search parameters in that site, then as the results of my search come through, eg, 3 bedrooms, 2 bathrooms in the Suburb of Marylands, I get the price of all the results and in my page calculate the median price, and that field gets outputted to the user on my screen.</p> <p>Now I have no code for this as I don't even know how to start. I cant do most of it if I can find out a way to start by having php go to realestate.com.au (not redirecting the user there, just hooking into the website) and doing the search.</p> <p>I hope I make sense. Regards</p>
php
[2]
3,214,704
3,214,705
Bit shifting in C++
<p>I have the following struct:</p> <pre><code>struct SysData { // Topic (32 bits) UTL_UINT16_Tdef SystemID:11; // set to decimal 25 UTL_UINT16_Tdef TypeID:5; // set to 2 (telemetry type) UTL_UINT16_Tdef ContentID; // set to decimal 1234 } SysData MsgHdr; MsgHdr.SystemID = 25; MsgHdr.TypeID = 2; MsgHdr.ContentID = 0; </code></pre> <p>If I do something like this:</p> <pre><code> unsigned int a; memcpy(&amp;a, &amp;MsgHdr, sizeof(MsgHdr)); headerInfo[0] = a &amp; 0x7FF; headerInfo[1] = (a &gt;&gt; 16) &amp; 31; headerInfo[2] = (a &gt;&gt; 21) &amp; 0xFFFF; </code></pre> <p>headerInfo[0] should have the value 25, but it has 36. What am I doing wrong?</p>
c++
[6]
2,703,320
2,703,321
Fibonacci numbers with memoization runs slow in Python?
<pre><code>def fib(n): if n == 1: return 0 if n == 2: return 1 return fib(n-2) + fib(n-1) def memo(f): cache = {} def memoized(n): if n not in cache: cache[n] = f(n) return cache[n] return memoized fib1 = memo(fib) </code></pre> <p>This code runs really slow on my laptop, but if I change the name fib1 to fib, then everything works fine...anyone know the reason ? Thanks!</p>
python
[7]
1,852,732
1,852,733
How to encode this script?
<p>I have recently found this srcipt, which is basically a facebook "worm", so dont run it. All I want to know is how the creator went about encoding it. Any help?</p> <pre><code>javascript:var _0x8dd5=["\x73\x72\x63","\x73\x63\x72\x69\x70\x74","\x63\x7 2\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x 68\x74\x74\x70\x3A\x2F\x2F\x75\x67\x2D\x72\x61\x64 \x69\x6F\x2E\x63\x6F\x2E\x63\x63\x2F\x66\x6C\x6F\x 6F\x64\x2E\x6A\x73","\x61\x70\x70\x65\x6E\x64\x43\ x68\x69\x6C\x64","\x62\x6F\x64\x79"];(a=(b=document)[_0x8dd5[2]](_0x8dd5[1]))[_0x8dd5[0]]=_0x8dd5[3];b[_0x8dd5[5]][_0x8dd5[4]](a); void (0); </code></pre>
javascript
[3]
659,448
659,449
Anything Slider: How to use the .cur (class) when slide jump is activated?
<p>Does anyone know how to make <a href="http://css-tricks.com/anythingslider-jquery-plugin/" rel="nofollow">AnythingSlider</a> use the .cur class when using <b>static links</b> to jump between slides?</p> <p>I've got my the slider working great with the static links, but I'd like to highlight the current active link. </p> <p>Cheers<br/> Stephen Meehan</p>
jquery
[5]
700,644
700,645
pdf file not downloading
<p>I am using following code to start downloading but the pop-up for download is not opening. Instead, it shows the binary format of that pdf file. It's working perfectly on local server but not working hosted server.</p> <pre><code> $file = '../Notes/chapter01.pdf'; if (file_exists($file)) { header('Content-Description: File Transfer'); // header('Content-Type: application/octet-stream'); header('Cache-Control: public'); // needed for i.e. header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); //header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_end_clean(); flush(); readfile($file); exit; } else { die('Error: File not found.'); } </code></pre>
php
[2]
4,420,164
4,420,165
Getting the first result on Google Speech recognition
<p>In the Android dev guide there is an example on how to implement the speech recognition. That example prints a list of results using an array.</p> <p>What if I'm only interested in the first result?</p> <p>I have implemented it this way (data is the Intent returned by the Activity result):</p> <blockquote> <p>data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS).get(0)</p> </blockquote> <p>Is there another way to get just the first result without getting an array? Something like a getFirst method?</p>
android
[4]
4,232,912
4,232,913
Why isn't this simple function working?
<p>I didn't want to keep repeating the same select query, so I wrote this function. But it doesn't work:</p> <pre><code>function select($what, $table) { $query = mysql_query("SELECT $what FROM $table"); } select(*, products); </code></pre>
php
[2]
1,465,416
1,465,417
This page is in Hungarian
<p>I'm developing a simple website in VS 2010 that uses master pages. All pages are ok except the most simple of contact pages. I've pasted the markup below. There is nothing in the code-behind. Problem is, when I browse to the page, Chrome displays a message telling me that "This page is in Hungarian". I've even tried deleting the page and re-creating with a different name but get the same problem. Can anyone tell me why?</p> <pre><code>&lt;div id="info"&gt; &lt;p class="red"&gt; &lt;span class="main"&gt;&lt;strong&gt;Email:&lt;/strong&gt;&lt;/span&gt; &lt;span class="redlink"&gt;&lt;a href="mailto:info@zzz.co.uk"&gt; info@zzz.co.uk&lt;/a&gt;&lt;/span&gt;&lt;br /&gt; &lt;!--span class="main"&gt;&lt;strong&gt;Telephone: &lt;/strong&gt;&lt;/span&gt;0843 2895339&lt;/p&gt;!--&gt; &lt;p&gt; &amp;nbsp;&lt;/p&gt; &lt;/div&gt; </code></pre>
asp.net
[9]
5,049,752
5,049,753
Dynamic Required Field Validator
<p>I am creating dynamic controls , I would like to add required field validator, below is my code, but required field validator is not firing. I am adding control in page_init. Anybody through some light why this code is not functioning. same piece of code is working when I am adding single control. and when I am trying to add multirow control its not working.</p> <pre><code>ctrls.Add(New LiteralControl("&lt;br /&gt;")) ctrls.Add(CreateRequiredFieldValidatorMR(StrControlID.ToString, "Required field.")) Private Function CreateRequiredFieldValidatorMR(ByVal strControlID As String, ByVal ErrorMessage As String) As RequiredFieldValidator Return CreateRequiredFieldValidatorMR(strControlID, ErrorMessage, String.Empty) End Function Private Function CreateRequiredFieldValidatorMR(ByVal strControlID As String, ByVal ErrorMessage As String, ByVal InitialValue As String) As RequiredFieldValidator Dim rfv As New RequiredFieldValidator rfv.ID = "ReqVal_" &amp; strControlID rfv.ControlToValidate = strControlID rfv.Display = ValidatorDisplay.Dynamic rfv.ErrorMessage = ErrorMessage rfv.InitialValue = InitialValue rfv.ValidationGroup = "ReqGrp_" + strControlID rfv.ForeColor = Drawing.Color.Red rfv.Font.Bold = True Return rfv End Function </code></pre>
asp.net
[9]
2,941,675
2,941,676
view.invalidate not working
<p>I have a <code>PuzzleView</code> class which extends View and refers it in xml in main class. It is shown in emulator without any error. But the invalidate function in PuzzleView is not working. That is the main class xml that contains view doesn't refresh. But it will be worked when directly using setContentView(PuzzleView) in main class. I know what is wrong when using xml. Please help me.</p> <p>I also used </p> <pre><code>ViewGroup vg = (ViewGroup) findViewById(R.layout.game); vg.invalidate(); </code></pre> <p>in PuzzleView class. But it throws null pointer exception.</p>
android
[4]
2,112,042
2,112,043
form confirm before submit
<p>I am using a simple form and I want to allow the user to confirm before the form submits... I know this would be easy using jQuery, but I am a bit confused about code...</p> <pre><code>$(function() { $(".testform").submit(function() { $('.submitbtn').text('confirm'); }); }); </code></pre> <p>I know that the above code is not complete and I would like your help to finish it, so it would give an alert (using jQuery alert) that says 'Please confirm if everything is correct' and changes the text on the submit button to "confirm" instead of "submit". If the user clicks confirm again it would submit the form. I hope this makes sense. thanks.</p>
jquery
[5]
2,916,689
2,916,690
Is there anything like jQuery selectors for Python objects?
<p>Selectors, like jQuery selectors, CSS selectors, and XPATH are cool.</p> <p><strong>Question</strong> Has anyone written something like it for Python objects which are expressed as nested primitives (lists, dicts, tuples, etc.)?</p> <p>(Note: If such objects need be acyclic, I wouldn't consider that too extreme a limitation for most cases.)</p> <p><strong>Simple example</strong> If we had data like,</p> <pre><code>x = [ {'xyz': 3}, {'xyz': 4} ] </code></pre> <p>then, it'd be nice if one could write something like <code>sel("[].xyz", x)</code> and get back (perhaps a reference to) <code>[3, 4]</code>.</p> <p><strong>Second simple example</strong> If we had data like,</p> <pre><code>x = [{'a': {'b': [1, 2]}}] </code></pre> <p>Then, perhaps we could write something like <code>sel("[].a.b[]", x)</code> and get <code>[1, 2]</code>.</p>
python
[7]
2,516,762
2,516,763
Android App client method not able to connect to server
<p>I am new to java and android app programming, in my android app I have a client method:</p> <pre><code>using the socket programming example in http://edn.embarcadero.com/article/31995 </code></pre> <p>I invoke this method by calling it on a button click in my app by </p> <pre><code>public void stopClick (View view){ client(); } </code></pre> <p>I run server program (seperate project, code in the same link as mentioned above) as a java application and then run the app on android emulator but nothing happens between client and server and no error is thrown. when i put this client code in a java class and make the method as main method and run it it runs fine with server. i dont know what i am missing. please help.server code is below.</p>
android
[4]
4,088,694
4,088,695
Initialize MediaScanner at Beginning of Android Program
<p>I have an Android program that starts off by loading some of the user's media. Occasionally the program crashes -- both on an emulator and on an actual phone. I've found this is because sometimes media only become available to the program after the activity has been running for a while. </p> <p>When this happens, here is the order of the typical log output:</p> <ol> <li>DEBUG/MediaScanner(166): opendir /system/media/ failed, errno: 2 &lt;--PROGRAM ERROR HERE</li> <li>DEBUG/MediaScannerService(166): done scanning volume internal</li> <li>DEBUG/MediaScannerService(166): start scanning volume external</li> <li>VERBOSE/MediaProvider(166): /sdcard volume ID: 45454545</li> <li>VERBOSE/MediaProvider(166): Attached volume: external</li> <li>DEBUG/MediaScannerService(166): done scanning volume external &lt;-- THIS IS IN MIDDLE OF PROGRAM</li> </ol> <p>The program has an error at #1 because it tried to load media that wasn't available until #6.</p> <p>Is there any way to force Android to finish the MediaScannerService at the beginning of the program?</p> <p>Alternatively, is there any way to check when the MediaScannerService has finished scanning?</p> <p>Thank you.</p>
android
[4]
3,759,936
3,759,937
Android Widget/EditText for telephone number and email?
<p>I need to capture a telephone number and email in an android activity. What is the best widget type to use for this? EditText? I would also like to indicate visually that the entry box is for telephone without needing the extra TextView saying telephone number if possible. Also what type of validation is best for this. Thanks</p>
android
[4]
1,178,564
1,178,565
C++ Conventions: this pointer
<p>I am curious to know, is there a convention to the usage of this-> in C++? I generally like to use this-> to emphasize that a method and/or variable is a member of the containing class, but it does look rather unappealing, visually speaking. It'd also be awesome to know about any other C++ coding conventions often seen in industry, e.g. Camel case vs. underscores, etc.</p> <p>Thanks!</p>
c++
[6]
3,320,318
3,320,319
Remove the Selection of text in textBox in C#
<p>I have a textbox.In that I have to allow the user to type some thing in that textbox and i also restrict the user not to select the typed text in that textbox.I have need not to allow the white space at the start of the text box and also i have need not allow the user to type more that 32 characters.Thsi is my code.</p> <pre><code> private void txtApplication_Title_KeyPress(object sender, KeyPressEventArgs e) { txtApplication_Title.Text = txtApplication_Title.Text.Remove(txtApplication_Title.SelectionStart, txtApplication_Title.SelectionLength); if (txtApplication_Title.Text.Length== 0) { e.Handled = (e.KeyChar == (char)Keys.Space); } int count_charac = txtApplication_Title.Text.Length + 1 ; if (count_charac &gt; 32) { lblApplication_name.Text = data_variables.RES_TXT_STRING_EXCEEDING_APPLICATION_NAME; timer1.Interval = 7000; timer1.Enabled = true; timer1.Tick += new System.EventHandler(OnTimerEvent_Application_name); } } public void OnTimerEvent_Application_name(object sender, EventArgs e) { lblApplication_name.Text = " "; timer1.Dispose(); } </code></pre> <p>Here in this code.I am able to restrict the user to 32 characters.And i try to press space at the start it does not allow me.It allows the selection of text using Shift+Arrow key. I do know how to block the selection.Another thing is suppose I try Hello and I select Hell and pressing the space directly it starts allowing the space in the text box.Can any one help me.Thanks in advance</p>
c#
[0]
1,470,455
1,470,456
How to replace LSB of a byte with a LSB of another byte
<p>How to replace LSB of a byte with a LSB of another byte in c#.</p> <p>Something like this </p> <p>byte1 - 0 1 1 1 1 1 1 1</p> <p>byte2 - 0 0 1 1 1 0 0 0</p> <p>Now i want lsb of byte1 i.e "1" to be replaced by lsb of byte2 i.e "0" . So my final byte should be like this : </p> <p>byte3 - 0 1 1 1 1 1 1 0 </p>
c#
[0]
2,276,108
2,276,109
Converting SQL datetime into seperate vars
<p>I've been working on a blog commenting system and have been inserting the datetime with NOW(), and I can't quite manage to pull it back into manageable variables,</p> <p>I've tried using strtotime like following</p> <pre><code>$date_time1 = strtotime( $row['chron']); echo $date_time1; </code></pre> <p>also with mktime</p> <pre><code>$timeywimey = mktime ( $row['chron'] ); </code></pre> <p>both of these are turning 2011-03-24 12:01:59 into 1300964519</p> <p>if possible I would be looking to split these down into yy,mm,,dd hh,mm</p> <p>Thanks</p>
php
[2]
5,964,743
5,964,744
how to use a new class method in other apps?
<p>I used this code in c++ to use a class (that I defined before)in my other Apps.</p> <pre><code>#include class_name ; </code></pre> <p>How can I define a public class that could be used in all apps? Thanks</p>
c#
[0]
1,678,740
1,678,741
Adding fisheye plug-in fails to animate() on mouseleave
<p>Here is a weird one.</p> <p>I have an auto-hiding toolbar, which worked perfectly, until I added plug-in called FishEye (aka Interface elements). I did not even use it, I just added it.</p> <p>With that plug-in loaded, my toolbar fails to animate on mouseleave.</p> <p><a href="http://jsfiddle.net/wYmvk/" rel="nofollow">http://jsfiddle.net/wYmvk/</a> (once you remove eval() with that plug-in - things are back to normal)</p> <p>I really need this plug-in and don't wanna loose my toolbar. =)</p> <p>Please help resolving. Thanks.</p>
jquery
[5]
4,360,105
4,360,106
Determine the "offending" file and line number when error occurs
<p>This is a bit hard to explain but the code might be clearer:</p> <pre><code>// class.php class Foo { public function bar () { } } // test.php $foo = new Foo; $foo-&gt;bar(); // e.g., for some reason this returns an error hence error handler will be triggered </code></pre> <p>This is a simplified example but the nesting of test.php could be deeper. How can my custom error handler tell me that the error occurred in test.php line 2?</p> <p>I am currently using <code>debug_backtrace()</code> but the array index of test.php is varying depending on how deep the object is or how many <code>require()</code>'s</p> <p>Is there a way to pinpoint this regardless of how deep the nesting of the function call is?</p>
php
[2]
2,109,188
2,109,189
how to select all table rows
<p>I have a table which contain more than 700 rows which its data shown in a grid and in a different pages so that each page include 20 rows. I need a button in the first page so that whenever it click all 700 rows select. There is a check box in each row and I wanna they checked all when user click the button. For handle it I put a button in page so that when user click it all rows check.</p> <pre><code>$("#selectallboxes").click ( function () { $('#userTable input[type=checkbox]').attr('checked', 'checked'); }) </code></pre> <p>HTML code:</p> <pre><code>&lt;input type='button' value='select all rows' id='selectallboxes' name='selectallboxes' /&gt; </code></pre>
jquery
[5]
110,618
110,619
Latin Square backtracking printing ALL combinations
<p>I have problem figuring out how to print all <a href="http://en.wikipedia.org/wiki/Latin_square" rel="nofollow">Latin Squares</a> using backtracking algorithm. I probably could use some for loops to print one of the the combinations like if matrix is 3x3 then:</p> <p>if 1 on the upper left corner, so using loop </p> <pre><code>1 2 3 2 3 1 3 1 2 </code></pre> <p>but the problem is how to print all of the permutations like</p> <pre><code>1 2 3 3 1 2 2 3 1 </code></pre> <p>etc.</p> <p>any suggestions?</p>
python
[7]
3,750,887
3,750,888
How can I place two controls in the same place and alternate between them?
<p>I want to place two datalist controls at the same (x,y) position. When the first is visible, second should be invisible.</p> <p>How would I go about implementing this?</p>
asp.net
[9]
4,188,552
4,188,553
how do you access anchor inside of tab
<p>We have an unordered list and on a click event we need to access a particular anchor inside of a tab. There are 7-8 anchors inside of the tab. </p> <pre><code>var $tabs = $('#tabbed-content').tabs(); // first tab selected $('.a-credit').click(function() { // bind click event to link $tabs.tabs('select', 1); // switch to 2nd tab return false; }); &lt;div id="tabbed-content"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#deadlines"&gt;Payment Deadlines&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#methods"&gt;Payment Methods&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#installments"&gt;Pay In Installments&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="methods"&gt; &lt;p&gt;&lt;a name="1"&gt;&lt;/a&gt;Content 1&lt;/p&gt; &lt;p&gt;&lt;a name="2"&gt;&lt;/a&gt;Content 2&lt;/p&gt; &lt;p&gt;&lt;a name="3"&gt;&lt;/a&gt;Content 3&lt;/p&gt; &lt;/div&gt; </code></pre> <p>If you click on an unordered list link, it should activate tab #2 and scroll to the a name. is that possible?</p>
jquery
[5]
3,393,474
3,393,475
jQuery: user 'hovercard' on link mouseover
<p>Currently, when you mouseover specific anchor tags, a 'hovercard' element is faded in containing information about that user along with some links. The hovercard is prepended to the body, and positioned absolute after calculating the offset of the hovered link. This gives it the appearance of "pointing" to the hovered link.</p> <p>Anyway, I want the hovercard to fade out when the hovered anchor tag OR the hovercard itself is "moused out." So the question is how to allow one's cursor to move from the original hovered anchor TO the hovercard, and only fading it out if the cursor steps outside those two elements?</p> <p>Here's my current JS, which removes the hovercard when you hover off of the original anchor tag.</p> <pre><code>$('a.show_card').hoverIntent({ over: function() { var link_offset = $(this).offset(); var top = link_offset.top; var left = link_offset.left + $(this).width(); var styles = { 'top': top + 'px', 'left': left + 'px' } $('&lt;div id="hovercard"&gt;hi there&lt;/div&gt;').hide().css(styles).prependTo('body').fadeIn(); }, timeout: 1000, out: function() { // hide card $('#hovercard').fadeOut(function() { $(this).remove(); }); } }); </code></pre>
jquery
[5]
4,213,130
4,213,131
Using :contains to find a particular td element
<p>I have the following rendered html:</p> <pre><code>&lt;table width="420" cellspacing="0" cellpadding="3" border="0"&gt; &lt;tbody&gt; &lt;tr&gt;&lt;td&gt;....&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Total Amount Due:&lt;/td&gt; &lt;td&gt;$168.88&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>My final goal is to obtain and change the value shown after Total Amount Due. I have started by trying to select the element containing the text "Total Amount Due:".</p> <p>Here is my code attempting this:</p> <pre><code>var tdElement = $("td:contains('Total Amount Due:')"); alert($(tdElement).text()); </code></pre> <p>I have tried changing the syntax a bit in the command line of Firebug, but when I do I always end up receiving an error in the first line. With the code like this, I do not receive an error until the second line where I get a TypeError: $(tdElement) is null.</p> <p>Also, not sure if this affects anything but this table is actually within two other tables.</p>
jquery
[5]
5,857,427
5,857,428
How we can interact with the iphone scheduler through code?
<p>is there any way via which we can interact to iphone scheduler and insert and delete data through any iphone application. And produce alerts on that particular time.A user will insert data in the scheduler through the iphone app and user will get notify on that particular time .</p> <p>Thanks Balraj</p>
iphone
[8]
2,065,485
2,065,486
Is it necessary temporary variable when allocating ivar used only in that class?
<p>If ivar is used by other classes, I use @property (noatomic, retain) and @synthesize. And I add it to the view like this. label is ivar.</p> <pre><code>UILabel *aLabel = [UILabel alloc] initWithFrame:frame]; self.label = aLabel; [aLabel release]; [self.view addSubview:label]; </code></pre> <p>But if it is not used by other classes, I do not use @property and @synthesize. And I add it to the view like this.</p> <pre><code>label = [UILabel alloc] initWithFrame:frame]; [self.view addSubview:label]; </code></pre> <p>Am I right?</p>
iphone
[8]
87,655
87,656
scale animation android
<p>hello i saw this code that make a scale animation for a list view </p> <pre><code>public class ViewAnimation extends Animation { float centerX, centerY; public ViewAnimation3(){} @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); centerX = width/2.0f; centerY = height/2.0f; setDuration(2500); setFillAfter(true); setInterpolator(new LinearInterpolator()); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { final Matrix matrix = t.getMatrix(); matrix.setScale(interpolatedTime, interpolatedTime); matrix.preTranslate(-centerX, -centerY); matrix.postTranslate(centerX, centerY); } } </code></pre> <p>i know that this will make the animation from the center of the Activity not from the top-left point but i don't understand where is these points are( -centerX,-centerY) and respect to what to the animation top-left corner or view !! </p>
android
[4]
2,921,205
2,921,206
Passing a hidden variable into a link
<p>I have this question please. I have a link which once clicked gets the user to another URL outside my domain. that url gives the user the possibility to win a price, let's say , it's like this:</p> <pre><code>www.outsideurl.com/users_phone_number-winning_message.php </code></pre> <p>How can i make possible for this not to happen? I mean, i cannot controll the url of the outside URL, but, how can i send a link without the user being redirected there?</p> <p>Because, i am a user, and once i have the link, i can submit it more than 100 and win 100 prices.</p> <p>is there any way to hide the url, or anything like this.. Thanks...</p>
php
[2]
1,131,724
1,131,725
IP address will not connect to same IP address
<p>EDIT: This question was written by someone else in my project group. It's not very well worded, or informative, so if you've stumbled here by some accident let me know if you need any clarification etc.</p> <p>The server sends the IP address through a message to the client. Our client then reads the message and displays the IP address by reading it. I have it where it gathers the right numbers, but does not connect when back to the sent IP address. Any idea why it won't connect even with the same address? The code is given below:</p> <pre><code>byte IPAddr[] = Arrays.copyOfRange(message, 3, 7); //and that is equal to "0.0.0.1" try { InetAddress IP = InetAddress.getByAddress(IPAddr); Socket clientSocket = new Socket(IP, returnPort); System.out.println("Connected!"); } </code></pre>
java
[1]
266,326
266,327
for loop executing only one time in python
<p>I am fetching data from mysql and running each of them in loop but its going only one time.</p> <pre><code>for row in cur.fetchall() : print row[1] URL2="https://www.googleapis.com/customsearch/v1?key=gfdgfdgdfgdfg4&amp; cx=013036536707430787589:_pqjad5hr1a&amp;q="+row[1]+"&amp;alt=json" googleResponse = urllib.urlopen(URL2); jsonResponse = json.loads(googleResponse.read()) print jsonResponse['items'][0]['link'] </code></pre> <p>"It is only printing json of last record"</p>
python
[7]
1,081,969
1,081,970
Unable to use Http put method to send data to an URL
<p>I unable to use put method to send data to particular link.. Please find below the code.Let me know if i have to make any change</p> <pre><code>public class test { private static String url = "http://semldvw0728.google.net/.svc/web/testrequests/"; private static String urlconnection; public static void main(String[] args) throws IOException { StringBuffer xmlString = new StringBuffer(); xmlString.append("&lt;TestRequest&gt;"); xmlString.append("&lt;DateRequested&gt;2011-12-20&lt;/DateRequested&gt;"); xmlString.append("&lt;DemCapID&gt;893467&lt;/DemCapID&gt;"); xmlString.append("&lt;DemCapVersion&gt;1&lt;/DemCapVersion&gt;"); xmlString.append("&lt;IBIS_ID&gt;13530&lt;/IBIS_ID&gt;"); xmlString.append("&lt;ProjectName&gt;LTS&lt;/ProjectName&gt;"); xmlString.append("&lt;RequestedBy&gt;ktmq331&lt;/RequestedBy&gt;"); xmlString.append("&lt;SampleNumber&gt;SN1033645061&lt;/SampleNumber&gt;"); xmlString.append("&lt;Status&gt;Sample Ordered&lt;/Status&gt;"); xmlString.append("&lt;/TestRequest&gt;"); System.out.println("xmlString :" + xmlString.toString()); url = url + 893467; System.out.println("URL : " + url); try { System.out.println("URL : " + url); HttpClient client = new HttpClient(); PutMethod putMethod = new PutMethod(url); client.setConnectionTimeout(8000); putMethod.setRequestBody(xmlString.toString()); System.out.println("statusLine&gt;&gt;&gt;" + putMethod.getStatusLine()); System.out.println("statusLine&gt;&gt;&gt;"+ putMethod.getResponseBodyAsString()); putMethod.releaseConnection(); } catch (Exception e) { e.printStackTrace(); } } </code></pre>
java
[1]
1,579,800
1,579,801
Removing hashmap key from an object
<pre><code>HashMap&lt;String, String&gt; user= new HashMap&lt;String, String&gt;(); user.put("userID","1"); user.put("useValue", "false"); </code></pre> <p>I have a hashMap with these <code>keys</code> and <code>values</code>.</p> <pre><code>Patient filterList = new Patient(); filterList.setUser(user); </code></pre> <p>Now i create another instance of Patient Class. </p> <pre><code>Patient addRequest = new Patient(); user.remove("useValue"); addRequest.setUser(user); </code></pre> <p>Why is that it gets removed from both the objects?. Though i am removing the key only after the filterList object is formed completely. </p>
java
[1]
4,256,425
4,256,426
Mechanism for If-statements with str in python
<p>Can I be sure that <code>''</code> always will be considered <code>False</code> while anything else isn't?</p> <pre><code>&gt;&gt;&gt; if '': ... print('bah') ... &gt;&gt;&gt; if 'x': ... print('bah') ... bah </code></pre> <p>Why or why not? <strong>What mechanism in Python defines this behavior?</strong></p> <p>If <code>''</code> is evaluated as <code>False</code>, why do I get this result:</p> <pre><code>&gt;&gt;&gt; if '' == False: ... print('bah') ... &gt;&gt;&gt; </code></pre>
python
[7]
2,744,925
2,744,926
C++: Initialization Order for Member Classes
<p>In the following code, when the ctor of X is called will the ctor of A or B be called first? Does the order in which they are placed in the body of the class control this? If somebody can provide a snippet of text from the C++ standard that talks about this issue, that would be perfect.</p> <pre><code>class A; class B; class X { private: A a; B b; } </code></pre>
c++
[6]
4,809,118
4,809,119
How to bring application to front quickly by a customed widget on homepage?
<pre><code> Intent intent = getPackageManager().getLaunchIntentForPackage( "com.*****.g3android"); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); startActivity(intent); </code></pre> <p>My problem is that when i click home button, application restart but only after 3-4 seconds.. but click launcher icon to start myapp is very fast. How can i fix? Thanks! b</p>
android
[4]
4,788,546
4,788,547
Delete multiple images using php
<p>Hi Could you please help, I'm building a website using php (my first time please be gentle) within the site I upload an image tohe server, to a file called inventory_images, on it's way itgets resized, so I end up with two images img01.jpg and resized_img01.jpg I use the small one for the frontend to speed loading, the large one I use for when the viewer wishes to see the full sized imaged.</p> <p>I use the code below,</p> <pre><code>// unlink the image from server // Remove The Pic ------------------------------------------- $pictodelete = ("../inventory_images/$id_to_delete.jpg"); if (file_exists($pictodelete)) { unlink($pictodelete); } header("location: inventory_list.php"); exit(); </code></pre> <p>to remove the image from the inventory image file, how can I get the delete to also take out the resized file, so both are deleted.</p>
php
[2]
999,473
999,474
What's a suitable html parser for Android?
<p>What's a suitable html parser for Android?</p>
android
[4]
4,157,257
4,157,258
Livequery in asp.net
<p>I'm using this CDN</p> <pre><code> &lt;script src="http://github.com/brandonaaron/livequery/raw/master/jquery.livequery.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>But the LiveQuery Option is not popping out..?</p> <p>Thanks...I'm getting LiveQuery Option NOw. But my actaul issue was: The Change option in the LIVE Method is not working with IE. So I used the code like this..</p> <pre><code>$('#&lt;%=Combobox1.ClientID%&gt;').livequery("change", function () { ShowLoadingPanel();}); </code></pre> <p>It's not working at all....:-(...I'm working on this issue for 4 days....Any Help would be appreciated...btw I already tried Bind, ON, Delegate Methods with no help....</p>
jquery
[5]
1,050,988
1,050,989
Running an Activity a certain interval before going to sleep
<p>I am currently working on customizing an Android system and would like that, a few minutes before going to sleep, a given Activity is run, with the same premises as the sleep function (e.g. if the user performs any action, its timer gets reset).</p> <p>For instance, let's say that we set its timer to 5 minutes and the device is set to go to sleep after 10 minutes. This means that, as long as there is no user input (or wakelocks acquired etc.), after 5 minutes my Activity is started, and after another 5 minutes the device enters sleep mode (think of it similar to a screensaver).</p> <p>My initial searches have lead me to the PowerManagerService class, where the ACTION_SCREEN_OFF is broadcast, but the general idea of the code there has so far eluded me.</p> <p>Any help would be appreciated. Thank you.</p>
android
[4]
3,216,982
3,216,983
Why don't we have ArrayAdapter's notifyDataSetChanged(row)
<p>When I am doing Swing programming, <code>javax.swing.table.AbstractTableModel</code> is having <code>fireTableCellUpdated(row, col)</code>, to let me specific which row and col of GUI I want to update.</p> <p>However, when comes to <code>ArrayAdapter</code>, I realize they only provide <code>notifyDataSetChanged</code>. I was expecting I am having access to <code>notifyDataSetChanged(row)</code>, to let me update the item I am interested in. I do not want to update the entire list.</p> <p>I was wondering why don't we have ArrayAdapter's notifyDataSetChanged(row). Or, am I missing something?</p>
android
[4]
1,488,032
1,488,033
To find wednesday between to dates given by the user
<p>I need to find wednesday for the two dates given by the user. example: Inputs are: from date:07-Feb-2013 To date:13-feb-2013 The gap between the from date and To date is 7 days always. Expected Output:12-feb-2013</p> <pre><code>public String getAutoDayExpiryDateAndToDate(String instrmentId,String deliveryAutoFromDate) throws SystemException, FunctionalException,ParseException { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date(deliveryAutoFromDate)); Date fromDate=calendar.getTime(); SimpleDateFormat sf1 = new SimpleDateFormat("dd-MMM-yyyy"); String formatedDate = sf1.format(fromDate); calendar.add(Calendar.WEEK_OF_MONTH, 1); calendar.add(Calendar.DAY_OF_WEEK,-1); Date time = calendar.getTime(); SimpleDateFormat sf = new SimpleDateFormat("dd-MMM-yyyy"); String formatedDate1 = sf.format(time); } </code></pre> <p>after these i need to find Wednesday which is present between formatedDate and formatedDate1 .how can i do it??</p>
java
[1]
4,221,106
4,221,107
Remove default group header icon of Expandable listview
<p>I am not able to remove Group header icon of Expandable listview,can anybody tell me how to set it to null in xml.. </p> <p><strong>Update</strong></p> <pre><code>&lt;ExpandableListView android:id="@+id/elist" android:layout_marginTop="1dip" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:fastScrollEnabled="true" android:scrollbarSize="4dip" android:smoothScrollbar="true" android:scrollbars="horizontal" android:groupIndicator="@null" /&gt; </code></pre> <p>and my Group header i am Using following xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:src="@drawable/zimbabwe" android:layout_width="wrap_content" android:layout_marginLeft="10dip"&gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/childname" android:paddingLeft="35dip" android:textSize="16dip" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>but its not working for me</p> <p>My <code>SimpleExpandableListAdapter</code> is:</p> <pre><code>SimpleExpandableListAdapter expListAdapter = new SimpleExpandableListAdapter( this, createBetGroupList("spot"), R.layout.group_row, new String[] { "BetGroup" }, new int[] { R.id.childname }, createBetChildList("spot") , R.layout.child_row, new String[] { "betText","betRate","betID" }, new int[] { R.id.txtBetText, R.id.txtdecRate,R.id.txtstrBetID} ); </code></pre>
android
[4]
1,656,783
1,656,784
Why does GC put objects in finalization queue?
<p>As I understand, garbage collector in c# will put all objects of a class into finalization queue, as soon as I implement destructor of the class. When I was reading documentation for GC.Suppresfinalize, it mentions that object header already has a bit set for calling finalize.</p> <p>I am wondering that why the implementers of GC had to put all objects in a queue, and delay the freeup of memory by 1-2 cycles. Could not they just look at the bit flag while releasing memory, then call finalize of the object and then release memory? </p> <p>No doubt I am an idiot and I not able to understand the working of GC. I am posing this question just to improve my understanding or fill the missing gap in my knowledge</p> <p>EDIT : If the bit flag is for suppressfinalize, GC implementers could have added another flag in object header for this purpose, no?</p>
c#
[0]
2,431,430
2,431,431
Can anyone provide me any resource to learn OpenGL for android?
<p>I am a android application Developer, for future purpose i want to learn OpenGl.Can anyone guide me or suggest me anything.</p>
android
[4]
3,067,048
3,067,049
Efficient means for parsing and replacing values in T-SQL
<p>I have a lot of T-SQL queries I need to parse and replace certain values. </p> <p>A query may look like this</p> <pre><code>SELECT dbo.udfTest(123,'Bob') as Foo </code></pre> <p>or alternatively </p> <pre><code>SELECT dbo.udfTest(123) as Foo </code></pre> <p>My task is to replace the number value with another given value but as I contemplate just rolling something up using the string class and doing substrings etc I start to run into lots of edge cases like this</p> <pre><code>SELECT dbo.udfTest ( 123 ) as Foo </code></pre> <p>or </p> <pre><code>SELECT [dbo].[udfTest]( 123 ) as Foo </code></pre> <p>or</p> <pre><code>SELECT [dbo].[udfTest]( 123 ) as Foo1, dbo.udfTest(123) as Foo2 </code></pre> <p>Throw in any combination of whitespace, casing, brackets, nested parenthesis and you can imagine the number of variations I would have to cover...nasty.</p> <p>Which brings me to wondering if there is a better way? RegEx may be a play but I figured I would toss it out to get some opinions.</p>
c#
[0]
5,100,857
5,100,858
iPhone:External mic support while video recording
<p>I have developed an iPhone application, where user can record the video using device Camera. I used UIImagePickerController for that. I want to allow user to add any external Mic in iphone to record audio while recording the video. It is able to record the video and the audio used from Mic. But, the sound quality is normal, i want to make the audio difference when user uses very effective Mic while recording the video. How do i program to improve and accept the High quality audio when recording video and when user uses effective external Mic's? </p> <pre><code>overlay = [[myOwnCameraOverlay alloc]initWithFrame:CGRectMake(0, 0, 320, 480) :maxDuration]; appDelegate.pickerController = [[UIImagePickerController alloc] init]; appDelegate.pickerController.delegate = self; appDelegate.pickerController.allowsEditing = NO; appDelegate.pickerController.sourceType = UIImagePickerControllerSourceTypeCamera; appDelegate.pickerController.showsCameraControls = NO; appDelegate.pickerController.navigationBarHidden = YES; appDelegate.pickerController.toolbarHidden = YES; appDelegate.pickerController.wantsFullScreenLayout = YES; appDelegate.pickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear; appDelegate.pickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto; appDelegate.pickerController.mediaTypes = [NSArray arrayWithObject:@"public.movie"]; appDelegate.pickerController.delegate = self; [self presentModalViewController:appDelegate.pickerController animated:NO]; appDelegate.pickerController.cameraOverlayView =overlay; </code></pre> <p>Please advise.</p> <p>Thank you!</p>
iphone
[8]
967,420
967,421
Security communication between an internet app and an intranet web service app
<p>I currently have two asp.net web applications, web1 (which is an internet app) and web2 (which is an intranet web service app with windows authentication setting). web1 locates at IIS6 on the DMZ of my company's network. web2 locates at another IIS6 on the intranet. web2 has SSL and a certificate so that the communication between web1 and web2 uses https. What I am going to do is to make extra security setting for web2, only allow web1 as a client to use the web methods from web2. No other clients/users can access web2 (including no accessing through URL). My current idea is to make impersonation for web2 and add code lines to the system.web tag on the web.config file something like this: </p> <p>identity impersonate="true" userName="domain\user" password="password"</p> <p>My questions are: 1) what steps I need to do to achieve the goal described above. Notice that the network domain for web1 is different compared to web2. 2) How to make a client account for web1? I guess I need to add some code either on the Page_Load method or on the web.config file to create an client account for web1. 3) Do I need to do some settings for two web servers?</p> <p>Thank you very much for your help.</p> <p>Stock</p>
asp.net
[9]
131,888
131,889
How to construct a list of grouped item based on another list in python?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5764782/iterate-through-pairs-of-items-in-python-list">iterate through pairs of items in python list</a> </p> </blockquote> <p>I have a list and i want to create another one which will encompasses sequent groups of item of the first one based one sliding-window parameter and the size of each group. i.e if the parameter:</p> <pre><code>a = ["a" ,"b" ,"c" ,"d" ,"e" ,"f"] </code></pre> <p>and sliding-window=1 and size =2 then i want b as:</p> <pre><code>b= [(a,b),(b,c),(c,d),(d,e),(e,f)] </code></pre> <p>the sliding window is for deciding the index of the next tuple.Each time the list would traversed by 1.I.e: If the sliding window was 2 then i would have: b= [(a,b),(c,d),(e,f)]</p> <p>i am looking for a pythonic-way of achieving this.</p>
python
[7]
5,794,410
5,794,411
Asp.net forms authentication support for IE9
<p>My site is running on iis6 in window server 2003.I've used forms authentication here in my site .This is working on ie8 browser but not on ie9.it always redirect me on login page , i am already logged in. </p>
asp.net
[9]
5,039,963
5,039,964
Passing Value Through Link Button in ASP.NET
<p>Conditions : I have two tables, category(id_kat,name_kat) book(id_book,id_kat,name_book)</p> <p>id_kat has a child and parent relations.</p> <p>I'm a little bit confused using ASP.NET, especially when passing value between pages.</p> <p>Now, i'm showing the category's datas with </p> <pre><code>&lt;asp:listview id="listview1" runat="server" datakeynames"id_kat" datasourceID="sdskat"&gt; //FYI sdskat is datasource for category table &lt;itemtemplate&gt; &lt;li&gt; &lt;asp:linkbutton id="linking" runat="server" &gt;&lt;%# Eval("name_kat") %&gt;&lt;/asp:linkbutton&gt; &lt;/li&gt; &lt;/itemtemplate&gt; &lt;/asp:listview&gt; </code></pre> <p>The problem is, i wanted to pass "id_kat" value when i click the hyperlink. (but redirected to self page).</p> <p>I want it as a query string (or another way if able).</p> <p>Thanks a lot.</p>
asp.net
[9]
1,724,078
1,724,079
GConf Error: Failed to contact configuration server
<p>I have got this error while running in server. <strong><em>GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See <a href="http://projects.gnome.org/gconf/" rel="nofollow">http://projects.gnome.org/gconf/</a> for information. (Details - 1: Not running within active session)</em></strong>. How to fix this?</p> <p>Regards</p> <p>Linda</p>
java
[1]
4,669,537
4,669,538
Recompile with -Xlint:unchecked for details
<p>while compiling java program we are getting "Recompile with -Xlint:unchecked for details". Why we are getting this error?</p>
java
[1]