Daily Archives

Articles indexed Wednesday July 3 2013

Page 4/14 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • backbone marionette - displaying a view in a layout region which has already been rendered

    - by Justin Wyllie
    I have something like this: //render the layout Layout.layout = new Layout.Screen(); MyApp.SomeRegion.show(Layout.layout); //render a view into it var mView = new CompositeView({collection: data}); Layout.layout.SomeRegion.show(mView); That all works fine. The layout has 3 regions. The above has rendered a view into one of them. Now, later, I want (in response to some user interaction) to render another view into one of the other regions. So I try: var mView2 = new CompositeView({collection: data}); Layout.layout.SomeOtherRegion.show(mView); But 'SomeOtherRegion' no longer exists on Layout.layout. I looked at this in Firebug. In the first case Layout.layout has my three regions defined on it. In the second case, not. Though they are still there in the regions object. This is the same layout instance. It looks like once a layout has been rendered you cannot render into it again? There must be a way. Nb. I don't want to re-render the layout. I hope that makes sense --Justin Wyllie

    Read the article

  • Swipe gestures on Android ListView items

    - by Bartek
    I have a ListView populated by a ResourceCursorAdapter. I use the loaders mechanism to query a ContentProvider for list items. I detect swipe gestures on the list items to perform some actions on them. New items get added by a background service, so the list can change dynamically. Everything works fine, except when I start swiping and a database change occurs (as a result of the background service adding a new row). In such case the gesture is not detected properly. I noticed that ACTION_CANCEL is dispatched to the list item view and also that bindView is executed for all visible items. Inside the bindView method I only set some text - I don't change any listeners there. How can I make gestures work even when new items are being added by the background service? Perhaps there's a way to prevent the motion from being cancelled or I can pause database updates so they don't interrupt the gesture.

    Read the article

  • Insane CPU usage in QT 5.0

    - by GravityScore
    I'm having trouble using the QT framework, particularly with the paintEvent of QWidget. I have a QWidget set up, and am overriding the paintEvent of it. I need to render a bunch of rectangles (grid system), 51 by 19, leading to 969 rectangles being drawn. This is done in a for loop. Then I also need to draw an image on each on of these grids. The QWidget is added to a QMainWindow, which is shown. This works nicely, but it's using up 47% of CPU per window open! And I want to allow the user to open multiple windows like this, likey having 3-4 open at a time, which puts the CPU close to 150%. Why does this happen? Here is the paintEvent contents. The JNI calls don't cause the CPU usage, commenting them out doesn't lower it, but commenting out the p.fillRect and Renderer::renderString (which draws the image) lowers the CPU to about 5%. // Background QPainter p(this); p.fillRect(0, 0, this->width(), this->height(), QBrush(QColor(0, 0, 0))); // Lines for (int y = 0; y < Global::terminalHeight; y++) { // Line and color method ID jmethodID lineid = Manager::jenv->GetMethodID(this->javaClass, "getLine", "(I)Ljava/lang/String;"); error(); jmethodID colorid = Manager::jenv->GetMethodID(this->javaClass, "getColorLine", "(I)Ljava/lang/String;"); error(); // Values jstring jl = (jstring) Manager::jenv->CallObjectMethod(this->javaObject, lineid, jint(y)); error(); jstring cjl = (jstring) Manager::jenv->CallObjectMethod(this->javaObject, colorid, jint(y)); error(); // Convert to C values const char *l = Manager::jenv->GetStringUTFChars(jl, 0); const char *cl = Manager::jenv->GetStringUTFChars(cjl, 0); QString line = QString(l); QString color = QString(cl); // Render line for (int x = 0; x < Global::terminalWidth; x++) { QColor bg = Renderer::colorForHex(color.mid(x + color.length() / 2, 1)); // Cell location on widget int cellx = x * Global::cellWidth + Global::xoffset; int celly = y * Global::cellHeight + Global::yoffset; // Background p.fillRect(cellx, celly, Global::cellWidth, Global::cellHeight, QBrush(bg)); // String // Renders the image to the grid Renderer::renderString(p, tc, text, cellx, celly); } // Release Manager::jenv->ReleaseStringUTFChars(jl, l); Manager::jenv->ReleaseStringUTFChars(cjl, cl); }

    Read the article

  • How do i stop continuous builds in CCNET dashboard?

    - by Heera
    I have successfully setup a CCNet web dashboard and everything is working fine has expected. And i have triggered a force build from CCNET and it ran successfully with out causing any error. but, the problem what i am facing is that, whenever i'm triggering the build from CCNET dashboard (Force) it's keeps on to build continuously again and again. Actually it should stop the build automatically right after the success of the latest build. can any one help me out, how to stop the continuous builds ???? Thanks in Advance !!!

    Read the article

  • Jquery help for current time indication within a range

    - by Appster
    I'm looking for a simple light-weight jquery plugin that'll help me show something like this in my website: Essentially, this is like a timeline. I know the start and end dates (in that, they don't change) and the position of today's date just gives an indication of how far along I am into a task I took up on Jun 1, 2012. That's all I need it for - a better visual indication of my current status. I've found a lot of jquery timeline plugins but they are too complex for what I'm trying to do. Any ideas or suggestions? Thanks in advance.

    Read the article

  • php codeigniter MySQL search query

    - by kalafun
    I want to create a search query on MySQL database that will consist of 5 different strings typed in from user. I want to query 5 different table columns with these strings. When I for example have input fields like: first name, last name, address, post number, city. How should I query the database that I dont always get all the rows. My query is something like this: SELECT user_id, username from users where a like %?% AND b like %?% AND c like %?% AND d like %?% AND e like %?%; When I exchange the AND for OR I always get all the results which makes sense, and when I use AND I get only the exact matches... Is there any function or statement that would help me with this?

    Read the article

  • Decrease the load time for Mobile Version Rails Site

    - by Ramoji
    I have been working on the mobile version of my rails application.I am using the approach of using the same controller and rendering a mobile view when the request is from a mobile device. I am using jquery mobile in mobile views. For mobile views I did not use any layout for the views because it is the same as loading the required files in each view. In this approach, Every request essentially loads all of the required js,css files which i feel is making the mobile site to load slowly. How could i make my views to load the js and css files just once? Thanks, Ramoji.

    Read the article

  • Javascript - event listener toggle button

    - by user2546157
    I'm trying to create a button which can toggle "double click" to "single click" and in the opposite. For some reason, once it toggles to single click and it cannot toggle back. Can anyone please help! function init() { normal_listeners(); } function addListener(){ var image1 = document.getElementById('image_1'); var image2 = document.getElementById('image_2'); var image3 = document.getElementById('image_3'); if(document.getElementById('listener_1').value == "Listener"){ document.getElementById('listener_1').style.backgroundColor = "red"; alert("Normal"); image1.addEventListener("dblclick", function(){userChoice(1);}, false); image2.addEventListener("dblclick", function(){userChoice(2);}, false); image3.addEventListener("dblclick", function(){userChoice(3);}, false); document.getElementById('listener_1').value = "Normal"; } else if(document.getElementById('listener_1').value == "Normal") { document.getElementById('listener_1').style.backgroundColor = "green"; alert("Listener"); image1.addEventListener("click", function(){userChoice(1);}, false); image2.addEventListener("click", function(){userChoice(2);}, false); image3.addEventListener("click", function(){userChoice(3);}, false); document.getElementById('listener_1').value = "Listener"; } } function normal_listeners(){ var image1 = document.getElementById('image_1'); var image2 = document.getElementById('image_2'); var image3 = document.getElementById('image_3'); var listener1 = document.getElementById('listener_1'); listener1.addEventListener("click", addListener, false); image1.addEventListener("dblclick", function(){userChoice(1);}, false); image2.addEventListener("dblclick", function(){userChoice(2);}, false); image3.addEventListener("dblclick", function(){userChoice(3);}, false); } window.onload = init; <img id="image_1" src="rock.jpg" alt="ROCK" width="100" height="100"> <img id="image_2" src="paper.jpg" alt="PAPER" width="100" height="100"> <img id="image_3" src="scissors.jpg" alt="SCISSORS" width="100" height="100"> <input type="button" id="listener_1" value="Normal" style="background-color:red">

    Read the article

  • Regular expression Not working properly n case of multiple trailing ]]]]

    - by ronan
    I have the requirement that in a textbox a user can jump to the next word enclosed in [] on a tab out for example Hi [this] is [an] example. Testing [this] So when my cursor is at Hi and I do a tab out , the characters enclosed in the [this] are highlighted and when I again do a tabl out th next characters enclosed in following [an] are highlighted. This works fine Now the requirement is whatever the text including the special chars between [] needs to be highlighted case 1: when I have trailing ]]], it only highlights leading [[[ and ignores ]]]] e.g case 2: In case of multiple trailing ] e.e [this]]]] is [test], ideally one a single tabl out from this , it should go to next text enclosed in [] but a user has to tab out 4 times one tab per training ] to go to next [text] strong text The code is $(document).ready(function() { $('textarea').highlightTextarea({ color : '#0475D1', words : [ "/(\[.*?\])/g" ], textColor : '#000000' }); $('textarea').live('keydown', function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) { var currentIndex = getCaret($(this).get(0)) selectText($(this), currentIndex); return false; } }); }); function selectText(element, currentIndex) { var rSearchTerm = new RegExp(/(\[.*?\])/); var ind = element.val().substr(currentIndex).search(rSearchTerm) currentIndex = (ind == -1 ? 0 : currentIndex); ind = (ind == -1 ? element.val().search(rSearchTerm) : ind); currentIndex = (ind == -1 ? 0 : currentIndex); var lasInd = (element.val().substr(currentIndex).search(rSearchTerm) == -1 ? 0 : element.val().substr(currentIndex).indexOf(']')); var input = element.get(0); if (input.setSelectionRange) { input.focus(); input.setSelectionRange(ind + currentIndex, lasInd + 1 + currentIndex); } else if (input.createTextRange) { var range = input.createTextRange(); range.collapse(true); range.moveEnd('character', lasInd + 1 + currentIndex); range.moveStart('character', ind + currentIndex); range.select(); } } function getCaret(el) { if (el.selectionEnd) { return el.selectionEnd; } else if (document.selection) { el.focus(); var r = document.selection.createRange(); if (r == null) { return 0; } var re = el.createTextRange(), rc = re.duplicate(); re.moveToBookmark(r.getBookmark()); rc.setEndPoint('EndToStart', re); return rc.text.length; } return 0; } Please let me know to handle two above cases

    Read the article

  • Snake game, can't add new rectangles?

    - by user1814358
    I had seen some problem on other forum, and i tried to solve them but unsuccesfully, now is too intersting for me and i just need to solve this for my ego... lol Main problem is when snake eat first food, snake added one rectangle, when snake eat second food nothings changed? When snake head position and food position are same, then i try to add another rectangle, i have list where i stored rectangles coordinates x and y. What do you think, how i can to solve this problem? I think that i'm so close, but my brain has stopped. :( code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Zmijice { enum Kontrole { Desno,Levo,Gore,Dole,Stoj } public partial class Zmijice : Form { int koox; int kooy; private int x; private int y; private int c; private int b; private const int visina=20; //width private const int sirina=20; //height //private int m = 20; //private int n = 20; private List<int> SegmentX = new List<int>(); private List<int> SegmentY = new List<int>(); Random rnd = new Random(); private Kontrole Pozicija; public Zmijice() { InitializeComponent(); //slucajne pozicije pri startu x = rnd.Next(1, 20) * 20; y = rnd.Next(1, 20) * 20; c = rnd.Next(1, 20) * 20; b = rnd.Next(1, 20) * 20; Pozicija = Kontrole.Stoj; //stop on start } private void Tajmer_Tick(object sender, EventArgs e) { if (Pozicija == Kontrole.Stoj) { //none } if (Pozicija == Kontrole.Desno) { x += 20; } else if (Pozicija == Kontrole.Levo) { x -= 20; } else if (Pozicija == Kontrole.Gore) { y -= 20; } else if (Pozicija == Kontrole.Dole) { y += 20; } Invalidate(); } private void Zmijice_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Down) { Pozicija = Kontrole.Dole; } else if (e.KeyCode == Keys.Up) { Pozicija = Kontrole.Gore; } else if (e.KeyCode == Keys.Right) { Pozicija = Kontrole.Desno; } else if (e.KeyCode == Keys.Left) { Pozicija = Kontrole.Levo; } } private void Zmijice_Paint(object sender, PaintEventArgs e) { int counter = 1; //ako je pojela hranu if (x==c && y==b) { counter++; c = rnd.Next(1, 20); //nova pozicija hrrane c = c * 20; b = rnd.Next(1, 20); b = b * 20; //povecaj zmijicu SegmentX.Add(x); SegmentY.Add(y); //label1.Text = SegmentX.Count().ToString() + " " + SegmentY.Count().ToString(); //left if (Pozicija == Kontrole.Levo) { koox = x+20; kooy = y; } //right if (Pozicija == Kontrole.Desno) { koox = x-20; kooy = y; } //up if (Pozicija == Kontrole.Gore) { koox = x; kooy = y+20; } //down if (Pozicija == Kontrole.Dole) { koox = x; kooy = y-20; } } foreach (int k in SegmentX) { foreach (int l in SegmentY) { e.Graphics.FillRectangle(Brushes.Orange, koox, kooy, sirina, visina); } } koox = x; kooy = y; e.Graphics.FillRectangle(Brushes.DarkRed, x, y, sirina, visina); e.Graphics.FillRectangle(Brushes.Aqua, c, b, sirina, visina); } } }

    Read the article

  • VBA Add to Array and Use Previous Value

    - by MattHead93
    I'm trying to write some code that will take a value WeekNum, and add it to an array Week(1 To 51), and then associate a value from a Textbox TargDef. Once this has been added to the array, I want to look up the value of the array for the previous WeekNum and add it to a value ProdTarg. I've created this much so far: Dim Week(1 To 51) Dim Count As Integer If TargDef < 0 Then Count = WeekNum Week(Count) = Abs(Val(TargDef)) If Val(Week((Count) - 1)) = 0 Then ProdTarg = Val(ProdTarg) Else ProdTard = Val(ProdTarg) + Val(Week((Count) - 1)) End If End If I am currently receiving the error "Subscript out of Range" for the line If Val(Week((Count) - 1)) = 0 Then Any help will be greatly appreciated!

    Read the article

  • With NVD3.js (nv.models.lineWithFocusChart), how do you set specific ticks on X-axis, when x values are dates?

    - by Panagiotis Panagi
    I'm using nv.models.lineWithFocusChart, where I'm showing some hourly measurements. So the x domain is dates. What I need is to show a tick per hour on X axis: 00:00 01:00 02:00 ... 24:00 I've tried everything I could find but nothing works. It seems that its easy to set specific ticks when values are not dates. But can't figure out how to do it for dates. Here's the code that creates the graph, if it can help: nv.addGraph -> chart = nv.models.lineWithFocusChart(view) chart.yAxis.tickFormat(d3.format(".02f")) d3.select(graphSelector).datum([]).transition().duration(500).call(chart) nv.utils.windowResize -> d3.select(graphSelector).call(chart) chart.xAxis.tickFormat (d) -> d3.time.format(ticksFormat)(new Date(d)) chart.x2Axis.tickFormat (d) -> d3.time.format(ticksFormat)(new Date(d)) chart.xAxis.tickSubdivide(9)

    Read the article

  • I have an error when I escaping string

    - by Sudip Rooj
    I am trying to write a string in my php code in my panel. This is given bellow <?php $str.="$('#layerList ul').prepend('<li data-refInd=\''+arr_ind+'\'><img src=\''tmp_card_imgs/\'+temp".$k.".name+'\' width='20px' /> Layer '+temp".$k.".zindex+':Image <span class=\'del_layer\' style=\'cursor:pointer;float:right;display:block;\'>X</span></li>');"; ?> but the error showing in console is given bellow SyntaxError: missing ) after argument list [Break On This Error] ...data-refInd=\''+arr_ind+'\'><img src=\''tmp_card_imgs/\'+temp0.name+'\' width='2... -----------------------------------------| editor.php?id=129 (line 837, col 60) What is the problem in my string escaping?

    Read the article

  • Format a timestamp into text

    - by user1257114
    I want to get the Modify date of a file and then format it into a human readable date. I am running a C program that gets information on when a particular file was last modified. My C Code contains a sytem cmd which contains a number of egreps, awks, seds separated by pipes. Using sed or awk or something similar, how can I convert 06 to June (This can be any month so an array or something is required) What I am trying to achieve is to end up with a string similar to: My C code contains: char string1[100] = ""; #define MAXCHAR 100 FILE *fp; char str[MAXCHAR], str2[MAXCHAR]; char* filename = "newfile"; /* stat: run 'stat' on the dtlName file to display status information. egrep: search for the pattern 'Modify' and print the lines containing it. awk: Get columns 2 & 3 sed: replace the . with a space, leaving 3 columns of output awk: only print cols 1 & 2 to newfile sed: replace '-' with ' ' in newfile awk: format output in newfile */ sprintf(string1, "/bin/stat %s \ | egrep Modify \ | /bin/awk '{print $2, $3}' \ | /bin/sed 's/\\./ /g' \ | /bin/awk '{print $1, $2}' \ | /bin/sed 's/-/ /g' \ | /bin/awk '{print $3,$2\", \"$1,\"at\",$4}' > newfile" , dtlName); system(string1); fp = fopen(filename, "r"); while (fgets(str, MAXCHAR, fp) != NULL) sprintf(str2,"%s", str); /* Write information to file */ DisplayReportFile (report); ReportEntry (report,L"Source file: %s, Created: %s\n\n",dtlName,str2);

    Read the article

  • Pop to root SplitViewController in TabBarController - iOS

    - by Mike Bryant
    TableViewController Context: Here's my app: Tab 1: NavigationController -> ViewController Tab 2: SplitViewController -> Master : TableViewController -> SplitViewController ->TableViewController -> Detail : TableViewController -> TableViewController Tab 3: NavigationController -> ViewController (I'm Here) How do I pop to the root of each tab from a method in the tab 3 (basically a logout button)?

    Read the article

  • How to show login screen only for the first time when app launches

    - by Jaw Ali
    I want to launch the login screen when first time app launches other wise app work simple but problem is that again again it goes to login screen. here is the code which i am using in didFininsh I want the user show go to login screen first time only and next time it should show splitViewController [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"firstLaunch",nil]]; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { [self.window addSubview:[splitViewController view]]; LoginViewController *targetController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; targetController.modalPresentationStyle = UIModalPresentationFullScreen; [self.splitViewController presentViewController:targetController animated:YES completion:nil]; } else { [self.window addSubview:[splitViewController view]]; } // my comment[window addSubview:splitViewController.view]; [window makeKeyAndVisible]; return YES;

    Read the article

  • Which type of data can be garbage collected when app is in background?

    - by Neoh
    Let's say I start from activity A - activity B. While in activity B I press home to exit. After a long time, gc may be called because other apps take higher priority. My question is, which of the following type of data will be garbage collected (I'm pretty sure static fields can be garbage collected any time but I'm not sure about these): i) fields that are declared final or static final ii) intent and its data that I passed from activity A to activity B iii) onSavedInstanceState when orientation is changed during the app running I ask this because I want to ensure that my app won't crash when I restore activity B from background after a long period.

    Read the article

  • Why do I get access denied to data folder when using adb?

    - by gregm
    I connected to my live device using the adb and the following commands: C:\>adb -s HT829GZ52000 shell $ ls ls sqlite_stmt_journals cache sdcard etc system sys sbin proc logo.rle init.trout.rc init.rc init.goldfish.rc init default.prop data root dev $ cd data cd data $ ls ls opendir failed, Permission denied I was surprised to see that I have access denied. How come I can't browse around the directories using the commandline like this? How do I get root access on my phone?

    Read the article

  • How to prevent Ad blocker to hide your images on your website ?

    - by Anirudha
    Originally posted on: http://geekswithblogs.net/anirugu/archive/2013/07/03/how-to-prevent-ad-blocker-to-hide-your-images-on.aspxAdblocker always block the images that start with “ads”. this means ads1.png,.jpg or gif have more tendency to be blocked by adblockers in Browser like Firefox and chrome. Recently Adblock plus come to Internet Explorer.   To solve this problem. Replace image name ads with Eds. It will never be blocked. This way you can prevent your banner on your website from being hidden.

    Read the article

  • How do I transform a LAN subnet to another? (VPN)

    - by Krishath
    I've set up a VPN with a LAN behind it. VPN : 10.2.1.X LAN : 192.168.1.X When I connect from outside where the router via DHCP assigns me a similar IP to my "original LAN" (192.168.1.X) everything starts to be messed up. I can't route my traffic through the VPN and (obviosly) I can't reach my "real" LAN behind my VPN. How can I always reach my LAN? I thought that I can fake my LAN subnet to something like "10.2.2.X" to those PCs out of my VPN but in this way my VPN server should translate 10.2.2.X to 192.168.1.X (locally).[Is this S/D-NAT?] Is this possible? How can I accomplish that? Thank you very much!

    Read the article

  • Why does sshd give a different identification when connecting through netcat?

    - by Robbie Mckennie
    I have been attempting to create a way to ssh into a machine hiding behind a firewall. I set up my ssh client with the option Proxycommand /usr/bin/ncat -l 2000, and then I connect it to sshd with ncat <client> 2000 -c "sshd -i" on the server. It works in that I can get a shell on the server, but the server sends a different key than when I use normal ssh. So the question is, why? Is the key different when sshd is called in this unusual way?

    Read the article

  • Redirecting to Login page in apache

    - by Shailesh Sutar
    I am working on OTRS where i want to set OTRS Login page on otrs.mydomain.com. I am having machine CentOS release 6.2 (Final). Currently I am accessing it,using otrs.mydomain.com/otrs/customer.pl for customer login AND otrs.mydomain.com/otrs/index.pl for admin login. I changed DocumentRoot to /opt/otrs but its not working as it should. OTRS is installed in /opt/otrs/ I am using Apache Server version: Apache/2.2.15 (Unix). Now i am stuck.

    Read the article

  • Dovecot, IMAP outlook reports error 0x800CCC0E cannot synchronize subscribed folders

    - by l1em1on1
    I have recently some issues with people using my email server. They have problems with synchronizing folders on outlook, and I can't figure out what to do. I found somewhere that I could extend a setting for imap connections: mail_max_userip_connections = 20 which didn't really help, I was thinking about extending timeout of connection or something, but really can find anything like that. In Thunderbird it seems to be OK. here is dovecot -p result: http://snipt.org/AAig5 if anything could help please let me know what should provide.

    Read the article

  • What is the best way to compare vhost traffic?

    - by Bob Flemming
    Recently one of my servers has been subjected to malicious ddos attacks. I have about 12 websites hosted on the server which uses name based v-hosting. I am trying to identify which virtual host(s) are getting bombarded with traffic. I have used tools such as iftop which is good for identifying hosts which are consuming lots of bandwidth, and also apachetop which is useful for identifying which resources are being requested on a single v-host. What I really need is a tool which allows me to see the amount of traffic being received by each v-host in real time so I can easily see which v-host is being targeted. Does such a tool exist?

    Read the article

  • How to prevent bad queries from breaking replication?

    - by nulll
    For my personal experience, mysql replication is fragile. I know that there area many things not to do beacuse they could break replication, but we are humans and the error could always occur. So I was thinking... is there a way to enforce mysql replication? Something that prevents queries that are dangerous for the replication to be runt? In other words I'm searching for something that saves replication even if I accidentally run evil queries.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >