Daily Archives

Articles indexed Sunday December 26 2010

Page 14/23 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Heavy use of templates for mobile platforms

    - by Chris P. Bacon
    I've been flicking through the book Modern C++ Design by Andrei Alexandrescu and it seems interesting stuff. However it makes very extensive use of templates and I would like to find out if this should be avoided if using C++ for mobile platform development (Brew MP, WebOS, iOS etc.) due to size considerations. In Symbian OS C++ the standard use of templates is discouraged, the Symbian OS itself uses them but using an idiom known as thin templates where the underlying implementation is done in a C style using void* pointers with a thin template layered on top of this to achieve type safety. The reason they use this idiom as opposed to regular use of templates is specifically to avoid code bloating. So what are opinions (or facts) on the use of templates when developing applications for mobile platforms.

    Read the article

  • How to solve such system with given parts of it? (maple)

    - by Kabumbus
    So I had a system #for given koefs k:=3; n:=3; #let us solve system: koefSolution:= solve({ sum(a[i], i = 0 .. k) = 0, sum(a[i], i = 0 .. k)-(sum(b[i], i = 0 .. k)) = 0, sum(i^n*a[i], i = 0 .. k)-(sum(i^(n-1)*b[i], i = 0 .. k)) = 0 }); So I have a vector like koefSolution := { a[0] = 7*a[2]+26*a[3]-b[1]-4*b[2]-9*b[3], a[1] = -8*a[2]-27*a[3]+b[1]+4*b[2]+9*b[3], a[2] = a[2], a[3] = a[3], b[0] = -b[1]-b[2]-b[3], b[1] = b[1], b[2] = b[2], b[3] = b[3]} I have a[0] so I try solve({koefSolution, a[0] = 1}); why it does not solve my system for given a[0]? ( main point here is to fill koefSolution with given a[] and b[] and optimize.)

    Read the article

  • printing long compilation lines with MS NMAKE

    - by Elazar Leibovich
    I have a legacy MS NMAKE Makefile I need to fix a few bugs in. There are some very long command lines I wish to debug that are being executed using the NMAKE trick of "inline files": dep: cmd @<<tmpfilename cmd_args.. << When changing the line to dep: echo cmd @<<tmpfilename cmd_args.. << NMAKE complains that the line is too long. Is there any other trick I can apply in order to view the command line NMAKE is actually executing?

    Read the article

  • document.getElementById in toString

    - by KooiInc
    edit Found my answers here. Bottom line: toString/valueOf can only return primitive types. So here the lack of native getters in javascript shows, I suppose. I would like to use the following simple function in an elementwrapper: function ElGetter(id){ var id = id; return { set: function(nwid){id = nwid;}, toString: function(){return document.getElementById(id);}, valueOf: function(){return document.getElementById(id);} }; } var myEl = ElGetter('myId'); console.log(myEl.innerHTML); //=> undefined But I can't get it to work. Is it a DOM/javascript restriction or am I missing something? Normally it works, as in: function Tester(){ var x = 1; return { toString: function(){return x}, valueOf: function(){return x} } } var myTest = Tester(); console.log(myTest); //=> 1

    Read the article

  • Yet another list comprehension question

    - by relima
    I had this: if Setting["Language"] == "en": f.m_radioBox3.SetSelection(0) elif Setting["Language"] == "pt": f.m_radioBox3.SetSelection(1) elif Setting["Language"] == "fr": f.m_radioBox3.SetSelection(2) elif Setting["Language"] == "es": f.m_radioBox3.SetSelection(3) Then I did this: Linguas = ["en","pt","fr","es"] a = 0 for i in Linguas: if i == Setting["Language"]: f.m_radioBox3.SetSelection(a) a += 1 Is it possible to further simplify this and make it into a one-liner?

    Read the article

  • Apt Stalls When Using HTTP Sources

    - by UltraNurd
    I was getting some to me inexplicable behavior from apt-get/aptitude on an admittedly crusty old webserver. While it was otherwise running fine, as soon as I tried a package upgrade, after a downloading a few updates it would stall completely, then my SSH session hung (and I was unable to reconnect), thus requiring a hard restart. First, I switched to a different package source in /etc/apt/sources.list, but still got the same behavior. At this point I was assuming the NIC was dying in some weird way... but as soon as I changed the package source to use FTP instead of HTTP, everything worked fine, and I was able to upgrade. For now I'm not too concerned since I have an easy work around, but it implies that there's something very weird with my network setup, since it seems to be protocol (or port?) specific. I didn't think any of my NAT setup would affect outbound traffic, but I could be crazy. Any ideas what I should try to look for?

    Read the article

  • Can I share my cable internet connection through my ADSL wireless router?

    - by Roaders
    Hi All Over the xmas period I am at my in-laws. They have Virgin Broadband (cable) and have a basic modem / router that is plugged directly into their computer using an ethernet cable. My wife and I arrived with 5 PCs! (ok, one is a gift and won't be used) 4 of which are laptops so I would like to be able to use their internet connection. At the moment I am working so have plugged the ethernet cable into my work laptop. Rebooting the router meant that my work laptop now has internet. I have my ADSL Netgear router which is wireless. I tried plugging it in between the router and the PC but I didn't seem to be able to share the internet connection wirelessly. The original PC still had internet despite ony being connected to my router but my wireless laptop didn't have a connection. My old cable router had an internet ethernet port on the back that the modem plugged into. My ADSL router doesn't, it has a phone connection socket. Is there a way of doing what I want with the equipment I have? Thanks

    Read the article

  • Why is my browser using so much memory?

    - by Steve
    Hi. I've recently had problems with Firefox running very slowly when I have many tabs open; say 20 tabs. My whole system would slow down. I decided to give Google Chrome a try, and it started out fine. But lately I am finding that it too, slows down my whole system. Looking at Task Manager, chrome.exe is using about 250MB of memory in about 6 different entries in task manager. However, when I shut Chrome down, memory usage is reduced by about 600MB. How can this be? (shows drop in memory usage after ending Chrome.) When my system locks up with Chrome having many tabs open, it takes 10 seconds to load the Start Menu, 10 seconds to expand All Programs, and each folder and subfolder, and 30 seconds for the program to be highlighted under my mouse. It also takes 10 seconds to switch to Notepad. Why is Chrome appearing to use so much more memory than Task Manager indicates? Why is my pagefile being used when I have around 1.1GB of memory? Can I set Chrome to run in RAM and not in the pagefile? How can 20 tabs use 600MB? That's 30MB per tab. Thanks for your help.

    Read the article

  • Volume display for laptop missing after driver update

    - by Cyclone
    I have a Dell Inspiron 1520, and I just updated my audio drivers to be able to use Stereo Mix. It's a SigmaTel audio driver. Prior to the update, whenever I used the hardware buttons to update volume or mute/unmute speakers, it would always have a nice display like this one: But, for volume instead of screen brightness. The hardware buttons still work fortunately, but the volume display is gone. Is there a place I can configure this setting and re-enable it? The speaker icon in task tray was also disabled with the update, but I re-enabled that from the Control Panel. Is this simply gone with the driver update? Thanks for the help!

    Read the article

  • Verizon 4G LTE vs. a LAN

    - by n8wrl
    I have been having quite a bit of trouble getting my new Verizon 4G-LTE service running on a Windows 7 desktop. My desktop is on a LAN here at home with two other PC's. We all share printers, files, media, etc. Until yesterday, we also shared a Verizon 3G modem via a NetGear 3G broadband WAP. That isn't compatible with the 4G so now I am just trying to get the 4G modem working directly connected to one of the desktops. After some USB wrangling, it seems to work. Except, every 7-10 minutes the connection would drop. After some time on the phone with a very nice Verizon technician, it seems to be staying up - it's been up for 20 minutes now. He told me that my LAN was causing the 4G to drop. That traffic on my LAN, even though it is not destined for the internet (ICS not working yet) was causing the cell tower to detect an 'IP change' and a 'security violation' in my modem and drop my connection. Is this Verizon's way of forbidding more than one computer to share a modem? I have my computer running now without a LAN connection and the 4G is still up. But this isn't practical. Has anyone heard of this?

    Read the article

  • WinForms app config manager is x86 and cannot reference assemblies that targets Any CPU

    - by ivos
    Hi I'm using Win7 64x and Visual Studio 2010. I created a library/framework targeting Any CPU. Then I created a new WinForms project that uses that framework, leaving the default values of the wizard. I mean, I didn't change anything. When I reference my framework, VS cannot find the assemblies. If I go to the project properties, it is targeting Any CPU (as expected, I can change it if I want). But if I go to Configuration Manager, the only choice I have for that project is x86. And I guess that is the problem. I tried to add Any CPU as a new Target but I was unable to. Could someone help me? :) Thanks in advance!

    Read the article

  • What's the equivalent of use-commit-times for git?

    - by Ben W
    I need the timestamps of files on my local and on my server to be in sync. This is accomplished with Subversion by setting use-commit-times=true in the config so that the last modified of each file is when it was committed. Each time I clone my repository, I want the timestamps of files to reflect when they were last changed in the remote repository, not when I cloned the repo. Is there any way to do this with git?

    Read the article

  • image upload problem.

    - by Bluemagica
    I wrote a function to resize and upload images...it works, but only for one image. So if I call the function three times, I end up with 3 copies of the last image..... function uploadImage($name,$width,$height,$size,$path='content/user_avatars/') { //=================================================== //Handle image upload $upload_error=0; //Picture $img = $_FILES[$name]['name']; if($img) { $file = stripslashes($_FILES[$name]['name']); $ext = strtolower(getExt($file)); if($ext!='jpg' && $ext!='jpeg' && $ext!='png' && $ext!='gif') { $error_msg = "Unknown extension"; $upload_error = 1; return array($upload_error,$error_msg); } if(filesize($_FILES[$name]['tmp_name'])>$size*1024) { $error_msg = "Max file size of ".($size*1024)."kb exceeded"; $upload_error = 2; return array($upload_error,$error_msg); } $newFile = time().'.'.$ext; resizeImg($_FILES[$name]['tmp_name'],$ext,$width,$height); $store = copy($_FILES[$name]['tmp_name'],$path.$newFile); if(!$store) { $error_msg = "Uploading failed"; $upload_error = 3; return array($upload_error,$error_msg); } else { return array($upload_error,$newFile); } } } //========================================================================================= //Helper Functions function getExt($str) { $i = strpos($str,"."); if(!$i) { return ""; } $l = strlen($str)-$i; $ext = substr($str,$i+1,$l); return $ext; } function resizeImg($file,$ext,$width,$height) { list($aw,$ah) = getimagesize($file); $scaleX = $aw/$width; $scaleY = $ah/$height; if($scaleX>$scaleY) { $nw = round($aw*(1/$scaleX)); $nh = round($ah*(1/$scaleX)); } else { $nw = round($aw*(1/$scaleY)); $nh = round($ah*(1/$scaleY)); } $new_image = imagecreatetruecolor($nw,$nh); imagefill($new_image,0,0,imagecolorallocatealpha($new_image,255,255,255,127)); if($ext=='jpg'||$ext=='jpeg') { $src_image = imagecreatefromjpeg($file); } else if($ext=='gif') { $src_image = imagecreatefromgif($file); } else if($ext=='png') { $src_image = imagecreatefrompng($file); } imagecopyresampled($new_image,$src_image,0,0,0,0,$nw,$nh,$aw,$ah); if($ext=='jpg'||$ext=='jpeg') { imagejpeg($new_image,$file,100); } else if($ext=='gif') { imagegif($new_image,$file); } else if($ext=='png') { imagepng($new_image,$file,9); } imagedestroy($src_image); imagedestroy($new_image); } I have a form with two upload fields, 'face_pic' and 'body_pic', and I want to upload these two to the server and resize them before storing. Any ideas?

    Read the article

  • can i change the black background of an iphone app?

    - by Cristi Balu?a
    My app is structured like this, a single MainWindow with window backgroundColor to white(which doesn't appear anywhere anyway), and in this nib i have a UINavigationController which doesn't seems to have a backgroundColor. Any view controller is added from code and made from code and they have a gray background. What happens is that when i rotate the iphone and the views are rotating as well, i see a black background under my views. Can this be changed? It looks ugly especially if i have a photo that is rotating in the same time with my gray background.

    Read the article

  • How to encode cyrillic in mysql?

    - by Premke
    Hello fellows, what's up? :-) I have one problem and i hope you can help me with it. One friend of mine have a simple solid html website and i implemented little php; CRUD system for articles... problem i came across is placing and getting cyrillic characters from mysql database. What i want to achive is next: In the main navigation there are some separated sections, whose names, ids and item's order i want to place in mysql and than to pull names and to put each name as a link. Names are supposed to be cyrillic characters. The problem comes when i, using php mysql_fetch_assoc function, try to display names which are inserted with cyrillic characters in database row, collation of row is utf8_general_ci, and i end with ????? insted of original characters. If i submit cyrillic characters via submit form to mysql it shows something like this У. How can i solve this, thanks in advance!? :-)

    Read the article

  • Rails 3 nested forms with has_many :through, entry in join table dosen't get deleted after update

    - by Hadi S.
    Hi, i have a 'User' model which has a has_many relationship to a 'Number' model through a join table 'user_number' model. I use accepts_nested_attributes_for :numbers, :allow_destroy = true in the 'User' model. Everything works fine except that whenever i delete a number from a user in the edit form, the associated number is deleted correctly in the 'number' table, but not the entry in the 'user_number' join table. In the update controller action i only use this: ... if @user.update_attributes(params[:user]) ... How can i force rails to also delete the associated entry in the join table?

    Read the article

  • SQLce DAL Linq to Sql or EntityFramework

    - by bretddog
    Hi, I'm learning databases, using SqlCe, and need business object to database mapping. Currently I try to decide if to use Linq to Sql, or EntityFramework. (I understand a bit L2S, but haven't familiarized with EF yet) The program will only be debeloped and used by myself, so I have good control of the priorities: I don't need to consider potential change of database type or data storage type, as I'm quite certain SQLce will stay sufficient. I DO expect continued development and changes to the data scheme while the program is in active use; change business object properties (Hence database columns), and possibly overall table scheme. So old data must be transported to new scheme. I also want to keep a decent degree of layer separation DAL/BLL, although this may not be necessary, it is good for me to learn these principles. My question is: With these priorities, would I have any benefit by choosing either Linq2Sql vs. EntityFramwork? (and please explain why) Btw, the project involves very simple table scheme with only 4-5 tables and very simple relations. Thanks!

    Read the article

  • Image from WebView

    - by kostas_menu
    hi!i m getting a photo from the web,but i see it very large..how could i see it with zoom out?this is my code for webView: public class gavros extends Activity { WebView browser; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.efimerides); browser =(WebView)findViewById(R.id.webview); browser.loadUrl("http://resources.sport-fm.gr/sportfm/newspapers/10/12/24/gavros.jpg"); }}

    Read the article

  • Can I do this in only one query ?

    - by Paté
    Merry christmas everyone, I Know my way around SQL but I'm having a hard time figuring this one out. First here are my tables (examples) User id name friend from //userid to //userid If user 1 is friend with user 10 then you a row with 1,10. User 1 cannot be friend with user 10 if user 10 is not friend with user 1 so you have 1,10 10,1 It may look weird but I need those two rows per relations. Now I'm trying to make a query to select the users that have the most mutual friend with a given user. For example User 1 is friend with user 10,9 and 7 and user 8 is friend with 10,9 and 7 too ,I want to suggest user 1 to invite him (like facebook). I want to get like the 10 first people with the most mutual friend. The output would be like User,NumOfMutualFriends I dont know if that can be done in a single query ? Thanks in advance for any help.

    Read the article

  • Linear Interpolation. How to implement this algorithm in C ? (Python version is given)

    - by psihodelia
    There exists one very good linear interpolation method. It performs linear interpolation requiring at most one multiply per output sample. I found its description in a third edition of Understanding DSP by Lyons. This method involves a special hold buffer. Given a number of samples to be inserted between any two input samples, it produces output points using linear interpolation. Here, I have rewritten this algorithm using Python: temp1, temp2 = 0, 0 iL = 1.0 / L for i in x: hold = [i-temp1] * L temp1 = i for j in hold: temp2 += j y.append(temp2 *iL) where x contains input samples, L is a number of points to be inserted, y will contain output samples. My question is how to implement such algorithm in ANSI C in a most effective way, e.g. is it possible to avoid the second loop? NOTE: presented Python code is just to understand how this algorithm works. UPDATE: here is an example how it works in Python: x=[] y=[] hold=[] num_points=20 points_inbetween = 2 temp1,temp2=0,0 for i in range(num_points): x.append( sin(i*2.0*pi * 0.1) ) L = points_inbetween iL = 1.0/L for i in x: hold = [i-temp1] * L temp1 = i for j in hold: temp2 += j y.append(temp2 * iL) Let's say x=[.... 10, 20, 30 ....]. Then, if L=1, it will produce [... 10, 15, 20, 25, 30 ...]

    Read the article

  • java.awt.HeadlessException thrown from HeadlessGraphicsEnvironment.getDefaultScreenDevice

    - by Omry
    I need to do some image processing on a java server (Debian with java version "1.6.0_12"), and I am receiving java.awt.HeadlessException from my code: java.awt.HeadlessException at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:64) at WaxOn.getDefaultConfiguration(WaxOn.java:341) Even when java.awt.headless is set to true (as evident by this code printing so): if (!java.awt.GraphicsEnvironment.isHeadless()) { logger.warn("Headless mode is not enabled"); } else { logger.info("Headless mode"); } This is the code that throws the exception: public static GraphicsConfiguration getDefaultConfiguration() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); return gd.getDefaultConfiguration(); } Any idea how to solve this?

    Read the article

  • Gray border when using NSBorderlessWindowMask

    - by bare_nature
    Hello, Whenever I try to create a custom window using NSBorderlessWindowMask and set an NSView (for example an NSImageView) as its contentView, I get a 1px gray border around the NSView and I don't seem to be able to get rid of it. I have followed several approaches including Apple's RoundTransparentWindow sample code as well as several suggestions on StackOverflow. I suspect the gray border is either coming from the window itself or the NSView. Have any of you experienced this problem or do you have a possible solution? Thanks

    Read the article

  • Displaying text in UILabel in iPhone

    - by SeniorLee
    OK. What's wrong with my code? - (void)viewDidLoad { [super viewDidLoad]; lblResult = [UILabel alloc]; } - (void)viewWillAppear:(BOOL)animated { lblResult.text = @"BlahBlah"; } I linked lblResult to Label object in IB well. But the label only shows the default text. Where's my BlahBlah?? And when the default string I set in the IB actually set to lblResult?? The reason that BlahBlah string is not displyed is I guess because lblResult.text is over-written by default string specified from IB. Just my guess. Can anyone make me clear with that?

    Read the article

  • Any simple way to "resize" an NSBezierPath?

    - by d11wtq
    I have an NSBezierPath that I'm filling and stroking. I'd like to add some inner glow to the path (a light stroke, just inside of the outer stroke), and the thing that comes to mind is to use the same path shrunk by 1 pixel (the size of the line that is already )stroked. Is there a way to do this? Alternatively, is there some sort of pattern I can use when applying both a border (stroke) and a glow to a bezier path? Example, the (extremely subtle) inner glow on the Google Chrome tabs:

    Read the article

  • some issues with removing www and redirecting index.html

    - by MariaKeys
    Hello Fellas, I am having trouble doing what i want to do with the following setup. I would like to remove all WWW, and also forward index.html to root dir. I would like this to be for all domains, so i am doing inside httpd.conf directory directive. I tried many variations with no success. Latest version is below (domains are inside /var/www/html, in seperate directories). http://www.example.com/index.html > http://example.com http://www.example.com/someother/index.html > http://example.com/someother/ Thanks, Maria <Directory "/var/www/html/*/"> RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] #RewriteCond %{REQUEST_URI} /^index\.html/ RewriteRule ^(.*)index\.html$ / [R=301,L] Options ExecCGI Includes FollowSymLinks AllowOverride AuthConfig AllowOverride All Order allow,deny Allow from all </Directory>

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >