Daily Archives

Articles indexed Tuesday December 18 2012

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

  • Design patterns to avoiding breaking the SRP while performing heavy data logging

    - by Kazark
    A class that performs both computations and data logging seems to have at least two responsibilities. Given a system for which the specifications require heavy data logging, what kind of design patterns or architectural patterns can be used to avoid bloating all the classes with logging calls every time they compute something? The decorator pattern be used (e.g. Interpolator decorated to LoggingInterpolator), but it seems that would result in a situation hardly more desirable in which almost every major class would need to be decorated with logging.

    Read the article

  • Is C++11 Uniform Initialization a replacement for the old style syntax?

    - by Robert Dailey
    I understand that C++11's uniform initialization solves some syntactical ambiguity in the language, but in a lot of Bjarne Stroustrup's presentations (particularly those during the GoingNative 2012 talks), his examples primarily use this syntax now whenever he is constructing objects. Is it recommended now to use uniform initialization in all cases? What should the general approach be for this new feature as far as coding style goes and general usage? What are some reasons to not use it? Note that in my mind I'm thinking primarily of object construction as my use case, but if there are other scenarios to consider please let me know.

    Read the article

  • If you need more than 3 levels of indentation, you're screwed?

    - by jokoon
    Per the Linux kernel coding style document: The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program. What can I deduce from this quote? On top of the fact that too long methods are hard to maintain, are they hard or impossible to optimize for the compiler? I don't really understand if this quote encourages better coding practice or is really a mathematical / algorithmic sort of truth. I also read in some C++ optimizing guide that "dividing up a program into more functions improves its design" is frequently taught in CS courses, but it should be not done too much, since it can turn into a lot of JMP calls (even if the compiler can inline some methods by itself).

    Read the article

  • Bash script using eyeD3 to remove extra tags from mp3 files

    - by jaguare22
    I found what looks like the perfect script for this but getting errors. Hoping someone can see problem. I am running 12.04 Server. Error is - awk: line 0: regular expression compile failed (missing '(') ): awk: line 0: regular expression compile failed (missing '(') ) The following tags have been found in the mp3s: These tags are to be stripped: Here is a the script obtained from savvyadmin !/bin/bash Script name: strip-tags.sh Original Author: Ian of DarkStarShout Blog Site: http://darkstarshout.blogspot.com/ Options slightly modified to liking of SavvyAdmin.com oktags="TALB APIC TCON TPE1 TPE2 TPE3 TIT2 TRCK TYER TCOM TPOS" indexfile=mktemp Determine tags present: find . -iname "*.mp3" -exec eyeD3 --no-color -v {} \; $indexfile tagspresent=sort -u $indexfile | awk -F\): '/^<.*$/ {print $1}' \ | uniq | awk -F\)\> '{print $1}' | awk -F\( '{print $(NF)}' \ | awk 'BEGIN {ORS=" "} {print $0}' rm $indexfile Determine tags to strip: tostrip=echo -n $tagspresent $oktags $oktags \ | awk 'BEGIN {RS=" "; ORS="\n"} {print $0}' | sort | uniq -u \ | awk 'BEGIN {ORS=" "} {print $0}' Confirm action: echo echo The following tags have been found in the mp3s: echo $tagspresent echo These tags are to be stripped: echo $tostrip echo echo -n Press enter to confirm, or Ctrl+C to cancel... read dummy Strip 'em stripstring=echo $tostrip \ | awk 'BEGIN {FS="\n"; RS=" "} {print "--set-text-frame=" $1 ": "}' First pass copies any v1.x tags to v2.3 and strips unwanted tag data. Second pass removes v1.x tags, since I don't like to use them. Without --no-tagging-time-frame, a new unwanted tag is added. :-) find . -iname "*.mp3" \ -exec eyeD3 --to-v2.3 --no-tagging-time-frame $stripstring {} \; \ -exec eyeD3 --remove-v1 --no-tagging-time-frame {} \; echo "Script complete!"

    Read the article

  • mail server crash

    - by waxx
    i have a mail server running ubuntu 12.04. my server has a main 200gb hdd as the /, and other scsi hdd. as far as i recall, i used the 5 scsi harddrives for different mount points.. 1 hard drive is /swap, 1 hard drive is /usr ...the other is /boot, i cant recall the other 2.. just yesterday, my /usr drive died... and it wont let me boot into the server.. ive tried to skip mounting the /usr with the S option when i go to recovery drive, but the server still wont boot up. i need help badly because the server needs to be up and running ASAP. thank you for all the help.

    Read the article

  • How to get hp printer to select correct trays on samba shared printer

    - by dgermann
    My first post here. Clean install of 12.04.1. Previously 10.04. Have been running a p2035n printer without problem. Now, no matter what paper tray I select it prints to the top "by-pass" feeder--not the lower main tray. And when I select to print to manual feed, it does not wait for me to put in paper (like it used to), but prints immediately. The printer is on a samba share and is physically plugged into a WinXP machine. Its uri is smb:///computername/p2035n. I have tried several of the offered drivers for this hp machine, and even tried generic-laser. Same result on all. Here are some other things I have tried (losing 2-3 hours of my time!): hp-check -t reports “error: User needs to be member of group 'lp' to enable print, scan & fax. ” and “warning: Printer is not HPLIP installed. Printers must use the hp: or hpfax: CUPS backend to function in HPLIP.” needed to download HPLIP 3.12.11 followed http://hplipopensource.com/hplip-web/install/install/index.html sh hplip-3.12.11-run says that before setup logout and then on login run hp-setup hp-setup could not find the printer ran hp-check -t again, found I was not in group lp ran hp-check --fix and it fixed that problem, asks for reboot rebooted after running update manager (new kernel) and hp-check -t shows no errors this time all the tray selections end up on the bypass tray hp-setup still cannot find the printer So is there a way to make this work? Thanks! :- Doug.

    Read the article

  • Ubuntu not picking up wireless networks [Ubuntu 12.10]

    - by user114772
    i am new to Ubuntu & just installed it on my DELL mini laptop, when i open the network tab it does not show the wireless networks around me, neither does it show mine, i have enabled networking but it still does not pick up any wireless. I am pretty sure my wireless network is not hidden, since i can connect to it on my other laptop, anyone have any idead on what i could be? It worked once when i was running Ubuntu on my USB, but when i installed it to the hard drive as a main OS it did not list any wireless networks.

    Read the article

  • Login Screen returns to login screen

    - by AbeFM
    After many many reboots in a couple days while experimenting with BIOS settings effecting the speed Hardbrake runs at, today I find after a reboot that I have to type in password to log in - ordinarily I have this disabled. When I DO enter my password, it goes to a black screen for a bit, then returns. I can log in as guest, which does the same thing (minus the password) and if I use the wrong password, it complains instead of doing the same. Using the install disc, I see three partitions on my drive, a ~200 MB boot sector, and two 32 GB (one extended) which seem to share the rest of the SSD. Running FSCK seems to generate tons of errors. The odd bits: All my background stuff is running - I can access stuff served by Subsonic, and see network shares from my windows machines. I can log in in another terminal and do stuff... I just can't get into the GUI/OS proper. Sort of at a loss where to start. Would be happy to free drive of errors if I could (I've another machine, I could mount drive over USB and check it), but it seems everything else is working? edit: Screensaver also seems to kick on, even from fsck's run from the boot menu. i3-2100t, H67 chipset I believe, 12.10, everything's been working fine for the better part of a year. Seen several similar topics, but either they turn out to be something unrelated (fresh install or known graphics issues) or there are no answers. I'm happy to get any logs/info anyone want.

    Read the article

  • accessing live usb files from new hd ubuntu install

    - by Robin Bailey
    After my live USB (ubuntu 12.04 lts) refused to boot, I proceeded to install the same Ubuntu version on the laptop hard drive (a dual boot next to Win xp). This all went well without a hitch. Previous to this, I spent several weeks enjoying and exploring ubuntu from the usb pendrive. During this time I changed lots of settings and customized Firefox and more. Now, I'd like to import the home folder from the usb drive into the new install home folder on the hard disk, which is the purported folder that holds all those special settings to my knowledge. Unfortunately and only being familiar with Windows file systems, the view of the usb file system from the new hdd install is totally perplexing. I can't find anything that looks anywhere close to the original file system. More, I can't find any of the files I had created and stored there, like the LibreOfficeCalc file that has all my passwords (this one is really discouraging) that was stored on the ubuntu desktop. Help me find this file alone and I'll bow down with full apologies to any and all computer gods. Being able to import all those customizing settings into the new install would be a major bonus also, but hey, I'm not greedy. I'll take the passwords file and be happy! And humble! I would be very grateful for some clear, understandable help on this. Thanks

    Read the article

  • What is the most secure environment for multiple CMS sites? [closed]

    - by Brian Gulino
    I wish to run about 50 Joomla or WordPress low-traffic websites on 1 server, or part of a server. Each website will be managed by its own, naive owner who will have be able to access the Joomla or Wordpress backend of the website. I am concerned about security and isolation as my users will periodically get into trouble by not protecting their sites properly. Two alternatives I know of exist: Run one Linux system with multiple websites under Apache. Follow current Joomla and WordPress security tips. Increase the isolation of the individual sites by using mpm-itk, which will allow each website to run as its own user. The alternative to this is to run virtualization software such as the Xen hypervisor. Each site would have its own, virtual Linux system. I lack the experience needed to make this decision and I am asking which path to take. Obviously, there may be other alternatives that I haven't considered.

    Read the article

  • What is this thing called?!?! (bottom of screen popup)

    - by NRGdallas
    I am looking for the name and some possible jquery libraries etc for the standard bottom of screen popup bar. Its like a little bar that pops out on the bottom of the screen after X seconds or however really - generally slides up, about 50px or so high, and usually the length of the main container. used for some form of coupon advertisement or various promotion text etc. What is the proper term for this item, and would there be any good references to best-use guidelines?

    Read the article

  • Command Pattern refactor for input processing?

    - by Casey
    According to Game Coding Complete 4th. ed. processing input via the following is considered unmanagable and inflexible. But does not show an example. I've used the Command pattern to represent GUI button commands but could not figure out how to represent the input from the keyboard and/or mouse. if(g_keyboard->KeyDown(KEY_ESC)) { quit = true; return; } //Processing if(g_keyboard->KeyDown(KEY_T)) { g_show_test_gateway = !g_show_test_gateway; } if(g_mouse->ButtonDown(a2de::Mouse::BUTTON2)) { g_selected_part = GWPart::PART_NONE; SetMouseImageToPartImage(); } ResetButtonStates(); g_prevButton = g_curButton; g_curButton = GetButtonHovered(); if(g_curButton) { g_mouse->SetImageToDefault(); if(g_mouse->ButtonDown(a2de::Mouse::BUTTON1) || g_mouse->ButtonPress(a2de::Mouse::BUTTON1)) { ButtonPressCommand curCommand(g_curButton); curCommand.Execute(); } else if(g_mouse->ButtonUp(a2de::Mouse::BUTTON1)) { if(g_prevButton == g_curButton) { ButtonReleaseCommand curCommand(g_curButton); curCommand.Execute(); if(g_curButton->GetType() == "export") { ExportCommand curCommand(g_curButton, *g_gateway); curCommand.Execute(); } } else { ResetButtonStates(); } } else { ButtonHoverCommand curCommand(g_curButton); curCommand.Execute(); } } else { g_status_message.clear(); SetMouseImageToPartImage(); if(g_mouse->ButtonDown(a2de::Mouse::BUTTON1)) { CreatePartCommand curCommand(*g_gateway, g_selected_part, a2de::Vector2D(g_mouse->GetX(), g_mouse->GetY())); curCommand.Execute(); } }

    Read the article

  • Where to generate data in an Entity-Component System?

    - by Mark Mandel
    So I'm making a small game where I generate 2D landscape using perlin noise when the game first loads. I've got it working in a OO way, but want to move over to an ES architecure, and I'm just struggling to work out the right place for the code that does the generation to go? In OO world, I have a World object which gets passes a coordinate value that is used as the seed for the perlin noise, and generates all the points for the land mass when the world is created. I'm thinking I need a World component with a coordinate field on it - that's an easy part. From there - is it right for a component to generate data when it's first initialised (or is that too OO?)? Or should a System be doing that instead, when the game first starts? Or... some other solution I'm not aware of? Thanks in advance for any guidance.

    Read the article

  • XNA 2D Spritesheet drawing rendering problem

    - by user24092
    I'm making a tile-based game, using one spritesheet containing all tile graphics. Each tile has a size of 32x32 pixels. The main problem is: when I draw the tile to the screen, if the tile position x and y are not rounded or if scale is activated in spriteBatch.Draw() method (scale != 1.0f), I get some lines of adjacent tiles on the spritesheet into the current tile drawed. I already tried setting SamplerState to PointClamp, removing AntiAlias, but still doesn't work. Here I'll show images of some tests that I made, with a test sprite sheet that I've created (I made a 9x9 spritesheet, with each sprite of size 32x32 containing a unique solid color). Tests: http://img6.imageshack.us/img6/5946/testsqj.png SpriteSheet used: http://imageshack.us/a/img821/1341/tilesm.png Already tried to remove anti-alias, set PointClamp as sampler state, but still getting this issue, XNA keeps drawing part of the adjacent pixels of the texture on the screen. What I want is to get the correct area of the tilesheet texture (as seen in the first test, that gets just the yellow pixels). My question is: Is there any way that I can fix this, WITHOUT adding tile spacing or any other modification involving the tilesheet? Maybe disabling a texture filtering that is done by XNA, or something like that.

    Read the article

  • Cannot create a neutral unit with a trigger

    - by Xitcod13
    I've been playing around with the starcraft UMS (Use map settings) for a while and usually i figure things out pretty quickly when im stuck. Alas not this time. I'm trying to place a neutral unit (player 12) using a trigger. It refuses to work. I'm using Scmdraft 2.0 as my editor (but i cant get it to work in other editors either) (all neutral units placed before the game starts are visible and all other triggers work fine. Also i created a text msg and it does displays it in-game so the trigger triggers ) For testing I created a trigger that looks like this: Player: neutral (i tried neutral players player 1 and all players as well) Condition: -always Action: -Create *1 Terran Medic* at '*location 022*' for *Neutral* (also tried neutral players) When I start the game nothing happens. Here is what I tried: I tried placing a start location for neutral player (player 12) I tried changing the owner under map properties of player 12 to neutral and computer from unused which was the default. Although it seems like it should be a common enough problem, I don't see it in any FAQ and I cant find anything about it when I Google it. Thanks in advance.

    Read the article

  • simple query Delete records in a table based on count logic

    - by user1905941
    a table with a pk and status column which is having values as 'Y','N','NULL' Query: get the count of records with status column as 'Y', if this count exceeds 1% of total count of records then dont delete , else delete the records in the table. i tried like this Declare v_count Number; v_count1 Number; BEGIN v_count := select count(*) from temp; v_count1 := select count(*) from temp where status = 'Y' ; v_count := v_count + ((0.1) * (v_count)) if (v_count1 > v_count) { insert into temp1 values(pk,status) } else { Delete from temp ; } END;

    Read the article

  • Facebook login on headless browser

    - by dmni
    My Facebook app has a function of automating tasks on server side headless browser (like visiting app links). Now, I use the Facebook SDKs to log user in and access user's news stream to search for links and other information. Once the app has found all the links, it is supposed to pass this information in to the headless browser which will then proceed to visit in them for example. The problem is that these headless browser windows' are not logged in. I would like the headless browser to be temporary logged in as the user launching the tasks from the app. Is this possible?

    Read the article

  • POST and redirect in Wordpress

    - by agh
    With Wordpress based function: $response = wp_remote_post() I can POST data and retrieve the body of the POST page in $response-body But how can I POST and redirect the user to the post page? It's not an option to create Form page and Submit button because I'm trying to create a plugin for Group buying plugin in Wordpress. It is also not an option to use GET, because the "destination" POST page will not allow data in the URL. Please help me !

    Read the article

  • I am trying to link my php form and my sql but having difficulties

    - by user1912599
    I am not sure what I am doing wrong as far as my php goes but I can't get my form to link with my sql. Here are the codes for my form and php code for my link to sql <?php echo displayform(); function displayForm() { $r = ''; //build it $r .='<form action="database.php" method="post">'; //table $r .=displayNiceFormBegin(); $r .=displayRow('FirstName:', '<input type="text" name="fname" id="fname"/>'); $r .=displayRow('LastName:', '<input type="text" name="lname" id="lname"/>'); $r .=displayRow('Address:', '<input type="text" name="address" id ="address"/>'); $r .=displayRow('Phone:', '<input type="text" name="phone" id ="phone"/>'); $r .=displayRow('Deparment:', '<input type="text" name="department"id="department"/>'); $r .=displayRow('', '<input type="submit" value="Submit Registration" />'); $r .=displayNiceFormEnd(); $r .='</form>'; return $r; } function displayRow($left, $right) { $r .= ''; //build it $r .='<tr>'; $r .= '<td>' . $left . '</td>'; $r .= '<td>' . $right . '</td>'; $r .='</tr>'; return $r; } function displayNiceFormBegin(){ $r .=''; //build it $r .= '<table style="background-color: beige; border: 1px dashed #999"><tr><td>'; $r .='<table style="margin:10px">'; return $r; } function displayNiceFormENd() { $r .=''; //build it $r .='</table>'; $r .='</td></tr><table>'; return $r; } ?> <?php $host="localhost"; // Host name $username="695788_ogems"; // Mysql username $password="opd69715"; // Mysql password $db_name="ottawaglandorfems_zzl_ogems"; // Database name $tbl_name=".*"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Get values from form $fname=$_POST['fname']; $lname=$_POST['lname']; $address=$_POST['address']; $phone=$_POST['phone']; $department=$_POST['deparment']; // Insert data into mysql $sql="INSERT INTO $tbl_name(FirstName,LastName,Address,Phone,Department)VALUES('$fname', '$lname', '$address','$phone','$deparment')"; $result=mysql_query($sql); // if successfully insert data into database, displays message "Successful". if($result){ echo "Successful"; echo "<BR>"; echo "<a href='ottawa-glandorfems.org/form3.php'>Back to main page</a>"; } else { echo "ERROR"; } ?> <?php // close connection mysql_close(); ?> I keep getting an error. Thank you!!!!

    Read the article

  • Icon(s) not replaced - Still getting error with tycho 0.16.0 unless it should be fixed

    - by Dactabird
    I'm using Tycho 0.16.0 and still getting the following Error: Error - 7 icon(s) not replaced in C:\Users\weich01\AppData\Local\Temp\p2.brandingIron8219115442087687624\launcher.exe using C:\Development\Workspaces\Workspace RCP SR2\de.mycompany.myproduct.product\target\products\MyProduct\de.mycompany.myproduct.feature\logo_pms_2011.ico This error should be fixed in v0.16, shouldn't it? With eclipse export everything works fine, so product definition is correct. The icon file contains bmp in all sizes. Thanks for your help

    Read the article

  • How to use the Response from PHP in Objective-C?

    - by iMohammad
    I've managed to post and get datas from PHP thru objective-c. However, the response from the server looks like the following: ["ARC101","ARC112","ARC124","ARC203","ARC222","ARC251","ARC281","ARC305","ARC314","ARC344","ARC353","ARC363","ARC408","ARC416","ARC426","ARC482"] And, some responses could be more complicated like the following: [{"Code":"ARC101","Title":"Design Studio-I: Design Princi","Instructor":"Mike Cohen","Activity":"LAB","Days":"MW","Room":"B01","Bldg":"19","Section":"1","StartTime":"1310","EndTime":"1550","CallNo":"20438","Priority":null,"Open":"Open","HasAct":false,"CodeAct":null,"TitleAct":null,"InstructorAct":null] What would be your suggestion if I want to play with these datas? for example, putting them on a table ,etc. Thanks in Advance!

    Read the article

  • sql statement to access sql

    - by Mitch Albert
    SELECT eventID, eventRedacteur, eventEvenement, eventGenreId, eventDatum, eventLocatieId, eventLocatieNaam, eventPlaatsId, eventBijzonderheden, eventBezoekers, lokId, lokNaam, lokUrl, pltsId, (SELECT pltsNaam FROM tblAgendaPlaatsen WHERE pltsId=tblAgendaPunten.eventPlaatsId) AS eventPlaatsNaam, (SELECT genreNaam FROM tblAgendaGenre WHERE genreId=tblAgendaPunten.eventGenreId) AS eventGenre, lokadres, lokhuisnr FROM tblAgendaPunten LEFT JOIN tblAgendaLocaties ON eventLocatieId=tblAgendaLocaties.lokId i get a join not supported error. I also tryed to remake the sql in access, but no luck. Anyone can help?

    Read the article

  • Vb net textbox cursor position always 0 after databinding

    - by user1166557
    please help me with the following if you can, i have the simple following command me.textbox1.databindings.clear me.textbox1.databindings.add("text",TicketsBindingSource,"TicketSubject") the command exeutes succesfully and i can see in the textbox the title, BUT once i click on the textbox1 the position of the cursor it's always moving to the position 0 and not to the area of the textbox i clicked. For example my textbox has the following text: "Hello World". If i click with my mouse inside the textbox at the letter W or anywhere i click the cursor is moving to the 0 index. eg. at the beggining , in order to move my cursor left or right i have to do that with my keyboard arrows keys, Dose anybody know how i can solve this issue?

    Read the article

  • how to read xml properties value?

    - by bala
    I have xml file in sdcard(xxx.file) how to read all the xml tag properties values starting point to end point and prints that value please help me I am not familiar in xml pullparser please help me... This is my xml file code: <?xml version="1.0"?> <layout schemaVersion="1" width="800" height="450" bgcolor="#000000"> <region id="47ff29524ce1b" width="800" height="450" top="0" left="0" userId="1"> <media id="9" type="image" duration="30" lkid="4" userId="1" schemaVersion="1"> <options><uri>9.png</uri></options> <raw/> </media></region></layout> java code: public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try{ XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser parser = factory.newPullParser(); File file = new File(Environment.getExternalStorageDirectory()+ "/xxx.xml"); FileInputStream fis = new FileInputStream(file); parser.setInput(new InputStreamReader(fis)); }catch(XmlPullParserException e){ e.printStackTrace(); }catch(FileNotFoundException e){ e.printStackTrace(); } } }

    Read the article

  • webview in tabhost

    - by user1905845
    I am new to android. I am using webview inside tabview. In my app in first activity facebook button available.when click facebook button connect to facebook in second activity inside tabs fine.In second activity i am using webview. this is the code. public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.facebook); wvFacebook=(WebView)findViewById(R.id.webview); btnBack=(Button)findViewById(R.id.back); txtBarname=(TextView)findViewById(R.id.barnameheader); if(check==1){ strFacebook=MyBarsActivity.strFacebook; Log.e("Facebook url",strFacebook); strBarName=MyBarsActivity.strBarName; } wvFacebook.setWebViewClient(new MyWebViewClient()); wvFacebook.loadUrl(strFacebook); } private class MyWebViewClient extends WebViewClient { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.getSettings().setJavaScriptEnabled(true); view.loadUrl(url); return true; } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); // progressDialog.show(getParent(), "In progress", "Loading, please wait..."); } public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); } But my problem is when i click connect button facebook page will be displayed well inside tabs.But when i click emial or username and password button it is not responding.Why it is not responding please help me regarding this.thanks in advance.

    Read the article

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