w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Should the FUSE getattr operation always be serialised?
I signed up to the FUSE mailing list, posted my question and recently got the following response from Miklos Szeredi: Lookup (i.e. first finding the file associated with a name) is serialized per directory. This is in the VFS (the common filesystem part in the kernel), so basically any filesystem is susceptible to this issue, not just fuse. Many thanks to Miklos for his help. For the full thread see http://fuse.996288.n3.nabble.com/GetAttr-calls-being-serialised-td11741.html. I had also noticed that the serialisation was per-directory, i.e. the above effect would be seen if both files were in the same directory, but not if they were in separate directories. For my application this mitigation is enough for me, the clients to my filesystem do use directories so, while I mi

Categories : C++

Get serialised size of List without having OutOfMemoryException
If what you need is only the length: class NulStream : Stream { public override bool CanRead { get { return false; } } public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return true; } } public override void Flush() { } protected long length; public override long Length { get { return this.length; } } public override long Position { get { return this.length; } set { throw new NotSupportedException(); } } public override int Read(byte[] buffer, int offset, int count) { throw new NotSupportedException(); } public override long Seek(long off

Categories : C#

If JNDI can be serialised to the local JVM, why we need RMI to call method?
JNDI is a look-up and directory service. It provides a standardized way to acquire resources by name within some context. Usually it used for acquiring shared resources from an application-server context, but depending on implementation, it can also provide for looking up items in a standardized way that represent remote resources. RMI is a remote method invocation technology built-in to the Java platform. It allows for calling remote java object methods over a binary protocol. It uses Java's built-in serialization handling to make the remote invocation and parameter passing over the network seem transparent. RMI requires it's own directory/look-up service that or might not be integrated with a given JNDI implementation. (Usually they are not integrated.) So, with all that in mind, hop

Categories : Java

Edit multiple lines of a file locally and then rename multiple times- Linux
You can try something next: LC_ALL=C for i in {1..6} do r=$(printf "%.1f" $i) theta=$(printf "%.1f" $(($i*15)) ) sed "s/theta = 0.0/theta = $theta/;s/r = 1.0/r = $r/;s/visual_1_0/visual_r_theta/" < n2o.inp >n2o_${r}_${theta}.inp done You should don't have spaces between = in the assignment. Calculation (integer only) in bash can be done with $(( expression )) syntax. The printf formats the number as floating point number with one decimal precision, and finally the 'LC_ALL=C' sets the locale to C - so, the printf prints decimal point and not a comma as in many international setting. (if you're has C or us and like, don't need the LC_ALL line). The above script produces from the input file: theta = 0.0 deg r = 1.0 put, molden, visual_1_0 ; the next 6 files theta =

Categories : Linux

Is a Parse query fetching an Object multiple times when referenced by multiple rows?
The include is implemented as a separate query which gets all the objects pointed to by the initial query. So the answer is no, this object is not fetched again by each row that points to it, since all the included objects are fetched at once in a separate query.

Categories : Parse Com

mysql inner join same table and same column multiple times from multiple tables
Yes, the better way to do this for maintenance purposes is to create a view of only the inner joins and querying the view. Remember in terms of performance there would be little by way of improvement but maintenance of the code would become much easier. Given your purpose the inner joins are not entirely avoidable unless you decide to change the structure of the tables

Categories : Mysql

jqGrid loadComplete function gets called multiple times,Also check boxes requires multiple clicks
Usually this means you are binding your event multiple times. It sounds like the button "next" has some code that would resemble $(function () { $('#nextButton').click(function(){loadComplete}) }); In the above example when ever the page is ready the click event gets bound to the function loadComplete. When ever your page is ready, it increase the time the function is going to occur by 1.

Categories : Jquery

Select Single field multiple times with multiple criteria
Try something like this: SELECT Project ,sum(CASE WHEN Activity = 'Shearing' THEN [Surface Area] ELSE 0 END) AS TotalShearing ,sum(CASE WHEN Activity = 'Bending' THEN [Surface Area] ELSE 0 END) AS TotalBending ,sum(CASE WHEN Activity = 'Assembly' THEN [Surface Area] ELSE 0 END) AS TotalAssembly ,sum(CASE WHEN Activity = 'PC' THEN [Surface Area] ELSE 0 END) AS TotalPC ,sum(CASE WHEN Activity = 'Infill' THEN [Surface Area] ELSE 0 END) AS TotalInfill WHERE ([Posting Date] BETWEEN @StartDate AND @EndDate) FROM PLE GROUP BY Project SQLFiddle DEMO

Categories : SQL

Large python JSON post request times out
It seems that the time required for the response is greater than the default timeout. Try giving the timeout in the response, content = httplib2.Http().request( uri="http://%s:%s/json" % (host, port), method='POST', headers=headers, body=json_string , timeout=100 ) (set the time as required) or u can set a socket timeout large enough to bring the response import socket timeout = 100 (set the time as required) socket. setdefaulttimeout(timeout)

Categories : Python

Multiple Clicks on button leads to calling button.setOnClickListener multiple times in Android
Try this @Override public void onClick(View v) { // do database stuff button.setEnabled(false); button.setClickable(false); Log.d("ins", "called"); } Database stuff will be executed only once, the button will only be clicked once, as per your requirements. If you want it to be clickable again, just setEnabled and setClickable to true after your database stuff has finished.

Categories : Android

Same code multiple times in my app
Yes, you can. There is a lot of ways to do it. For example creating class with one public static method. @interface YourClass : NSObject + (int)longCode:(int)x; @end Now you can use your code just like: int y = [YourClass longCode:x];

Categories : IOS

SQL update same row multiple times
From the UPDATE documentation: Use caution when specifying the FROM clause to provide the criteria for the update operation. The results of an UPDATE statement are undefined if the statement includes a FROM clause that is not specified in such a way that only one value is available for each column occurrence that is updated, that is if the UPDATE statement is not deterministic. The results are non deterministic in this cases. Better to consider those SQL statements as errors.

Categories : Sql Server

For Loop- Multiple times C
Why are you doing this line? x= x-1; This causes the loop to iterate roughly half as much as it should. Each iteration, here's the comparison that happens //user enters x=5 for(int i =0; i <x; i++) // i == 0; x == 5; i < x is false for(int i =0; i <x; i++) // i == 1; x == 4; i < x is false for(int i =0; i <x; i++) // i == 2; x == 3; i < x is false for(int i =0; i <x; i++) // i == 2; x == 2; i < x is true, loop terminated! Furthermore you are using doubles, ie double x; but expecting the user to enter integers. While this doesn't lead to the specific bug you're seeing, you'll get better results if you change x to an int.

Categories : C

$.on() performs multiple times. Why?
The code does not magically know you only want to listen for one click on the element and no more. You need to program it so it behaves that way. If you only expect it to be called one time, than you need to remove the code for the click or you can look at jQuery's one()

Categories : Javascript

Run RegisterStartupScript multiple times in c#
Well, Your code should work fine, Just make sure that your info1 and info2 are defined and revise your logic in loadAdditionalInfoDialog. just for test put an alert in it. and also you could make both calls in one block. Update: Here is what i understand you want to do from your comments: In you repeater template add a hidden field <asp:HiddenField ID="hdf" runat="server" /> In your code behind you could try something like this foreach (RepeaterItem item in cdcatalog.Items) { // Put your condition here like if (pr.AdditionalFieldsEnabled == true) in my case to make it simple I'm just using the index if (item.ItemIndex == 1) { //Get the hidden fiels to save your parameters for the next call you can add multi

Categories : C#

.before() firing multiple times
Why not just this $(this).append(firstChild); instead of firstChild.before($(this).find('.image')); Code $('.row').each(function() { var firstChild = $(this).find(':first-child'); if(firstChild.hasClass('text')) { $(this).append(firstChild); } else { console.log("not text"); } }); Check Fiddle

Categories : Jquery

How to use StopWatch multiple times in C#?
Yes, try this: void func1() { Stopwatch sw = new Stopwatch(); sw.Start(); func1(); sw.Stop(); Console.Write(sw.Elapsed); sw.Restart(); func2(); sw.Stop(); Console.Write(sw.Elapsed); }

Categories : C#

How to Cache JSON Objects Into Single File for Faster Page Load Times
To be honest, there is a LOT of different ways to do this. The simplest is to make an assoc array of your data, serialize it and write to the file. $dataArray = array(); // ... $data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '?v=2&alt=json'); $dataArray['jinxed'] = $data; $data = serialize($data); file_put_contents('cache.txt', $data); Than pull it back: $data = unserialize(file_get_contents('cache.txt')); But, as I said, there is a lot of another ways to cache requests. And chosing one of them depends on what else you need from your caching system. UPD: Don't forget that cached info will become outdated sometime, so you must to update your cache every certain period. To not saving any additional values (like cached time) use filemtime()

Categories : PHP

why mysql_query executes multiple times
1..Use header and redirect the page. header("Location:your_page.php"); 2..You can redirect to same page or different page. Unset $_POST after inserting it to Database. unset($_POST);

Categories : PHP

How to read a BufferedReader twice or multiple times?
You can use mark() and reset() or just open the file again. Depending on your use, perhaps you want to store the data in memory? Reference - http://docs.oracle.com/javase/6/docs/api/java/io/BufferedReader.html#reset%28%29

Categories : Java

Expand a div element multiple times
You need to make sure your value does not exceed 3, or nothing will happen on subsequent clicks. Also, you should start with your value equal to 0, not [0]. Here is some simplified code with these ideas incorperated: http://jsfiddle.net/XZ7mW/16/ var hits = 0; $('.kaart-uitklappen').click(function(){ if (hits < 2) $("#header").animate({'height':'+=100px' }, 300); else $("#header").animate({'height':'-=100px' }, 300); hits = (hits + 1) % 4; return false; });

Categories : Javascript

Service getting called multiple times?
I have used this piece of code and it's working fine :) ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (MyService.class.getName().equals(service.service.getClassName())) { found = true; } }

Categories : Android

How to run gherkin scenario multiple times
I'm not sure that this is a "test". It's definitely a script that captures data, but tests also have a condition in them, a value or state that has to be verified. So I would expect to see something more like Given I set something up And I setup something else .... When I run the program Then my startup time should be less than 1 second However, I do understand your desire for a simple consistent way to run this test, and while I think that SpecFlow might not be the best means of achieving what you want, you might want to consider your tests granularity. For example you could rewrite your scenario as Given I ... When I run the program Then my startup time should be less than 1 second When I run the program Then my startup time should be less than 1 second When I run the program Then

Categories : C#

shuffling a list multiple times
A possible solution to your problem is to wrap the values in your two lists in a class. Then add objects of those class to one list and shuffle that, for example: public class Test { public static void main(String[] args) { Random rnd = new Random(); int seed = rnd.nextInt(); rnd.setSeed(seed); List<Pair> pairs = new ArrayList<Pair>(); pairs.add(new Pair(1, "else")); pairs.add(new Pair(2, "bar")); pairs.add(new Pair(3, "pair")); Collections.shuffle(pairs, rnd); for (Pair pair : pairs) { System.out.println(pair.drawable + " " + pair.sequence); } } } class Pair { int drawable; CharSequence sequence; Pair(int drawable, CharSequence sequence) { this.drawabl

Categories : Java

Android notifications multiple times
The second parameter in your PendingIntent.getBroadcast known as the request code needs to be unique for each new alarm, otherwise it will overwrite. It says in the documentation that this requestCode is not currently used. The documentation is wrong. you have PendingIntent pIntent = PendingIntent.getBroadcast(this, 0, _intent, PendingIntent.FLAG_ONE_SHOT); am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisecDiff, pIntent); What you want is PendingIntent pIntent = PendingIntent.getBroadcast(this, SomeUniqueIndex, _intent, PendingIntent.FLAG_ONE_SHOT); am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisecDiff, pIntent);

Categories : Android

RelayCommands get executed multiple times
There are couple of possible things going on here: You're creating multiple viewmodel instances attached to the page and each one is executing the command. Or, more likely: You're not fully accounting for how the SelectionChanged event works. This event can be triggered multiple times when the selection changes. If there is a selected item already, the changed event will fire when that item is removed and then again when the new selected item is added. If you were using the event handler directly you could query the SelectionChangedEventArgs directly to determine what has triggered the event. Your code is ignoring these args though, even though your xaml says you're passing them. If you change your Action so that it supports these args you could add the check there. e.g. ShowTreatmen

Categories : Dotnet

CDN-loaded JS loads multiple times
$.fn.getPage is your problem. You insert the entire HTML document into your current document, which will also insert the <script> tags. Only replace the body: $(data).find('body').children().appendTo(self.find('body').empty());

Categories : Javascript

Render The Same Model Multiple Times
To minimize draw calls and uniforms transfer you can use glDrawArrayInstanced().This way,you submit as many instances of the original object as you wish in a single draw call!Matrices for each instance you can pack into UBO(uniform buffer object) and access those in the vertex shader per instance with gl_InstanceID

Categories : Performance

`UIAlertView` appears multiple times
The simplest thing to do is to just have a boolean that gets set to true when the UIAlertView is displayed, and then false when the UIAlertView is dismissed. Then, whenever you are going to show the UIAlertView, first check if it is already displaying.

Categories : IOS

Filtering through multiple times in javascript
var color = document.getElementById("color").value; var gender = document.getElementById("gender").value; var size = document.getElementById("size").value; var matched = products.filter(function(e) { return (e.color == color && e.gender == gender && e.size == size); }).map(function(e) { return e.name; });

Categories : Javascript

Loop executing multiple times
The problem seems to be that you don't put the value of count in ecx before you start the loop. Your call to ReadString apparently stores the value in fibCount. You subtract 2 from that and store it in count, but you never change ecx. The only value that gets set in ecx is 32. I think you'll solve your problem with: call CrLf mov ecx, count ; <== add this line L1: mov count, ecx

Categories : Assembly

iOS UITextField can't becomeFirstResponder multiple times
This is happening because every time cell is loaded, it is recreated and so its subviews. As a result, reference to your textfield is lost. To resign it successfully, you need to keep focus the parent cell in order to avoid re-creation of cell. EDIT Another alternate is that you remember the indexpath of cell, who's textfield you want to becomefirstresponder. When creating cell at that indexpath, iterate through its subviews, catch the reference of textfield and call becomeFirstResponder on it. You need to do the same thing I mentioned above. In cellForRowAtIndexPath: write following code at appropriate place: if(indexPath.section == 0)//your section in which that cell is present. e.g. 0 { if(indexPath.row == 1)//cell no. 1 {

Categories : IOS

Mysql multiple times between in query
select name,age, case when age BETWEEN 5 AND 10 then '5-10' else '50-55' end as age_between from tbl where ( age BETWEEN 5 AND 10) or (age BETWEEN 50 AND 55) BTW it would be better to store the birthdate. Then you don't have to set the age.

Categories : PHP

Use bound parameter multiple times
A working solution: $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, TRUE); $query = "SELECT * FROM table WHERE name LIKE :term OR number LIKE :term"; $term = "hello world"; $stmt = $pdo->prepare($query); $stmt->execute(array('term' => "%$term%")); $data = $stmt->fetchAll();

Categories : PHP

Why does zumero_sync need to be called multiple times?
I see two basic questions here: (1) Why does zumero_sync() work the way it does? (2) Can it work differently? I'll answer (2) first, since it's easier: Yes, it could work differently. Rather, we could (and probably will, soon, you brought this up) implement an additional function, named something like zumero_sync_complete(), which performs [the guts of] zumero_sync() in a loop and returns after the sync is complete. We didn't implement zumero_sync_complete() because it doesn't add much value. It's a simple loop, so you can darn well write it yourself. :-) Er, except in scripting environments which don't support loops. Like the sqlite3 shell. Answer to (1): The Zumero sync protocol is designed to give the server the flexibility to return partial results if it wants to do so.

Categories : Sqlite

How do I print something multiple times with one click?
You are giving each element the same ID and name, and then focusing printing etc. It just seems wrong, and doing it a little differently will trigger multiple print dialogs in some browsers (printing an iFrame is not cross browser) : $("#printing").on('click', function () { for (var count = 1; count < 13; count++) { (function(k) { $('<iframe />', { id : 'printIFrame' + k, name : 'printIFrame' + k, on : { load: function() { this.contentWindow.focus(); this.contentWindow.print(); } }, src : 'flyer.php?userNow=' + k, }).appendTo('body'); })(count); } }); FIDDLE

Categories : Javascript

Override set_message multiple times
CodeIgniter doesn't support multiple error messages for the same rule natively, but there's a couple of workarounds you may try: As @HashemQolami suggests, you can use multiple callback functions and set a different error message for each one: $this->form_validation->set_rules('txt_first_name', 'First Name', 'callback_numeric_a'); $this->form_validation->set_rules('txt_last_name', 'Last Name', 'callback_numeric_b'); The drawback for this method is that obviously it's not modular but rather repetitive as you'd need to define multiple functions in your controller like this one public function numeric_a($str){ $this->form_validation->set_message('numeric_a', 'a'); return $this->numeric($str); } Another workaround I've used is set the message of the rule a

Categories : Codeigniter

Why is the thread being created multiple times?
Your run function in the handler calls createAndStartCountDownThread(), which creates a new thread and calls start on it. So each thread will post something to the handler, which will create a new thread. So yes, this function will spawn lots of threads. I'm not sure what you're trying to do, but this is the wrong way. If you want a timer, use a timer or an Alarm. If you want to create a continuous thread, you want one thread with a loop (so the thread doesn't exit run and terminate prematurely). If you want to just be woken up later (and later is realtively soon) just use a Handler. Edit: If you're trying to implement blinking behavior, I'd suggest just using a single handler with a message posted to it via postMessageDelayed. This will run the handler runnable in the specified a

Categories : Java

NSNotification sent once, but is received multiple times
Well, I am assuming that [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onChangeItem:) name:@"ItemChange" object:nil]; are being added more than once. I like to remove any potential observer before adding an observer, like so: [[NSNotificationCenter defaultCenter] removeObserver:self name:@"ItemChange" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onChangeItem:) name:@"ItemChange" object:nil]; That way there will ever only be one observer callback.

Categories : Objective C

call constructor multiple times
It could just mean that the constructor is being kept in the same block of memory (locality of reference and all that) to save memory. As for the second part of the question, to quote: "A daemon (or service) is a background process that is designed to run autonomously,with little or not user intervention." Taken from here (don't bother with any of the links on the page, they all seem to be dead. Just botched anchor tags, though).

Categories : C++



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