Daily Archives

Articles indexed Friday January 7 2011

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

  • In ASP.NET MVC (3.0/Razor), do you prefer multiple views, or conditionals within views? Why?

    - by Chad
    For my new web app, I'm debating on using multiple views, or conditionals within views. An example scenario would be showing different info to users who are authenticated vs non-authenticated. This could be handled a couple ways. In the controller, check IsAuthenticated and return a view based on that In the view, check IsAuthenticated and show blocks of info based on that Pros of multiple views: Smaller, less complicated view - next to no logic in the view Pros of single views: less view files to maintain The obvious cons are the opposites of the pros: more files to maintain or more complicated view files. Which do you prefer? Why? Any pros/cons I haven't outlined here? Update: Assume each view uses a layout page and partial views to abstract the obviously repetitive code.

    Read the article

  • How do you detect an area that can be filled in in a bitmap in ActionScript 3?

    - by 1.21 gigawatts
    I am having a tough time figuring this out. I need to be able to detect a fill area for something similar to a coloring book picture. The user will click inside the area that needs to be filled. The image is user created bitmap content and so the fill area must be detected at runtime. Any help would be tremendously appreciated! Posting Flex 4 code for review: <fx:Script> <![CDATA[ protected function myImage_clickHandler(event:MouseEvent):void { myImage.imageDisplay.bitmapData.floodFill(event.localX,event.localY,0xFFFFFF); } ]]> </fx:Script> <s:Image id="myImage" click="myImage_clickHandler(event)" source="/images/square.gif"/>

    Read the article

  • Generic that takes only numeric types (int double etc)?

    - by brandon
    In a program I'm working on, I need to write a function to take any numeric type (int, short, long etc) and shove it in to a byte array at a specific offset. There exists a Bitconverter.GetBytes() method that takes the numeric type and returns it as a byte array, and this method only takes numeric types. So far I have: private void AddToByteArray<T>(byte[] destination, int offset, T toAdd) where T : struct { Buffer.BlockCopy(BitConverter.GetBytes(toAdd), 0, destination, offset, sizeof(toAdd)); } So basically my goal is that, for example, a call to AddToByteArray(array, 3, (short)10) would take 10 and store it in the 4th slot of array. The explicit cast exists because I know exactly how many bytes I want it to take up. There are cases where I would want a number that is small enough to be a short to really take up 4 bytes. On the flip side, there are times when I want an int to be crunched down to just a single byte. I'm doing this to create a custom network packet, if that makes any ideas pop in to your heads. If the where clause of a generic supported something like "where T : int || long || etc" I would be ok. (And no need to explain why they don't support that, the reason is fairly obvious) Any help would be greatly appreciated! Edit: I realize that I could just do a bunch of overloads, one for each type I want to support... but I'm asking this question because I want to avoid precisely that :)

    Read the article

  • Optimize apache for 10K+ wordpress views a day on 2GB RAM E6500 CPU

    - by Broke artist
    I have a dedicated server with apache/php on ubuntu serving my Wordpress blog with about 10K+ pageviews a day. I have W3TC plug in installed with APC. But every now and then server stop responding or goes dead slow and i have to restart apache to get it back. Heres my config what am i doing wrong? ServerRoot "/etc/apache2" LockFile /var/lock/apache2/accept.lock PidFile ${APACHE_PID_FILE} TimeOut 40 KeepAlive on MaxKeepAliveRequests 200 KeepAliveTimeout 2 StartServers 5 MinSpareServers 5 MaxSpareServers 8 ServerLimit 80 MaxClients 80 MaxRequestsPerChild 1000 StartServers 3 MinSpareServers 3 MaxSpareServers 3 ServerLimit 80 MaxClients 80 MaxRequestsPerChild 1000 StartServers 3 MinSpareServers 3 MaxSpareServers 3 ServerLimit 80 MaxClients 80 MaxRequestsPerChild 1000 User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} AccessFileName .htaccess Order allow,deny Deny from all Satisfy all DefaultType text/plain HostnameLookups Off ErrorLog /var/log/apache2/error.log LogLevel error Include /etc/apache2/mods-enabled/.load Include /etc/apache2/mods-enabled/.conf Include /etc/apache2/httpd.conf Include /etc/apache2/ports.conf LogFormat "%v:%p %h %l %u %t \"%r\" %s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %s %O" common LogFormat "%{Referer}i - %U" referer LogFormat "%{User-agent}i" agent CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined Include /etc/apache2/conf.d/ Include /etc/apache2/sites-enabled/

    Read the article

  • Migrating email forwarding entries from DirectAdmin to Google App (Free edition)

    - by bobo
    I have a website hosted in a shared hosting account and it contains a DirectAdmin (DA) control panel. From there, I can see some email forwarding entries. I would like to migrate the email server to the Google App's, I am going to change the MX records to point to Google email server in the DA. For the existing email accounts that I see in the DA, I will re-create them in the Google App. But for those email forwarding entries, I am confused. If I keep them there, will they still work after I have changed the MX record pointing to the Google email server? If not, this means I will need to re-create them in the Google App, right? Unfortunately, Google App (Free edition) does not seem to allow email forwarding like those in DA. Unless I choose to use other editons (http://www.google.com/support/a/bin/answer.py?answer=175745). In DA, when I have created an email forwarding entry such as [email protected] - [email protected], I do not really need to create a dummy [email protected] email account and DA will still do the forwarding properly. The best I can do now, without upgrading the Google App edition, is to simply create dummy email accounts in the Google App and setup forwarding inside that email account, is this correct?

    Read the article

  • How do I use the Microsoft IIS Diagnostics Toolkit to troubleshoot my problems?

    - by smartdirt
    I have downloaded the [IIS Diagnostics Toolkit (x86)][1] [1]: http://www.microsoft.com/downloads/en/details.aspx?familyid=9bfa49bc-376b-4a54-95aa-73c9156706e7&displaylang=en and I was wondering how to use it. I'm not a system admin just a developer trying to work my way around a strange problem. I have an iis server running php(not my choice) and every once in a while the application will not allow anyone to log in and then a little while later it just starts working again. I look in the event viewer and don't see anything and the iis logs are no help either. I read somewhere about someone using the the toolkit to diagnose there problem. I just need a little guidance on how to use this tool. Thanks.

    Read the article

  • HTG Projects: How to Create Your Own Custom Papercraft Toy

    - by Eric Z Goodnight
    Graphics programs aren’t simply for just editing your photos—they can have whatever fun application you can think of. For a fun, geeky project, here’s a simple papercraft toy you can make with a printer and simple household tools Latest Features How-To Geek ETC How To Boot 10 Different Live CDs From 1 USB Flash Drive The 20 Best How-To Geek Linux Articles of 2010 The 50 Best How-To Geek Windows Articles of 2010 The 20 Best How-To Geek Explainer Topics for 2010 How to Disable Caps Lock Key in Windows 7 or Vista How to Use the Avira Rescue CD to Clean Your Infected PC The Deep – Awesome Use of Metal Objects as Deep Sea Creatures [Video] Convert or View Documents Online Easily with Zoho, No Account Required Build a Floor Scrubbing Robot out of Computer Fans and a Frisbee Serene Blue Windows Wallpaper for Your Desktop 2011 International Space Station Calendar Available for Download (Free) Ultimate Elimination – Lego Black Ops [Video]

    Read the article

  • ???????!DB??/SSD???~2010?12??????????(???)

    - by Yusuke.Yamamoto
    2010?12???????????(???)?????????????????? ??????????????????????????????????? ???????????????????? SQL?????????? Part1~5????????????????Part4?Part5?????????? ???????????????????????????????????????????????????SSD??????? ?????????????? ????????Oracle GoldenGate:?????!! DB??/Upgrade????????? ??????????????????????????SSD???????????? - Oracle Real Application Clusters 11g Release 2 on Oracle VM with Database Smart Flash Cache ?? ???? ???? ??? ?????? ??????????????!? Oracle Database 11g Release2 - Windows? ??????????? ??? ??????(RAC) ?????????Oracle Database 11gR2 RAC ?????????·??? ASM ? Microsoft Windows x86-64 ??? ?????? ??????Oracle Database 11gR2 Oracle Grid Infrastructure ?????? ??? ???? ???????????????!? ?????????? ??? ??????? ??????Oracle Database 11gR2 ???????????????? ??? ?????? ???????/?????!! ??????·???? ~?????RMAN????~?Oracle???????? ??? ??????? ???????/??????????!? ???????·?????????Oracle???????·??????(????)?? ??? ??????? ???????/????????????????? SQL????????? ??? Part1&2 New!???????????????SQL?????? ??? ??? ???????/??????!Oracle Database????!? ??? Oracle Enterprise Manager ?????????Oracle Enterprise Manager 11g Release 1 Grid Control(11.1.0.1.0) for Linux x86-64 ?????????

    Read the article

  • Adobe Air apps on the Mac App Store?

    - by coneybeare
    Before you chastise me for asking this, I have an Adobe Air app that has a lot of investment in it, and if there is a way to utilize the existing code-base in any way, it is worth considering. I have heard news reports in passing about Adobe creating some kind of tool to allow flash or air apps to be ported to native objective-c code, but the information found in google is mostly commentary on the one-time Apple blockade. My question(s) is/are this: Is it even possible, at any level, to use an existing Air app to create a Mac Store app? If possible, what are the resources I can use to accomplish this?

    Read the article

  • Installed Sun Java 6 - configuration problem when running as sudo

    - by HorusKol
    I have install Sun Java 6 on an Ubuntu server and set an environment variable in the default profile as per the instructions at http://www.edugate.ie/workshop-guides/shibboleth-2-identity-provider-installation-linux-debian-or-ubuntu I then try to run an installer for a Java servlet - but when I run it as myself, it cannot create the required directory in /opt. When I run it as sudo, I am told that JAVA_HOME is not correct and it doesn't even start the installer - shouldn't this be coming from /etc/profile like it is for my normal user?

    Read the article

  • virtualbox host | Ubuntu vs XP

    - by iambriansreed
    In order to lengthen the lifespan of my machine I am replacing the weakest link, the hard drive and installing a new OS. I had planned on using xp pro as my virtualbox host and ubuntu as guest. After messing with ubuntu desktop and server I am really impressed and am thinking of reversing the virtualbox setup; ubuntu host xp guest. I would use XP for Adobe Fireworks, Netflix, and iTunes (maybe) that's pretty much it. Any reason not to do ubuntu host with xp guest? I know the xp vbox will run slower as a guest but really how much slower? It's a desktop. 4gb ram, 500gb disk, Pent D 3.2 ghz

    Read the article

  • Forwarding a subdomain to main domain using Godaddy.

    - by Ryan Hayes
    I have current blog, which was hosted on Tumblr at http://blog.ryanhayes.net. I'm moving it over to http://ryanhayes.net, and have all the 301 redirects set up for the blog entries to map to my new blog, which is hosted using Godaddy (domain included). When I try to set up a subdomain forward, I'm greeted with a nice 403 Forbidden response (as of this writing, you can see it at http://blog.ryanhayes.net. When I try to ping both the subdomain and domain, they point to the same IP address, so I know blog subdomain has at least switched over to point to the same content. I don't really understand why I would get a 403 Forbidden on the same content that I can see perfectly fine via another domain. Currently, I have a CNAME of blog pointing to @, which is how "www" is set up to forward, so I'm assuming it would do the same thing. My question is what is the proper way to set up my DNS to make the blog subdomain forward to my main domain (301) using the GoDaddy DNS manager? Bonus: What is the background on why I am getting a 403 error the current way? Forbidden You don't have permission to access / on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. UPDATE 12/7/2010 Error on site has been fixed, you can no longer view it from my site.

    Read the article

  • Why does my domain not show up in Google anymore?

    - by Earlz
    So I have had a website since about 2006. It's http://earlz.biz.tm . Recently I've noticed that no results will show up for it in google. I do have a secondary domain(that I plan on getting rid of) pointing to it but I don't understand why google would suddenly not show my site. I believe it was showing up a few months ago and my website is hardly ever down, like one or two days I believe has been the most it's been down in a row in this time period. Is there something wrong with my DNS or other configuration that would make google not index me? For reference I've tried: earlz.biz.tm site:earlz.biz.tm and the heading from my site "Earlz.biz.tm -- The reasoning is bacon" A few show up with the therusticstone.com domain(the one I plan to point somewhere else) but none show up directly linking to earlz.biz.tm.

    Read the article

  • Help with Magento and related products

    - by Anthony
    I have a customer product page that literally lives beside the catalog/product/view.phtml page. It's basically identical to that page with a few small exceptions. It's basically a 'product of the day' type page so I can't combine it with the regular product page since I have to fetch the data from the DB and perform a load to get the product information $_product = Mage::getModel('catalog/product')->load($row['productid']); To make a long story short, everything works (including all children html blocks) with the singular exception of the related products. After the load I save the product into the registry with Mage::register('product', $_product); and then attempt to load the related products with: echo $this->getLayout()->createBlock('catalog/product_view')->setTemplate('catalog/product/list/related.phtml')->toHtml();` All of which give back the error: Fatal error: Call to a member function getSize() on a non-object in catalog/product/list/related.phtml on line 29`, and line 29 is <?php if($this->getItems()->getSize()): ?>`. Any help getting the relateds to load would be appreicated.

    Read the article

  • Is there a "fancy" Ruby way to check whether a local variable is both defined and evaluates to true without using ands and ors?

    - by Steven Xu
    This is quite a quick question. I currently use do_this if (testvar ||= false) Which works just fine. But this approach unnerves me because while fast, it does not short-circuit like defined?(testvar) && testvar does, and it instantiates and assigns a value to a local variable that is subsequently never used, which seems inefficient. I enjoy the very reasonable fact that instance variables are nil before assignment, but I'd like for the situation to be just as easy for local variables.

    Read the article

  • Are their any good way to genrate XML file through C# in .net

    - by steven spielberg
    i wanto make a xml file like <?xml version="1.0" encoding="Windows-1252" ?> <settings> <typeofsetting> <wordname="add" /> </typeofsettings> </settings> the wordname can be depend on what user need. how i can make a application that user can generate the XML file of thing they want. are their any good way to do this. the wordname not user defined it's come from database the application have inbuilt. are their any good practice to do this in c# win-forms.

    Read the article

  • Touch and Drag from one view to another

    - by jollyCocoa
    Hi all! I've search for some clues on this problem without much success. Hope someone can kick me in the right direction. I am prototyping a couple of apps where I need to design my own GUI. The GUI is made up by two separated UIViews where one of them contains a small thumb of an image. I want to be able to drag this thumb from the first view to the other. Simple as that! But I haven't figured out how this is done. Here is the exact flow I am looking for: touch the thumb animate a small enlargement of the thumb drag the thumb to the other UIView drop the thumb animate a shrink of the thumb Not particularly strange, but the thumb remains related to the first view all the time. I've tried to move the thumb via the first views superview and then back to the second view, but with no luck.

    Read the article

  • Should I use threeten instead of joda-time

    - by Yan Cheng CHEOK
    Hello all, I came across http://www.jroller.com/scolebourne/entry/why_jsr_310_isn_t. 1) I am currently migrating Java Calendar to joda-time. I was wondering, should I use threeten instead of joda-time? Is threeten production ready? 2) Can threeten library and joda-time libraries exist together in a same application? As I am using some 3rd parties libraries, which is using joda-time library too. 3) Will joda-time become an abandon project since there is threeten? Thanks.

    Read the article

  • facebook connect for android returns a blank login screen?

    - by jonney
    Hi, i am trying to use the old facebook connect authentication to authenticate my android client to get the necessary session id's and other credentials thats needed to start using the web service of facebook. the issue i am having is that when my android application launces and tries to load the login page for facebook, that very same login page is blank and it only displays the the facebook logo as the title of the screen. No login fields or buttons are visible leaving me nowhere to login and authenticate a user. i have tried two API's one is facebook connect api for android http://code.google.com/p/fbconnect-android/ and the other one is the official android facebook sdk that is recommended to be used instead of the previous one i have just mentioned https://github.com/facebook/facebook-android-sdk/ . please see the image below of how it looks like on my app. Here is code that uses the latest android sdk facebook: /** * Authenticate facebook network */ private void authenticateFacebook() { // TODO: move this away from this activty class into some kind of // helper/wrapper class Log.d(TAG, "Clicked on the facebook"); Facebook facebook = new Facebook(OAUTH_KEY_FACEBOOK_API); facebook.authorize(this, new AuthorizeListener()); } class AuthorizeListener implements DialogListener{ @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub Log.d(TAG, "finished authorizing facebook user"); } @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub } @Override public void onError(DialogError e) { // TODO Auto-generated method stub } @Override public void onCancel() { // TODO Auto-generated method stub } } And a simple example of how to use it: http://developers.facebook.com/docs/guides/mobile/ My code is more or less identical to the above example. edit: i did not catch what logcat was inputing in my first attempted at my code above but their was no exceptions or warnings thrown at the time. just a blank page. i then tried it again and diddnt touch my code and what happens now is that a loading dialogue view pops up and stays their for a few minutes until the facebook windows disapears and the logcat outputs the error below: 11-18 17:26:19.913: DEBUG/Facebook-WebView(783): Webview loading URL: https://www.facebook.com/dialog/oauth?type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess&display=touch&client_id=e??????????????????? 11-18 17:27:01.756: DEBUG/Facebook-authorize(783): Login failed: com.kc.unity.agent.util.oauth.facebook.DialogError: The connection to the server was unsuccessful. 11-18 17:27:01.783: DEBUG/Facebook-WebView(783): Webview loading URL: https://www.facebook.com/dialog/oauth?type=user_agent&redirect_uri=fbconnect%3A%2F%2Fsuccess&display=touch&client_id=??????????????? please note that the client id i have amended for obvious reasons but the rest of the logcat is untouched

    Read the article

  • how to find number of weekdays in array

    - by Chamal
    i hav a array of date. In this array, i want to find how many weekdays in that array. So how can i do that using java.. *here i read lines from csv file & put those into values. *values[2] contain the dates of that csv file. *So now i want to find number of weekdays in values[2]. FileInputStream fis=new FileInputStream("c:/sample.csv"); InputStreamReader isr=new InputStreamReader(fis); BufferedReader bf = new BufferedReader(isr); while (bf.ready()) { String line = bf.readLine(); String[] values=line.split(","); String date=values[2]; }

    Read the article

  • Keeping some files private

    - by user490895
    Hi, I was trying to create a directory of private files that could only be accessed when a user logs in. To do this, I used a folder outside the web directory, and then php to access it, if allowed. Here's an example: function display_movie($file){ printf("<video id='movie' width='960' height='416' controls='controls' onerror='fix()'> <source src='movie.php?file=%s' type='video/ogg; codecs=\"theora, vorbis\"'> </video>", rawurlencode($file)); } This works great for images, but breaks the media player. Also, I've only tested this locally on a Linux machine. Any ideas? Thanks.

    Read the article

  • Getting text values of li (even nested) in JQuery

    - by Tahir Akram
    Hi; <ul> <li class="item-i">AI</li> <li class="item-ii">AII <ul class="level-2"> <li class="item-a">A</li> <li class="item-b">B</li> <li class="item-c">C</li> </ul> </li> <li class="item-iii">III</li> </ul> How can I get values AI AII A B C III? What I tried so far is following: $(document).ready(function() { $('li').each(function(index) { alert($(this).text()); }); }); But it does not gave me required results. When it reaches "item-ii" it gave all result. I want item one by one.

    Read the article

  • search substring from mutable array in iphone

    - by user566431
    how to search substring from mutable array? NSMutableArrray names having string values, searchText is a substring to search from name array values. for (NSString *sTemp in names) { NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch]; //NSLog(@"sTemp = %@, searchText = %@",sTemp,searchText); NSLog(@"%@",titleResultsRange.length); if (titleResultsRange.length > 0) [Items addObject:sTemp]; }

    Read the article

  • Wpf- Is there any way to disable some of the default hotkeys in a RichTextBox?

    - by Justin
    I have several keybindings in my text editing application that no longer work now that I have switched from using a regular textbox to using a richtextbox. This is because the wpf richtextbox has several default hokeys such as "Ctrl+1", "Ctrl+2", and "Ctrl+5". My keybindings are defined in a view that contains the view that the richtextbox is in. I can't move the keybindings to the richtextbox; Is there any fix for this problem? Other than using a third-party control or creating my own richtextbox from textboxbase.

    Read the article

  • Copying files from one directory to another in Java

    - by user42155
    Hello, I want to copy files from one directory to another (subdirectory) using Java. I have a directory, dir, with text files. I iterate over the first 20 files in dir, and want to copy them to another directory in the dir directory, which I have created right before the iteration. In the code, I want to copy the review (which represents the ith text file or review) to trainingDir. How can I do this? There seems not to be such a function (or I couldn't find). Thank you. boolean success = false; File[] reviews = dir.listFiles(); String trainingDir = dir.getAbsolutePath() + "/trainingData"; File trDir = new File(trainingDir); success = trDir.mkdir(); for(int i = 1; i <= 20; i++) { File review = reviews[i]; }

    Read the article

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