Search Results

Search found 88 results on 4 pages for 'cw'.

Page 1/4 | 1 2 3 4  | Next Page >

  • CW/CCW Rotation of a Vector

    - by user23132
    Considering that I have a vector A, and after an arbitrary rotation I get vector B. I want to use this rotation operation in others vectors as well, but I'm having problems in doing that. My idea do that is to calculate the perpendicular vector C of the plane AB (by calculating AxB). This vector C is the axis that I'll need to rotate. To discover the angle I used the dot product between A and B, the acos of the dot product will return the lowest angle between A and B, the angle ang. The rotation I need to do is then: -rotate *ang*º around the C axis. The problem is that I dont know if this rotation is a CW or CCW rotation, since the cos of the dot product does not give me information of the sign of the angle. There's a tip discover that in 2D ( A.x * B.y - A.y * B.x) that you can use to discover if the vector A is at left/right of vector B. But I dont know how to do this in 3D space. Can anyone help me?

    Read the article

  • Can't enable wifi on vaio CW ubuntu 12.04

    - by rastemoh
    I was using my wifi with no problem, but an hour ago I switched it off from system settings and then tried to turn it on again, but no success. it's about 1 month I am using it and I had no problem with WIFI except this one. I rebooted and went to windows 7, but even that OS can't turn it on!! this is rfkill list all: 0: sony-wifi: Wireless LAN Soft blocked: yes Hard blocked: yes 1: sony-bluetooth: Bluetooth Soft blocked: yes Hard blocked: yes 2: phy0: Wireless LAN Soft blocked: yes Hard blocked: yes

    Read the article

  • word wrap in tcpdf

    - by ChuckO
    I'm using tcpdf to creat a pdf version of the html table below. How do I word wrap the text in the cells? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> table.frm { width: 960px; Height:400px; margin-left: auto; margin-right: auto; border-width: 0px 0px 0px 0px; border-spacing: 0px; border-style: solid solid solid solid; border-color: gray gray gray gray; border-collapse: collapse; background-color: white; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 11px; } table.frm th { Width: 120px; border-width: 1px 1px 1px 1px; padding: 1px 1px 1px 1px; border-style: solid solid solid solid; border-collapse: collapse; border-color: gray gray gray gray; background-color: white; } table.frm td { width: 120px; height: 80px; vertical-align: top; border-width: 1px 1px 1px 1px; padding: 2px 2px 2px 2px; border-style: solid solid solid solid; border-collapse: collapse; border-color: gray gray gray gray; background-color: white; } </style> <title>Weekly Menu</title> </head> <body> <table class="frm"> <tr> <th align="center" colspan="8"><b>WEEKLY MENU</b></th> </tr> <tr> <th align="center" colspan="8"><b>Your Name Here</b></th> </tr> <tr> <th></th> <th>Monday</th> <th>Tuesday</th> <th>Wednesday</th> <th>Thursday</th> <th>Friday</th> <th>Saturday</th> <th>Sunday</th> </tr> <tr> <td><b>Breakfast</b></td> <td>Scrambled Eggs Black Coffee</td> <td>Vegetable Omelet Black Coffee</td> <td>2 slices Toast Black Coffee</td> <td>Cereal w/milk Black Coffee</td> <td>Orange Juice Black Coffee</td> <td>Cereal w/milk Black Coffee</td> <td>Pancakes w/syrup Black Coffee</td> </tr> <tr> <td><b>Lunch</b></td> <td>Tuna Salad Sandwich Diet Coke</td> <td>Greek Salad Black Coffee</td> <td></td> <td>Amer Cheese Sandwich Orange Juice</td> <td></td> <td></td> <td></td> </tr> <tr> <td><b>Dinner</b></td> <td>Burger Fried Onions Diet Coke</td> <td>Steak Fries Diet Sprite</td> <td></td> <td>Chicken Cutlet Baked Potato Peas</td> <td></td> <td></td> <td></td> </tr> <tr> <td><b>Snack</b></td> <td>Apple</td> <td>Orange</td> <td>Sm bag of chips</td> <td>Celery Sticks</td> <td></td> <td></td> <td></td> </tr> </table> </body> </html> This is the tcpdf code: $pdf = new TCPDF('Landscape', 'mm', '', true, 'UTF-8', false); $pdf->SetTitle('Weekly Menu'); $pdf->SetMargins(15, 7.5, 12.5); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->AddPage(); $pdf->setFormDefaultProp(array('lineWidth'=>0, 'borderStyle'=>'dot', 'fillColor'=>array(235, 235, 255), 'strokeColor'=>array(255,255,250))); $pdf->SetFont('times', 'BU', 12); $pdf->cell(250, 8, 'Weekly Menu', 0, 1, 'C'); $pdf->cell(250, 8, $yourname, 0, 1, 'C'); $pdf->SetFont('times', '', 10); $cw=35; $ch=25; $pdf->SetXY(15,50); $pdf->cell(25,5,'',1,0,'L'); $pdf->cell($cw,5,$day1,1,0,'C'); $pdf->cell($cw,5,$day2,1,0,'C'); $pdf->cell($cw,5,$day3,1,0,'C'); $pdf->cell($cw,5,$day4,1,0,'C'); $pdf->cell($cw,5,$day5,1,0,'C'); $pdf->cell($cw,5,$day6,1,0,'C'); $pdf->cell($cw,5,$day7,1,1,'C'); $pdf->cell(25,$ch,'Breakfast',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->breakfast,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->breakfast,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Lunch',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->lunch,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->lunch,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Dinner',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->dinner,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->dinner,1,1,'L',0,0,false,'','T'); $pdf->cell(25,$ch,'Snack',1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[0]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[1]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[2]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[3]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[4]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[5]->snack,1,0,'L',0,0,false,'','T'); $pdf->cell($cw,$ch,$record[6]->snack,1,1,'L',0,0,false,'','T'); EOD;

    Read the article

  • help needed on deciphering the g++ vtable dumps

    - by Ganesh Kundapur
    Hi, for the fallow class hierarchy class W { public: virtual void f() { cout << "W::f()" << endl; } virtual void g() { cout << "W::g()" << endl; } }; class AW : public virtual W { public: void g() { cout << "AW::g()" << endl; } }; class BW : public virtual W { public: void f() { cout << "BW::f()" << endl; } }; class CW : public AW, public BW { }; g++ -fdump-class-hierarchy is Vtable for W W::_ZTV1W: 4u entries 0 (int ()(...))0 4 (int ()(...))(& _ZTI1W) 8 W::f 12 W::g Class W size=4 align=4 base size=4 base align=4 W (0xb6e3da50) 0 nearly-empty vptr=((& W::_ZTV1W) + 8u) Vtable for AW AW::_ZTV2AW: 7u entries 0 0u 4 0u 8 0u 12 (int ()(...))0 16 (int ()(...))(& _ZTI2AW) 20 W::f 24 AW::g VTT for AW AW::_ZTT2AW: 2u entries 0 ((& AW::_ZTV2AW) + 20u) 4 ((& AW::_ZTV2AW) + 20u) Class AW size=4 align=4 base size=4 base align=4 AW (0xb6dbf6c0) 0 nearly-empty vptridx=0u vptr=((& AW::_ZTV2AW) + 20u) W (0xb6e3da8c) 0 nearly-empty virtual primary-for AW (0xb6dbf6c0) vptridx=4u vbaseoffset=-0x00000000000000014 Vtable for BW BW::_ZTV2BW: 7u entries 0 0u 4 0u 8 0u 12 (int ()(...))0 16 (int ()(...))(& _ZTI2BW) 20 BW::f 24 W::g VTT for BW BW::_ZTT2BW: 2u entries 0 ((& BW::_ZTV2BW) + 20u) 4 ((& BW::_ZTV2BW) + 20u) Class BW size=4 align=4 base size=4 base align=4 BW (0xb6dbf7c0) 0 nearly-empty vptridx=0u vptr=((& BW::_ZTV2BW) + 20u) W (0xb6e3dac8) 0 nearly-empty virtual primary-for BW (0xb6dbf7c0) vptridx=4u vbaseoffset=-0x00000000000000014 Vtable for CW CW::_ZTV2CW: 14u entries 0 0u 4 0u 8 4u 12 (int ()(...))0 16 (int ()(...))(& _ZTI2CW) 20 BW::_ZTv0_n12_N2BW1fEv 24 AW::g 28 4294967292u 32 4294967292u 36 0u 40 (int ()(...))-0x00000000000000004 44 (int ()(...))(& _ZTI2CW) 48 BW::f 52 0u Construction vtable for AW (0xb6dbf8c0 instance) in CW CW::_ZTC2CW0_2AW: 7u entries 0 0u 4 0u 8 0u 12 (int ()(...))0 16 (int ()(...))(& _ZTI2AW) 20 W::f 24 AW::g Construction vtable for BW (0xb6dbf900 instance) in CW CW::_ZTC2CW4_2BW: 13u entries 0 4294967292u 4 4294967292u 8 0u 12 (int ()(...))0 16 (int ()(...))(& _ZTI2BW) 20 BW::f 24 0u 28 0u 32 4u 36 (int ()(...))4 40 (int ()(...))(& _ZTI2BW) 44 BW::_ZTv0_n12_N2BW1fEv 48 W::g VTT for CW CW::_ZTT2CW: 7u entries 0 ((& CW::_ZTV2CW) + 20u) 4 ((& CW::_ZTC2CW0_2AW) + 20u) 8 ((& CW::_ZTC2CW0_2AW) + 20u) 12 ((& CW::_ZTC2CW4_2BW) + 20u) 16 ((& CW::_ZTC2CW4_2BW) + 44u) 20 ((& CW::_ZTV2CW) + 20u) 24 ((& CW::_ZTV2CW) + 48u) Class CW size=8 align=4 base size=8 base align=4 CW (0xb6bea2d0) 0 vptridx=0u vptr=((& CW::_ZTV2CW) + 20u) AW (0xb6dbf8c0) 0 nearly-empty primary-for CW (0xb6bea2d0) subvttidx=4u W (0xb6e3db04) 0 nearly-empty virtual primary-for AW (0xb6dbf8c0) vptridx=20u vbaseoffset=-0x00000000000000014 BW (0xb6dbf900) 4 nearly-empty lost-primary subvttidx=12u vptridx=24u vptr=((& CW::_ZTV2CW) + 48u) W (0xb6e3db04) alternative-path what are each entries in Vtable for AW AW::_ZTV2AW: 7u entries 0 0u // ? 4 0u // ? 8 0u // ? Vtable for CW CW::_ZTV2CW: 14u entries 0 0u // ? 4 0u // ? 8 4u // ? 12 (int ()(...))0 16 (int ()(...))(& _ZTI2CW) 20 BW::_ZTv0_n12_N2BW1fEv // ? 24 AW::g 28 4294967292u // ? 32 4294967292u // ? 36 0u // ? 40 (int ()(...))-0x00000000000000004 // some delta 44 (int ()(...))(& _ZTI2CW) 48 BW::f 52 0u // ? Thanks, Ganesh

    Read the article

  • Teamviewer: cannot control monitor 1, but can control monitor 2

    - by DaveT
    I'm using the web client of Teamviewer from my work computer trying to control my home computer. I have 2 monitors on the remote desktop, but for some reason only have control on the second monitor. When I switch to the main monitor (monitor 1), I cannot do anything and cannot even move the cursor. But I have no issues when I switch over to the second monitor (monitor 2). I used to have no issues with either, but in the past couple of months this has been causing me issues. Anyone have a suggestion? Thanks!! Also... Here is the log from the Teamviewer session. Showing me switching back and forth between the monitors. (just in case this will help). I had to remove the links in order to post the log since I don't have enough reputation points, but they were just teamviewer login weblinks. =============================================================================== 21.08 16:00:41,176: Version: 9.0.15099 21.08 16:00:41,177: Sandbox: remote 21.08 16:00:41,177: SysLanguage: en 21.08 16:00:41,177: VarLanguage: en 21.08 16:00:41,177: Flash Player: PlugIn (WIN 14,0,0,179) 21.08 16:00:41,178: UseLanguage: en 21.08 16:00:41,178: UseLanguage: en 21.08 16:00:41,182: TeamViewer hasPassword: true 21.08 16:00:41,418: ExternalConnect id=910035824 21.08 16:00:41,419: CT connect 910035824 masterURL: , sandbox = remote 21.08 16:00:41,425: MC.requestRoute(910035824) 21.08 16:00:41,426: MC.sendMasterCommand text=F=RequestRoute2&ID1=777&Client=TV& ID2=910035824&SA_AccountID=26641022&SA_PasswordMD5HashBase64Encoded=& SA_SessionSecret=f7H6Z7SYfX5ahQ7SJq/r/K20PBYg9fOZhp+DKLhf5ts=&SA_SessionID=1558929948& V=9.0.15099&OS=Flash 21.08 16:00:41,426: MC wait for ping completion 21.08 16:00:42,064: PS.socket event: [Event type="connect" bubbles=false cancelable=false eventPhase=2] 21.08 16:00:42,182: PingThread: TCP-Ping ok 21.08 16:00:42,183: MC.socket mode = TCP, MasterURL: 21.08 16:00:42,183: MC.connect: 21.08 16:00:43,058: PS.socket event: [Event type="connect" bubbles=false cancelable=false eventPhase=2] 21.08 16:00:43,058: MC.connectHandler: [Event type="connect" bubbles=false cancelable=false eventPhase=2] 21.08 16:00:43,236: MC.requestRouteResponse: [email protected]_10800_128000_762319420_910035824_10000__1_0_16778176_128000_16778176: 128000;2147483647:1280000;4:640000_786297_786297 21.08 16:00:43,239: CT init socket: TCP 21.08 16:00:43,513: PS.socket event: [Event type="connect" bubbles=false cancelable=false eventPhase=2] 21.08 16:00:43,514: CT.connectHandler: [Event type="connect" bubbles=false cancelable=false eventPhase=2] 21.08 16:00:43,519: Browser name: Netscape 21.08 16:00:43,936: CMD_IDENTIFY id=910035824 ver=2.41 21.08 16:00:44,666: CMD_CONFIRMENCRYPTION: encryption confirmed 21.08 16:00:44,667: Started resendrequest timer 21.08 16:00:45,063: Remote Version: TV 009.000 21.08 16:00:45,501: start classic authentication 21.08 16:00:45,502: Login::SendRequestToConsole(): url= 21.08 16:00:45,828: start srp authentication 21.08 16:00:46,983: checkFirstPacket ok, m_LastReceivedPacketID =4 21.08 16:00:47,148: Login::SendRequestToConsole(): url= 21.08 16:00:47,478: start srp authentication 21.08 16:00:48,210: Login::SendRequestToConsole(): url= 21.08 16:00:48,485: checkFirstPacket ok, m_LastReceivedPacketID =7 21.08 16:00:48,780: TVCmdAuthenticate_Authenticated: 1 21.08 16:00:49,321: Connected to 910035824, name=NEWMAN, os=14, version=9.0.31064 21.08 16:00:49,329: ConnectionAccessSettings: RemoteControl: AllowedFileTransfer: AllowedControlRemoteTV: AllowedSwitchSides: DeniedAllowDisableRemoteInput: AllowedAllowVPN: AllowedAllowPartnerViewDesktop: Allowed 21.08 16:00:52,195: unexpected TVCommand.CommandType == 56 21.08 16:00:52,231: CW received display params: 1680x1050x8 monitors: 2 (active:0) 21.08 16:00:52,301: Caching active, version=2 21.08 16:03:47,158: CW received display params: 1680x1050x8 monitors: 2 (active:1) 21.08 16:04:24,447: CW received display params: 1680x1050x8 monitors: 2 (active:0) 21.08 16:04:40,609: CW received display params: 3360x1050x8 monitors: 2 (active:-1) 21.08 16:04:59,802: CW received display params: 1680x1050x8 monitors: 2 (active:1) 21.08 16:04:59,933: CW received display params: 1680x1050x8 monitors: 2 (active:1) 21.08 16:05:58,419: CW received display params: 1680x1050x8 monitors: 2 (active:0) 21.08 16:06:36,824: CW received display params: 1680x1050x8 monitors: 2 (active:1) 21.08 16:07:07,232: CW received display params: 1680x1050x8 monitors: 2 (active:0)

    Read the article

  • Is Software Engineering Dead? [closed]

    - by nik
    Right from Jeff's blog: Software Engineering: Dead? I was utterly floored when I read this new IEEE article by Tom DeMarco (pdf). See if you can tell why. He quotes DeMarco, "I'm gradually coming to the conclusion that software engineering is an idea whose time has come and gone". Further, "What DeMarco seems to be saying -- and, at least, what I am definitely saying -- is that control is ultimately illusory on software development projects." I am writing these lines without context to invoke reading of the related subject. What are the views of the programming community here? I have started to realize that a community wiki is not getting the right amount of participation here. That is the reason I left this question out in the open, while still contemplating a change to CW. It was closed once, and I thought that was the end of it. But, now I see it was reopened and has more answers (all of which I have not yet read). However, I see a lot of CW requests and am forced to reconsider that. This is how I intend to make the CW decision here. There is a comment by Neil Butterworth requesting a CW at 12 upvotes -- "should be community wiki" There is a comment by Lance Roberts requesting no CW at 0 upvotes -- "+1 for not putting it in community wiki" The difference is 12 for a CW request at the moment If this difference becomes 5 more (that is 17), I'll move this question to CW, and it will not return back from there Of course, there is also a close vote at the moment; the question may be closed again.

    Read the article

  • How do I change until the next underscore in VIm?

    - by Nathan Long
    If I have this text in vim, and my cursor is at the first character: www.foo.com I know that I can do: cw to change up to the first period, because a word (lowercase w) ends at any punctuation OR white space cW to change the whole address, because a Word (uppercase w) ends only at whitespace Now, what if I have this: stupid_method_name and want to change it to this? awesome_method_name Both cw and cW change the whole thing, but I just want to change the fragment before the underscore. My fallback technique is c/_, meaning 'change until you hit the next underscore in a search,' but for me, that also causes all underscores to be highlighted as search terms, which is slightly annoying. Is there a specifier like w or W that doesn't include underscores?

    Read the article

  • Font gets enlarged when rotating screen

    - by queueoverflow
    I have a new ThinkPad X220 Tablet with Kubuntu 12.04. When I rotate the screen 90° with a script, the fonts of all programs that I open after the rotation have ugly huge fonts. #!/bin/sh # Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')" # Using current screen orientation proceed to rotate screen and input tools. case "$rotation" in normal) # rotate to the left xrandr -o right xsetwacom set "Wacom ISDv4 E6 Pen stylus" rotate cw xsetwacom set "Wacom ISDv4 E6 Finger touch" rotate cw xsetwacom set "Wacom ISDv4 E6 Pen eraser" rotate cw ;; right) # rotate to normal xrandr -o normal xsetwacom set "Wacom ISDv4 E6 Pen stylus" rotate none xsetwacom set "Wacom ISDv4 E6 Finger touch" rotate none xsetwacom set "Wacom ISDv4 E6 Pen eraser" rotate none ;; esac

    Read the article

  • MVC: How to Implement Linked Views?

    - by cw'
    I'm developing a java application to visualize time series. I need (at least) three linked views, meaning that interaction with one of them updates the others. The views are: A list represents the available and currently selected time series. The selected time series are used as input for subsequent computations. Changing the selection should update the other views. A line chart displays the available and selected time series. Time series should be selectable from here by clicking on them. A bar chart shows aggregated data on time series. When zooming in to a period of time, the line chart should zoom in to the same period (and vice versa). How to implement this nicely, from a software engineering point of view? I.e. I'd like to write reusable and clear, maintainable code. So I thought of the MVC pattern. At first I liked the idea of having the three view components observing my model class and to refresh views upon being notified. But then, it didn't feel right to store view related data in the model. Storing e.g. the time series selection or plot zoom level in the model makes implications about the view which I wouldn't want in a reusable model. On the other hand, having the controllers observe each other results in a lot of dependencies. When adding another view, I'd have to register all other views as observer of the new view and vice versa, passing around many references and introducing dependencies. Maybe another "model" storing only view-related data would be the solution?

    Read the article

  • Identifying an empty text node with jQuery + Javascript

    - by b. e. hollenbeck
    You'd think this was easy - but I'm having the hardest time with it. Here's what I'm trying to identify: <span class="cw-value-one"></span> Here's what I'm using so far: $('span.cw-value-one').each(function(){ var textNode = $(this).text(); var type = typeof textNode; var len = textNode.length; if($(this).is(':empty')){ $(this).siblings('span.cw-value-two').css({"position": "relative", "left": "1em"}); } }); Ok, so textNode = "", type = string and len = 1 - none of which is helpful in identifying an empty text node, since a has a type of string and length of 1. The jQuery .is(':empty') is not working either. So whow do you identify an empty text node in JQuery or plain ol' Javascript?

    Read the article

  • MVC/HTML - input submit won't trigger when HTML is in a text area

    - by cw
    Any idea why the below code doesn't trigger if I were to put some HTML inside the textarea? It works fine it I don't have HTML in it, but I'm not sure why it doesn't work with it. Here is the code. <form action="/Home/AddPost" method="post"> <table> <tr> <td>Post Title:</td> <td><input id="Title" type="text" name="title" /></td> </tr> <tr> <td>Post Description:</td> <td><textarea id="Description" rows="10" cols="60" name="description"></textarea></td> </tr> </table> <input type="submit" value="Save" /> </form>

    Read the article

  • XElement Path Validation

    - by cw
    Hello, I am trying to validate Elements and Attributes exist in an XElement. Basically, I was wondering if anyone had a generic way to check if a give path is null. I don't have access to System.Xml.XPath (doing this for compact framework). Basically what I have is: <root value"1000"> <element1>test<element1> <element2>1<element2> .... <element30> <subElement1>stuff</subElement1> </element30> </root> Now I know you can "if this is null do this and that". But since there is upwards of 30 elements that can be under root, which are optional elements, I need a way to grab the value if it exists and convert it to the correct type (which I know) in a nice compact way. Any suggestions?

    Read the article

  • Issue parsing RSS xml

    - by cw
    Hello, I'm having an issue using Linq to XML parsing the following XML. What I am doing is getting the element checking if it's what I want, then moving to the next. I am pretty sure it has to do with the xmlns, but I need this code to work with both this style and normal style RSS feeds (no xmlns). Any ideas? <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://someurl" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"> <channel rdf:about="http://someurl"> XElement currentLocation = startElementParameter; foreach (string x in ("channel\\Title").Split('\\')) { if (condition1 == false) { continue; } else if (condition2 == false) { break; } else { // This is returning null. currentLocation = currentLocation.Element(x); } } Thanks!

    Read the article

  • VS2010 Clean Web.configs - not updating

    - by cw
    Hello, I'm messing around with MVC 2.0 on VS2010 and am having an issue getting the clean web config feature working. Basically in my Web.debug.config I have <connectionStrings xdt:Transform="Replace"> <add name="ApplicationServices" connectionString="Server=localhost;Database=SITE_DB;User ID=dbuser;Password=P@ssw0rd;Trusted_Connection=False;" /> </connectionStrings> and in my Web.config I have <connectionStrings> <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" /> </connectionStrings> When I run the site in debug mode, I'd expect that xdt:Transform="Replace" would replace the entire connectionStrings section with what is in the Web.debug.config. Am I assuming wrong? Or am I doing something else incorrect. Not much info posted around this and I'd figure I'd ask you guys.

    Read the article

  • How do you call a generic method on a thread?

    - by cw
    How would I call a method with the below header on a thread? public void ReadObjectAsync<T>(string filename) { // Can't use T in a delegate, moved it to a parameter. ThreadStart ts = delegate() { ReadObjectAcync(filename, typeof(T)); }; Thread th = new Thread(ts); th.IsBackground = true; th.Start(); } private void ReadObjectAcync(string filename, Type t) { // HOW? } public T ReadObject<T>(string filename) { // Deserializes a file to a type. }

    Read the article

  • LINQ to XML Query Help

    - by cw
    Hello, I am trying to get a "diff" of 2 xml documents and end up with a list of Elements that are different. Below is the XML, I was wondering if anyone can assist. In the case below, I want the list to contain the "file2.xml" element and the "file3.xml" element because they are both different or new than the first xml document. Thanks in advance! <?xml version="1.0" encoding="utf-8" ?> <versioninfo> <files> <file version="1.0">file1.xml</file> <file version="1.0">file2.xml</file> </files> </versioninfo> <?xml version="1.0" encoding="utf-8" ?> <versioninfo> <files> <file version="1.0">file1.xml</file> <file version="1.1">file2.xml</file> <file version="1.0">file3.xml</file> </files> </versioninfo>

    Read the article

  • Help getting MVVM ViewModel to bind to the View

    - by cw
    Okay guys, I'm new to this model and Silverlight in general. I have the following code (changed object names, so syntax/spelling errors ignore). public class ViewModel { ViewModelSource m_vSource; public ViewModel(IViewModelSource source) { m_vSource= source; m_vSource.ItemArrived += new Action<Item>(m_vSource_ItemArrived); } void m_vSource_ItemArrived(Item obj) { Title = obj.Title; Subitems = obj.items; Description = obj.Description; } public void GetFeed(string serviceUrl) { m_vFeedSource.GetFeed(serviceUrl); } public string Title { get; set; } public IEnumerable<Subitems> Subitems { get; set; } public string Description { get; set; } } Here is the code I have in my page's codebehind. ViewModel m_vViewModel; public MainPage() { InitializeComponent(); m_vViewModel = new ViewModel(new ViewModelSource()); this.Loaded += new RoutedEventHandler(MainPage_Loaded); this.DataContext = m_vViewModel; } void MainPage_Loaded(object sender, RoutedEventArgs e) { m_vViewModel.GetItems("http://www.myserviceurl.com"); } Finally, here is a sample of what my xaml looks like. <!--TitleGrid is the name of the application and page title--> <Grid x:Name="TitleGrid" Grid.Row="0"> <TextBlock Text="My Super Title" x:Name="textBlockPageTitle" Style="{StaticResource PhoneTextPageTitle1Style}"/> <TextBlock Text="{Binding Path=Title}" x:Name="textBlockListTitle" Style="{StaticResource PhoneTextPageTitle2Style}"/> </Grid> I know I'm missing something, but I'm just not knowledgable enough which is why I'm asking you guys :) Is there anything I'm doing wrong here? Thanks!

    Read the article

  • Catch and Show an error from a WCF service call in javascript.

    - by cw
    Hello, I'm calling a WCF service through javascript and right now it's not showing any errors that might occur on the service side to the user. I have the code below and am looking for a better way to inform the user an error has occured, including the call stack and error message if possible. The service itself throws a FaultException if an error has occured. However, I want to catch that error in the javascript call and show it to the user. Here is the js code to call the service function Save() { var saveInfo = $("._saveInfo").val() app.namspace.interfacetoservice.Save( saveInfo, function(results) { if (results == true) { window.close(); } else { alert("error saving"); } } ); } Thanks for the help!

    Read the article

  • Overwrite queryset which builds filter sidebar

    - by cw
    Hi, I'm writing a hockey database/manager. So I have the following models: class Team(models.Model): name = models.CharField(max_length=60) class Game(models.Model): home_team = models.ForeignKey(Team,related_name='home_team') away_team = models.ForeignKey(Team,related_name='away_team') class SeasonStats(models.Model): team = models.ForeignKey(Team) Ok, so my problem is the following. There are a lot of teams, but Stats are just managed for my Club. So if I use "list_display" in the admin backend, I'd like to modify/overwrite the queryset which builds the sidebar for filtering, to just display our home teams as a filter option. Is this somehow possible in Django? I already made a custom form like this class SeasonPlayerStatsAdminForm(forms.ModelForm): team = forms.ModelChoiceField(Team.objects.filter(club__home=True)) So now just the filtering is missing. Any ideas?

    Read the article

  • Binding to a List<object> in silverlight problem.

    - by cw
    Hello, Can someone suggest what I am doing wrong? Basically I have a List Items, when an item gets added to the list I am resetting the collection to the viewmodel property. The only way I can get it to work is if I null the member object out before reassigning the binding. Any suggestions on how to go about updating a UI when an item gets added to a List? public List<Item> RegisteredItems { get { return m_vRegisteredItems; } set { m_vRegisteredItems= null; NotifyPropertyChanged("RegisteredItems"); m_vRegisteredItems= value; NotifyPropertyChanged("RegisteredItems"); } }

    Read the article

  • Windows Phone 7 Tab Pages (page cycle)

    - by cw
    I know.. I know, it's only a few hours old. But how the hell do you get the little page tabbing/cycle (forgot what the official name is) on the top of the page under the app title. MIX Keynotes made it look like it was a control (or at least what I saw, was @ work). Anyone who made MIX or knows how they are doing this, it'd be cool to get an answer. Thanks!

    Read the article

  • warning: assignment makes pointer from integer without a cast

    - by FILIaS
    Im new in programming c with arrays and files. Im just trying to run the following code but i get warnings like that: warning: assignment makes pointer from integer without a cast Any help? It might be silly... but I cant find what's wrong. FILE *fp; FILE *cw; char filename_game[40],filename_words[40]; int main() { while(1) { /* Input filenames. */ printf("\n Enter the name of the file with the cryptwords array: \n"); gets(filename_game); printf("\n Give the name of the file with crypted words:\n"); gets(filename_words); /* Try to open the file with the game */ if (fp=fopen("crypt.txt","r")!=NULL) { printf("\n Successful opening %s \n",filename_game); fclose(fp); puts("\n Enter x to exit,any other to continue! \n "); if ( (getc(stdin))=='x') break; else continue; } else { fprintf(stderr,"ERROR!%s \n",filename_game); puts("\n Enter x to exit,any other to continue! \n"); if (getc(stdin)=='x') break; else continue; } /* Try to open the file with the names. */ if (cw=fopen("words.txt","r")!=NULL) { printf("\n Successful opening %s \n",filename_words); fclose(cw); puts("\n Enter x to exit,any other to continue \n "); if ( (getc(stdin))=='x') break; else continue; } else { fprintf(stderr,"ERROR!%s \n",filename_words); puts("\n Enter x to exit,any other to continue! \n"); if (getc(stdin)=='x') break; else continue; } } return 0; }

    Read the article

  • More information about worldwide nodes how to get?

    - by Aubergine
    The context: Six hosts across worldwide were traced over week from UK. Ten thousands of lines to be parsed and analysed. And then I try to find any clue of geographical information and path - from where it jumps where. Then after Austria or Germany(each time different) I have mysterious 62.208.72.6 which in GEO LOC gives me Falklands Islands (which is where my target host is by the way, but before target host I still have 5 other nodes) Then I do whois for this 62.208.72.6 route: 62.208.0.0/16 descr: DE-ECRC-62-208-0-0 origin: AS1273 mnt-by: CW-EUROPE-GSOC source: RIPE # Filtered Why it says Europe now? How to understand this enigma code? I want to confirm more or less whether this is in europe or in falkland islands? But it can't be in FK yet as after next two hosts I get New York? Could you also tell me what does this CW-EUROPE-GSOC abbreviation means. (To preserve your sanity better not google, unless you already know it :-D) And the actual whois for the destination/target host, which completely destroys my head: route: 195.248.193.0/24 descr: HORIZON descr: Cable and Wireless Falkland Islands descr: Via Cable and Wireless Communications UK origin: AS5551 mnt-by: AS5551-MNT source: RIPE # Filtered How is it Via Cable and Wireless Communications UK if two nodes before I was in New York? Thank you guys,

    Read the article

  • How do I consistently re-size my game window and elements?

    - by Milo
    In my 2D game, I have a flow layout. Inside the flow layout are tables. I have a slider that lets the user make the tables larger or smaller. This makes the background larger or smaller too. Everything should scale proportionally which means the background should stay at the same position when I make things larger, and it almost does. When the scrollbar is at 0, it does exactly this. As the scrollbar gets further down problems arise. I'll toggle the slider maybe 3 times and on the fourth time, the background jumps a little lower on the Y axis. In order to be efficient, I only start rendering the background near the parent of the flow layout. Here it is: void LobbyTableManager::renderBG( GraphicsContext* g, agui::Rectangle& absRect, agui::Rectangle& childRect ) { int cx, cy, cw, ch; g->getClippingRect(cx,cy,cw,ch); g->setClippingRect(absRect.getX(),absRect.getY(),absRect.getWidth(),absRect.getHeight()); float scale = 0.35f; int w = m_bgSprite->getWidth() * getTableScale() * scale; int h = m_bgSprite->getHeight() * getTableScale() * scale; int numX = ceil(absRect.getWidth() / (float)w) + 2; int numY = ceil(absRect.getHeight() / (float)h) + 2; float offsetX = m_activeTables[0]->getLocation().getX() - w; float offsetY = m_activeTables[0]->getLocation().getY() - h; int startY = childRect.getY(); if(moo) { std::cout << "S=" << startY << ","; } int numAttempts = 0; while(startY + h < absRect.getY() && numAttempts < 1000) { startY += h; if(moo) { std::cout << startY << ","; } numAttempts++; } if(moo) { std::cout << "\n"; moo = false; } g->holdDrawing(); for(int i = 0; i < numX; ++i) { for(int j = 0; j < numY; ++j) { g->drawScaledSprite(m_bgSprite,0,0,m_bgSprite->getWidth(),m_bgSprite->getHeight(), absRect.getX() + (i * w) + (offsetX),absRect.getY() + (j * h) + startY,w,h,0); } } g->unholdDrawing(); g->setClippingRect(cx,cy,cw,ch); } The numeric problem seems to be in the value of startY. I outputted startY figuring out its value: As you can see here, this is me only zooming in, pay attention to the final number before the next s=. You'll notice that, what should happen is, the numbers should be linear, ex: -40, -38, -36, -34, -32, -30, etc. As you'll notice, the start numbers linearly correlate ex: 62k, 64k, 66k, 68k, 70k etc.. but the end result is wrong every third or 4th time. Here is most of the resize code: void LobbyTableManager::setTableScale( float scale ) { scale += 0.3f; scale *= 2.0f; agui::Gui* gotGui = getGui(); float scrollRel = m_vScroll->getRelativeValue(); setScale(scale); rescaleTables(); resizeFlow(); if(gotGui) { gotGui->toggleWidgetLocationChanged(false); } updateScrollBars(); float newVal = scrollRel * m_vScroll->getMaxValue(); if((int)(newVal + 0.5f) > (int)newVal) { newVal++; } m_vScroll->setValue(newVal); static int x = 0; x++; moo = true; //std::cout << m_vScroll->getValue() << std::endl; if(gotGui) { gotGui->toggleWidgetLocationChanged(true); } if(gotGui) { gotGui->_widgetLocationChanged(); } } void LobbyTableManager::valueChanged( agui::VScrollBar* source,int val ) { if(getGui()) { getGui()->toggleWidgetLocationChanged(false); } m_flow->setLocation(0,-val); if(getGui()) { getGui()->toggleWidgetLocationChanged(true); getGui()->_widgetLocationChanged(); } }

    Read the article

1 2 3 4  | Next Page >