w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Does memcache retain information until flush?
What @hakre wrote in a comment plus you should get how to use cache. Cache is not a date storage, it is a cache. You should never relay on what is there and what is not. Typically you have a limit of a cache size and when it gets full it purges old values. Typical usage case: function get_something() { $Cache = new Memcache; $something = $Cache->get('something'); if ($something === false) { $something = //get from db, prepare or whatever $Cache->set('something', $something); } return $something; } TLDR; no

Categories : PHP

Trying to make a GET variable invisible in an URL but retain its usefulness using mod_write
If you are not passing the "ID" as part of the query string (e.g. ?id=5) or part of the URI (e.g. /preview/about/5) then you need to pass it in the request body, in something like a POST request. Otherwise, you can't make it "invisible", because the webserver isn't going to see it. If the webserver doesn't see it as a request, there is nothing mod_rewrite can possibly do to extract it. Assuming you can't setup your site so that requests get POSTed (sort of like how a form is submitted) everytime someone clicks on a link, you're best bet is probably having it look like the http://www.domainname.com/preview/about/5 form, or maybe http://www.domainname.com/preview/about-5?

Categories : Htaccess

make accordion in jquery will retain open on navigate
One way you could do it is to create a cookie using javascript that stores the open/close state of the accordion. On load of the page you are navigating to, check the value of that cookie and open the accordion as needed. Maybe not the best way, but it should work.

Categories : Jquery

Make JWindow retain focus when children are focused, including another window as child
Before setting the child window visible, add a WindowListener. After you call setVisible on the child window, you'll receive the windowActivated callback. At that point call toFront on your parent window to bring it forward. Given the quirkiness of OS z-order handling, you might need/want to call toBack on the child window first, as well as calling requestFocus on the parent window or one of its focusable children afterward.

Categories : Java

How to make a variable from database information
The following should work: $row=$companyNameRet->fetch_assoc(); $myvariable=$row['company_name']; good luck! For multiple variables, $row will be populated $row['column_name'] for as many column names as you have. It can get quite confusing if you are decrypting or doing anything fancy with functions so it may be worth assigning aliases: SELECT column1 firstcol,column2 secondcol,column3 thirdcol... In this case, $row would have the aliases as keys: $row['firstcol'], $row['secondcol'] etc... Try var_dump($row) to see what you get. It is most educational to do so. You can fetch multiple rows by using: while($row=$companyNameRet->fetch_assoc()) { // $row will contain consecutive rows selected from your db. } W3 Schools provide a decent tutorial on mysqli basics

Categories : PHP

How to make multiple pop up div based on database information?
I thought about this problem diferently than you. So here's my idea. 1st- you don't need multiple divs cuz using jquery & php you can manipulate a single div however you want. 2nd- saying you display your 15 persons 1st makes the job easier. Let's say you store them into some links like the next example and we asume we have an ID, a Name, an Age and a Location: <?php $sql = "SELECT * FROM persons"; $result = mysql_query($sql); while(mysql_fetch_array($result)) { echo '<a hred="#" class="trigger" id=' . $result['id'] . '>' . $result['name'] . '</a><br />'; } Now using AJAX we dispaly the results for hovering any link: $('a').mouseenter(function(e) { var myperson = $(e.target).text(); $.ajax({ url: "details.php?current=" + myperson, success: function(html){ if(h

Categories : Javascript

How to make C++ give detailed exception information just like python does?
You could use the __FILE__ and __LINE__ definitions in your exception message. For example: #include <stdexcept> class Error : public std::runtime_error { public: Error (const std::string &message) : std::runtime_error(message) {} }; int value() { std::stringstream ss; ss << "Issues at " << __FILE__ << " on line " << __LINE__; throw Error(ss.str()); } In this example, I made Error inherit from std::runtime_error (which has a constructor to allow you to pass a message as a string)... Additionally, take a look at this SO question: Global Exception Handling - note the answer about using the set_terminate function. This will allow you to install a global handler that ensures the message is printed as you want. Here's some

Categories : C++

How to make a @Documented annotation retaining generics information?
The Java Language Specification writes: It is a compile-time error if the return type of a method declared in an annotation type is not one of the following: a primitive type, String, Class, any parameterized invocation of Class, an enum type (§8.9), an annotation type, or an array type (§10) whose element type is one of the preceding types. The reason for this restriction is that annotation values are evaluated at compile time, and only the values are stored. Therefore, these values can not be arbitrary objects, because it would be unclear how to store them in the class file, and unmarshall them at runtime. The usual solution is the nested annotation trick: public @interface Needs { Need[] value(); } public @interface Need { String key(); Class value(); } which y

Categories : Java

How do I make a news feed which continuously updates with information from a database using continuous server-side processing?
If you really have to have a continuous feed then take a look at WebSockets. However, you probably only need a polled solution for this, refreshing every few seconds. There's a sample implementation here

Categories : PHP

How can I make a quick edit text link to auto fill form information from a mysql database
Use a string to hold selected number,use the stored value in the string to search for the required row.Use another string to pull the information from the database and use # to split the columns.Save each column to a specific string which you will assign to where the value should be auto filled.

Categories : PHP

VBA to Copy Information From a Folder of Files and Compile Information to a Single Workbook
This is not the full code, but it should help you. When you work with multiple workbooks keep track of them. For example start with: Dim CurrWB As Workbook Set CurrWB = ActiveWorkbook Then in the cycle: Dim WB As Workbook For Each StrFile In var Set WB = Workbooks.Open(loc & StrFile) ... WB.Close Next StrFile Inside the cycle you can find the area to copy doing something like: R1 = 1 Do While WB.Sheets("Sheet name").Cells(R, 2) <> "Starting text" R1 = R1 + 1 Loop R2 = R1 + 1 Do While WB.Sheets("Sheet name").Cells(R2, 2) <> "Ending text" R = R + 1 Loop For R = R1 to R2 CurrWB.Sheets("Report").Cells(RReport, 3) = WB.Sheets("Report").Cells(R, 3) RReport = RReport + 1 Next R

Categories : Excel

Reply mail structure information: how to retrieve sent and received information
There's no standard for the structure of a reply email. It's not usually done using multipart email, it just uses human-readable text, often with > prefixes to denote quoted text. This allows replies to be interspersed inline with the quoted material. The only standard features of replies are a couple of headers: In-Reply-To: <ID> and References: <ID1>, <ID2>, <ID3>, ... In-Reply-To contains the message ID of the message that was replied to. References is a growing list of message IDs -- when you reply, you take the original message's reference list and append the ID of the message being replied to at the end. See RFC 5322 for more details about these headers.

Categories : PHP

how to get the information of about database events and actor information
Look at the MODULE, ACTION and CLIENT_INFO columns of V$SESSION. Then, in the package(s) and/or trigger(s) you suspect are performing the update, call DBMS_APPLICATION_INFO.SET_MODULE and DBMS_APPLICATION_INFO.SET_ACTION: BEGIN DBMS_APPLICATION_INFO.SET_MODULE(trigger_name, 'trigger start'); -- some code... DBMS_APPLICATION_INFO.SET_ACTION('updating employee'); -- code which updates the employee table DBMS_APPLICATION_INFO.SET_ACTION('doing something else'); -- more code... DBMS_APPLICATION_INFO.SET_MODULE(NULL, NULL); END; See also the example provided in the usage notes.

Categories : Oracle

IOS block not retain self?
Blocks retain their captured variables when the block is copied. Since you are using MRC, the compiler does not do anything automatically. You are assigning the block literal directly to the instance variable block1 (not through a property or something), so no copying is done. This is incorrect use of blocks, because any time where you store a block (e.g. in an instance variable) in a place that will out-live the current scope, you must copy it. Block literals are only valid in the scope they are defined in. This is because blocks may start out on the stack, and must be copied to be moved into the heap; otherwise, they are destroyed at the end of the scope. So if you try to use the block pointed to by block1 after this function is done, bad things will probably happen. So if you had used

Categories : IOS

is it ok to retain the delegate?
There is no fundamental problem with retaining (holding a strong reference to) a delegate. It is unusual, but not unprecedented. NSURLConnection does it. It creates a retain loop that can be very useful if correctly managed. It's just up to you to make sure that the object will release its delegate in a deterministic way so that the retain loop is broken. BUT... the specific case that you're discussing here sounds like you have an MVC problem and that your view controller is doing something it shouldn't be. I assign the delegate to that ViewController so even when it is pushed from the view, it stays in the memory so the music player can play next and previous songs. If you're saying that you cannot play music unless a certain view controller is in memory, then the view controller p

Categories : Iphone

How best to retain self for delegate with ARC?
If you simply want to "tie the ownership of classBInstance (self in ClassB) to avcInstance", you can use objective-c object association: #import <objc/runtime.h> objc_setAssociatedObject( avcInstance, "my_association", classBInstance, OBJC_ASSOCIATION_RETAIN ); Furthermore, if you need more convenience for accessing the classBInstance later you could wrap this association code into a category extension that exposes classBInstance as a property on avcInstance.

Categories : IOS

How to retain javascript toogle up and down
You mean something like this? check DEMO http://jsfiddle.net/jYnc7/ JQUERY $(document).ready(function() { $('#show').click(function(){ $('#myTable').slideDown(200); }); $('#hide').click(function(){ $('#myTable').slideUp(200); }); });

Categories : Javascript

Edittext does not retain text
LifeCycle of Activity When you move from one activity to another activity, all values has been deleted which to be assigned. Solution for your question : you have to store value of edittext in shared preference or database.

Categories : Android

How to retain namespaces in xslt?
I don't understand why you want to remove and then restore the namespaces. If you simply copy the child nodes of the c element while transforming it to a o element you are done: <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="c"> <o> <xsl:apply-templates/> </o> </xsl:template> <xsl:template match="a"> <m> <xsl:apply-templates/> </m> </xsl:template> <xsl:template match="b"> <n> <xsl:apply-templates/> </n> </xsl:template>

Categories : Xml

Retain first file for each date
I assume from your question that you only want to keep 5 files across all sub folders, if so the code below will do what you want. If you want to keep 5 files per sub folder then you will to create an outer loop of those folders first and then run the code below for each individual folder. $TargetFolder = "C: est" $AllFiles = Get-Childitem $TargetFolder -Filter *.zip -Recurse | ? { $_.fullname -match "old" -and -not $_.PSIsContainer } $KeepFiles = $AllFiles | Sort-Object LastWriteTime | Group-Object {$_.LastWriteTime.Date} | % {$_.Group[0]} | Sort-Object LastWriteTime -Descending | Select-Object -First 5 Compare-Object -ReferenceObject $AllFiles -DifferenceObject $KeepFiles -PassThru | Remove-Item

Categories : Powershell

stringByAppendingString and retain dilemma
The first one is the only method that gets the memory management correct. The second one leaks two and the third one three NSString instances. If you don't get the string "A1A2A3" from the first method the error is somewhere outside that method. For every retain message you send you also have to send a release or autorelease message in the same method, unless your method name starts with alloc or copy. In that case the caller needs to release the returned object.

Categories : Objective C

Retain NULL in MAX() ORDER BY
Just use a case statement: select seq_no, timestamp, (case when timestamp is not null then max(timestamp) over (partition by seq_no) end) as maxtimestamp from temp

Categories : SQL

How can I shred xml and retain the associations?
Store the XML for Lots in #tmpDetails.Lots SELECT IDENTITY(int, 1,1) AS RowID ,doc.col.value('SalesOrderNumber[1]', 'varchar(50)') SalesOrderNumber ,doc.col.value('ItemId[1]', 'varchar(50)') ItemId ,doc.col.value('IsBackOrdered[1]', 'varchar(50)') IsBackOrdered ,doc.col.value('TrackingNumber[1]', 'varchar(50)') TrackingNumber ,doc.col.query('Lots') Lots INTO #tmpDetails FROM @xml.nodes('/ShipmentConfirmationMessage/ShippedItems/ShipmentConfirmationLine') doc(col) Use #tmpDetails in your third query with a CROSS APPLY to shred the XML in Lots. SELECT D.RowID ,doc.col.value('LotNumber[1]', 'varchar(50)') LotNumber ,doc.col.value('ExpiryDate[1]', 'datetime') ExpiryDate ,doc.col.value('Quantity[1]', 'decimal(13,5)') Quantity FROM #tmpDetails D CROSS APPLY D.Lots.nodes('Lots/L

Categories : Sql Server

CSV retain CRLF while replacing LF
You can use a Scanner with a delimiter of . Using jlordo's technique to get rid of the LF, you write the content to some OutputStream one line at a time. This way you never have the whole 2GB+ file in memory public static void main(String[] args) throws Exception { File file = new File("C:\Users\Soto\Downloads\person.xml"); Scanner scanner = new Scanner(new FileInputStream(file)); String lineSeparator = System.getProperty("line.separator"); // Assuming you are on Windows, otherwise set it to scanner.useDelimiter(lineSeparator); ByteArrayOutputStream out = new ByteArrayOutputStream(); // would be a real outputstream, like FileOutputStream char LF = 0xA; while (scanner.hasNext()) { // looks up to the next delimiter String line = scanner.next();

Categories : Java

Retain several mp3 sounds using AVPlayer
In general, you cannot play 2 sounds at the same time on an iPhone if the files are both MP3 or AAC encoded, because there is only one hardware path for real time decoding of these compressed formats. You can play multiple files that are already decompressed, so one thing you can do is simply read the AAC or MP3 file ahead of time and save it as an uncompressed .caf. You will need to be careful to manage your disk space, but that is just the price to be paid.

Categories : Iphone

retain value after validation failed
//You can try this this will reset your select box values also <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#Rank').bind('change', function() { var elements = $('div.container').children().hide(); // hide all the elements var value = $(this).val(); if (value.length) { // if somethings' selected elements.filter('.' + value).show(); // show the ones we want $('div.container div').children().each(function(){ $.each(this.attributes, function(i, attrib){ if(attrib.name != value) { $('#'+value).prop('selectedInde

Categories : Jquery

How to retain a text in textfield
The page is not refreshed, so that's not the problem. The problem is that you are using .innerHTML += to add the new elements. This is will destroy and recreate the existing elements: The elements are serialized to HTML, then you are concatenating the string to add new HTML and after the assignment the browser has to parse the HTML to create DOM Elements again. In this process all data will be lost. Use DOM manipulation methods instead. I.e. create the elements with document.createElement and add them with Node.appendChild. Using .innerHTML to override existing content or to initialize an element for the first time is OK. But using it to add elements to an existing element can lead to problems (as mentioned above) so it is better avoided in this case. Example: function addInput() {

Categories : Javascript

Global variable does not retain value
$.ajax queues a request to the web server and returns immediately. Therefore, the bottom alert runs before the data is ready. When the data is ready, the success function is run, and the data appears. You should do any processing of the data in the success function, or by calling from the success function. See How to return the response from an AJAX call? for confirmation and additional discussion.

Categories : Jquery

No retain in instance variables
He means that: The _object instance variable does not automatically retain its value under manual reference counting but does under ARC. Simple as that. If this works under MRC, it works for one reason: [SomeClass new] is equivalent to [[SomeClass alloc] init] so_object will have a reference count of one no matter what.

Categories : Objective C

Why it's recommended not to retain fragment with UI?
Here you are retaining references to the old activity's mLogin, mPassword and ImageView views, but they are overwritten right after rotation, as onCreateView() will be called, so if your activity is the front activity and a configuration change happens you should be fine. You might run into memory leaks when if your activity isnt the front activity, though, and in general you can't know how your fragment is handled. For example the ViewPager has 2 different adapters, one (http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html) is retaining the Fragment instances (just calling onDestroyView()), while the other (FragmentStatePagerAdapter) is destroying the fragment instances. So, your fragment would leak significant memory if used from a FragmentPagerAdap

Categories : Android

How to retain selected item of ddl in php?
I don't know what your DDL name attribute is, so I'll pretend <select name="ddl"­> Here's what you code should look like: echo"<option> Select Day</option>"; for ($i = 1; $i <= 31; $i++) { if(isset($_POST['ddl']) && $_POST['ddl'] == $i) $select = " checked='checked'"; else $select = ""; if($i<10){ echo "<option " . $select . ">".str_pad($i,2,"0",STR_PAD_LEFT)."</option>"; } else{ echo "<option " . $select . ">".$i."</option>"; } } ?> This is a base example, you should take measure to protect your code against injection.

Categories : PHP

VBA/MS SQL equivalent to SAS Retain function
First, retain in SAS is not a function, it's a statement. Second, the idea behind it - to persist the value of a variable across iterations of the implicit loop in a SAS data step - only makes sense as a statement in that context. You can achieve the same end in a variety of languages in a variety of ways. Pretty much all languages enable you to explicitly create a loop and iterate through rows of data, and pretty much all languages allow you to store a variable's value alongside this loop and retrieve it and conditionally change it. In VBA this is pretty rudimentary: you would declare a variable, assign it a value and reference it however and whenever you want throughout code that loops through data. In SQL, you're dealing in sets, so there is no real equivalent to retain because you'r

Categories : Vba

Retain values in jquery
You must validate the dropdowns clientside. PHP is serverside and only validate after posting it to the server. This happens after you click "submit". Show us your code ;) Prevent the submit with: $('#form_id').submit(function(e) { e.preventDefault(); // or //return false; })

Categories : PHP

What are the cases to use retain/release having ARC enabled
You will never need to use retain/release/autorelease. Having ARC enabled, frees you from writing memory management code, unless you're working with Core Foundation - ARC doesn't care about Core Foundation objects. But, you can let ARC release CF objects for you with a __bridge_transfer cast (or CFBridgingRelease). If you get it from a Cocoa or Cocoa Touch function or method, it's in Objective-C-land and therefore managed by ARC. You can transfer it to the CF world with a __bridge_retained cast (or CFBridgingRetain), after which you'll have to CFRelease it (or transfer it back to ARC). And yes, as long as the classes are compiled without ARC (which you can control on a file by file basis; go to Build Phases and add -fno-objc-arc as a flag to any file that should be compiled in an otherwise

Categories : IOS

How to retain date and time in a variable?
Hopefully I'm understanding you question correctly. If you mean to simply get the data that the user set using the TimePicker, you can simply use the built in methods such as tp.getCurrentHour() or tp.getCurrentMinute(). There's a full list of the methods you can use on the TimePicker in the Android documentation found here. As for setting that data into an EditText, you just need to edittxt.setText(yourVariableHere). In this particular situation you may want to consider making your TimePicker accessible from the rest of the class such as making it a private instance variable in the Activity. That way you can set the EditText to whatever you want from the TimePicker.

Categories : C#

Retain the cursor position in QTextEdit
On your slot: If num of chars exceeds maximum: Ask the QTextEdit for the Cursor: QTextCursor QTextEdit::textCursor() const Set the return value as your textEdit cursor (cause it returns a copy). From doc: Returns a copy of the QTextCursor that represents the currently visible cursor. Note that > changes on the returned cursor do not affect QTextEdit's cursor; use setTextCursor() to > update the visible cursor. void QTextEdit::setTextCursor(const QTextCursor & cursor) Ask the cursor to delete last char void QTextCursor::deletePreviousChar() (Edit)as code: QTextCursor cursor = ui->textEdit->textCursor(); ui->textEdit->setTextCursor( cursor ); cursor.deletePreviousChar();

Categories : C++

iOS block release and self retain cycle
The problem is that using retainCount to figure out things like this is futile. The retainCount will not reflect autorelease state and the compiler -- the ARC compiler, in particular -- may generate different code (in particular, the optimizer has a tendency to eliminate unnecessary retain/autorelease pairs). Use the Allocations Instrument and turn on reference event tracking. Then you can look at each retain/release event on the object, the exact stack trace where it happened, and know exactly what is going on. Under non-ARC, when you assign to an iVar, nothing happens. When you go through the setter, a retain setter will cause the object to be retaind. Under ARC, a block will be copied to the heap automatically in a number of cases, triggering a retain of the captured object when

Categories : Objective C

Capistrano: retain cached files
I'd love to be able to say I'd figured this out but I didn't. I stumbled across this very handy blog post that details exactly how to do this. http://blog.hasmanythrough.com/2008/1/30/segregated-page-cache-storage

Categories : Ruby On Rails

Retain form field details
try this. <input type="text" size="40" name="email" value="<?php echo (isset($_POST['email']) && !empty($_POST['email'])) ? $_POST['email'] : "" ?>" />

Categories : PHP

How to retain the conditional color of bar in highcharts
Try to use point.update which will affect point options, not only actual state/color of that point, see: http://jsfiddle.net/NWmKL/3/

Categories : Highcharts



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.