Challenge for TuringPest

TuringPest, are you out there? I'd like to challenge you to creating a simple app that uses absolute positioning (your app) vs. layout managers (my app). You game?
/Pete

try and use a billing plan & see if it works - but if shipment is involved, it may not be possible -
any way any thing is possible using your own code - but ensure the legality of this
cheers
nandu

Similar Messages

  • AEBS "Ghost" Router Issue - The Challenge for 2012 (and it's only January)

    Yes, it's a bold statement to claim that I have the biggest issue so far for 2012. Why may you ask? Because I've stumped RCN (ISP), Access Media 3 (ISP), Apple Tech Support, and Cisco Tech Support. Here's the challenge for you to see if you can figure it out:
    ***Also, sorry for the long-winded post. I've spend over 20 hours on this issue and racked up a lot of info to share with you. So please bear with me***
    I used to own a Linksys E4200 router (early 2011), which I set up using the wireless network name (for example) "wifi-box". Due to performance issues, I returned the router back to Linksys in April 2011. Shortly thereafter, I purchased a used AESB. I performed a factory reset (not a hard reset, as I know the difference between the two) before setting up my network. Things worked great from April to Dec. 2011.
    On Jan. 1st, 2012, the building that I live in switched ISPs. I used to have RCN, and now have Access Media 3 (AM3). Both provide the same type of connection - cable - and both provided me with a modem (not sure the model of the one that RCN provided to me, but AM3 gave me a Surfboard 5101N...shudder). Once the transition from RCN to AM3 took place, I performed another factory reset on the AESB before setting up my my network from scratch.
    Now, here's where things get start to get weird. I "Created a wireless network" on my AESB, entered in the name "wifi-box" (to keep it the same as before) as the wireless network name, and followed the rest of the steps until I updated the router. Shortly after the AESB restarted, I received a "Dual (or double) NAT" error right off the bat. Looking into the issue futher, there were now 2 wireless network names called "wifi-box"?!? Huh?!? The actual name isn't "wifi-box", but was something quite unique. So it was easy to tell that it was (once) my wireless name.
    The next 5 hours were a blur of reconfiguing, resetting, unplugging, etc. anything that is connected to my network. Nothing worked. During all of this, I also switched the name of the AESB to (for example) "apple-wifi".
    As a last resort, I unplugged everything - the Surfboard, the AESB, wiped all Airport Util profiles off my 2 Macs, wiped my profile off my 1 PC, shut them down, did the same for my iPhone 3G, shut off the power strip that the modem and AESB were connected to, and unscrewed the coax cable from the wall. I had a friend come over with his laptop, which he never brought over before, and had him search for a wifi signal. As you would guess, "apple-wifi" didn't appear...BUT "WIFI-BOX" WAS AVAILABLE TO CONNECT TO!!! Arrrgggg!!
    At this point it seems that the profile is somewhere outside of my condo. But where???
    Moving along, I used a tool called WiFi Stumbler to see if that could help shed some light on my issue. What I found was unheard of. The wirless name "wifi-box" was linked to a Linksys router.  Once I discovered this, I logged into my Linksys profile (192.168.1.1) to see if it still worked. IT DID!!! However, that was short lived, because as soon as I clicked on a tab, I was booted out. On top of that, I couldn't log back in. Not sure if this is because it was looking for the Linksys router or not. Whatever the reason...it's just flat out weird.
    Because the password to log into my old Linksys profile was the same, it somewhat leads me to believe that someone doesn't have the same wireless name that I do.
    Over the past two days, I talked to RCN, Linksys, Apple Tech, AM3, had an AM3 tech out to look at it...no one knew what the issue was. When I talked to Apple, and they thought it might be the Surfboard. The tech said that the Surfboard is also a router, which is why the "dual NAT" error is taking place. However, I then spoke to AM3 and they told me the Surfboard was only a modem. I looked it up online, and it's just modem. Also, I was able to get rid of the "dual NAT" error, but yet I still cannot connect.
    My current error msg is: "Airport has the self-assigned IP address 169.XXX.XXX.XXX and will not be able to connect to the Internet". The AirPort indicator light in my Network Preferences is orange, but the AESB indicator light is green (and is reporting no issues).
    To end this, (if you're still reading), any help that you may have is greatly appreciated. Everyone I spoke to is stumped. I'm not sure where to go next from here. If you know anything, please let my know . As a quick recap, here are my current settings:
    Devices:
         1) MacBook Pro (2011), OSX Lion;
         2) MacBook (2009), OSX Snow Leopard;
         3) IBM Lenovo PC, Win XP SP2
         4) iPhone 3G (iOS 4.2)
    Modem:
         Former modem: unknown
         Current router: Surfboard SB5101N
    Router:
         Former router: Linksys E4200 (wireless network name "wifi-box")
         Current router: AESB - Apple AirPort Extreme Base Station - Simultaneous Dual-Band MC340LL/A (wireless network name "apple-wifi")
         # of Router in my condo: 1
    ISP:
         Former ISP: RCN
         Current ISP: Access Media 3
    Thanks and good luck (to you and me)

    Thanks Tessarax,
    Thanks for the reply, and no worries about the long form answer. Yesterday, I went through your process twice (for good measure). I also unplugged/shut down everything overnight and tried it once again today. Unfortunately, the results are the same.
    Me network is currently up and running, albeit a limited connection. It's still producing the "Double NAT" error. My Internet is set up as follows:
    These are the settings for "apple-wifi" in the AirPort Util.:
    Connect Using: Ethernet
    Ethernet WAN: Automatic
    Connection Sharing: Share a public IP address. ("Bridge Mode" and Distribute a range of IP addresses" cause additional errors which brings down the network. These errors include setting a DHCP beginning/ending address and no Internet connection. I tried setting the DHCP beginning/ending address several times, but the AEBS never accepts my entries.)
    IP: 10.XXX.XXX.XXX
    DHCP: Beginning/Ending Address: 172.XXX.XXX.XXX
    DNS: 8.8.8.8, 8.8.4.4
    These are the settings for "wifi-box" in the Network Preferences:
    IP: 192.XXX.XXX.XXX
    DNS Servers: 8.8.8.8, 8.8.4.4
    Search Domains: 221am3.com
    802.1X: No profiles (I deleted them)
    Bypass proxy settings for these Hosts & Domains: *.local, 169.XXX/XX
    Use Passive FTP Mode (PASV): checked
    MAC Address: same as "apple-wifi"
    These are the settings for "apple-wifi" in the Network Preferences:
    IP: 172.XXX.XXX.XXX
    DNS Servers: 172.XXX.XXX.XXX
    Search Domains: 221am3.com
    802.1X: No profiles (no profiles were avaible for "apple-wifi")
    Bypass proxy settings for these Hosts & Domains: *.local, 169.XXX/XX
    Use Passive FTP Mode (PASV): checked
    MAC Address: same as "wifi-box"
    Two new discoveries that I uncovered yesterday are as follows:
    1. 802.1X (under Network Preferences): There were 3 profiles that I deleted from this tab last week. After resetting the network, they came back. Whether they were present or deleted, it didn't affect the connectivity of my network. Just mentioning that these profiles came back after deletion (I deleted them again).
    2. Yesterday, the network in my building went down for a few hours. I noticed that neither "wifi-box" nor "apple-wifi" were available to connect to. This is an obvious insight, but it seems that when "wifi-box" is unavailable, "apple-wifi" is unavailable as well. However, 'wifi-box' has always been available even when "apple-wifi" is down. Sounds like my Internet signal follows this path:
    AM3 > Condo building > "wifi-box" > my condo > Surfboard modem > AEBS "apple-wifi" > my devices (laptops, iPhone, Xbox, etc.)
    Two new questions:
    1. What is DHCP Client ID and is this something that I need to provide?
    2. Could the cables that I'm using cause any problems? Here's the cable that I'm using and the connections between the devices:
    CAT5: Router > AEBS
    CAT5e: AEBS > MacBook Pro
    CAT6: AEBS > Xbox
    If there's other questions or infer that you need, please ask

  • Apache challenge for username/password using IFS

    We are using IFS and Apache.
    When we open a document we are challenged for a username/password.
    Has anyone else experienced this - and know how to prevent it. Even when the user has uploaded the file it asks you for the username/password.
    Any clues?
    Thanks
    Chris

    Hi Deb,
    You can try the following type of code in your client side to pass the username and password to the webservice.
    BindingProvider bindingProvider = (BindingProvider) port;
    Map<String,Object> rc = (Map<String,Object>)bindingProvider.getRequestContext();
    List<CredentialProvider> credProviders = new ArrayList<CredentialProvider>();
    credProviders.add(new ClientUNTCredentialProvider(USERNAME.getBytes(),PASSWORD.getBytes()));
    rc.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);
    rc.put(BindingProvider.USERNAME_PROPERTY, USERNAME);
    rc.put(BindingProvider.PASSWORD_PROPERTY, PASSWORD);;For more details you can have a look at the below link:
    http://middlewaremagic.com/weblogic/?p=457
    Regards,
    Ravish Mody
    http://middlewaremagic.com/weblogic/
    Come, Join Us and Experience The Magic…

  • Mathematical and statistical challenge for developers

    Hi guys, a mats/statistical question. I've been asked to make a calculation in SQL (it's more fun that really job..to be honest it's only fun...anyway..) with a situation like this:
    38 events ( basketball games). You can  bet in more than, we can say, 100 points or less than 100 points. So you got 76 possibilities. If we decide to bet in 10 events more (IT WOULD BE ALWAYS MORE,
    OVER) how much is the possibility to win with the different percentage ( I call percentage the over, so the minimun is 10 events more. Of course if you got 38 event OVER the percentage is 100% and you are sure to win).
    So far it hard but it become harder if you play for example 25 bets splitting all the events ( that's means for each game the same number of the overall bet). Of course you cannot just summarize the probabilities but you have to come up with a statistical
    solution...
    Any suggestion for the step one and eventually also for the step two?
    Thanks ( I repeat, it's for funny but it's a challenge for developers..)

    Ok Stefan you're right I should have gone you more clues, but meanwhile I'm working...anyway I accepted the challenge..and thank you a lot to follow this fun situation ( the deadline is tomorrow at 8.00 am Greenwich time..) 
    Or do you mean each event results in one of two results:
    p(n) aka "over 100"
    q(n) aka "under 100 or equal"
    I mean exactly this, or yes (over 100.5 points) or not (under 100.5 points).
    I'm going to explain better the concept of the bet
    A B C D E F G H I L M.....till 38 letter.
    My bet A C D F G H I L M N ( I'm predicting the event that all these matches will be over 100.5).
    The script shoud retrieve the possibility to win having:
    38 matches over 100.5 on 38 total matches
    37/ 38
    36/38
    and so on. So far I calculated the right percentage of the events from 38 (over)/38 (total) till 10(over)/38(total).
    0.0000000004
    0.0000000138
    0.0000002560
    0.0000030715
    0.0000268760
    0.0001827569
    0.0010051632
    0.0045950318
    0.0178057482
    0.0593524939
    0.1721222324
    0.4381293189
    0.9857909675
    1.9715819350
    3.5206820268
    5.6330912430
    8.0975686617
    10.4792065034
    12.2257409207
    12.8692009691
    12.2257409207
    10.4792065034
    8.0975686617
    5.6330912430
    3.5206820268
    1.9715819350
    0.9857909675
    0.4381293189
    0.1721222324
    Now I should calculate the possibility to have 10 right on 38 matches over 100.5 ( 100% of course), 10 right on 37 over 100.5 and go on...
    Sorry if I'm not total clear but I'm running in different tasks..
    KALMAN I don't have so far any code I'm trying to come up with a solution and yes...it's fun

  • What are the major challenges for the end-user in using Positive Time Management

    Hi Seniors,
    Can anybody please provide me some data on the same.
    Thanks.

    Hi,
    Positive time management is slightly difficult to implement compared to negative time management.
    In negative time management, you use planned working times + deviations in time evaluation.
    In positive time management, you record actual times through time recording system. You have to bring these times to SAP through an interface and then evaluate the actual times against the planned times and accordingly pay them out. You would need to pay attention regarding the integration between SAP R/3 and time recording system.
    Building rules for positive time management is slightly more challenging compared to negative time management.
    Kindly go through the below documents on positive time management which will give you more idea about the same.
    Integration of Time Recording Terminals with SAP R/3
    Determination of First Clock In & Last Clock Out in Positive Time Evaluation
    Late Coming, Early Going and Unauthorized absence
    Prorated Grant of Absence Quota for Contract Period in Time Evaluation
    Splitting of Overtime Hours after X Hours in Time Evaluation
    Rounding off Overtime Hours Generated via T510S table in Time Evaluation
    Public Holiday Calendar and Work Schedule Rules
    I hope these are helpful to you.
    Thanks and regards,
    Vivek Barnwal

  • Challenges for converting HR and FI Master Data

    Hi,
    For a presentation, i am looking for information on the following -
    "differences/dependencies/challenges in converting HR master data"
    I will be thankful for any inputs/documents/links(an points guaranteed!).
    Thanks & Regards,
    Renjith

    Dear Experts.
    Say for e.g i assign two different assets to two different personal numbers e.g asset no 14000235 to pernr no 1 and asset no 14000236 to pernr no2 but when i maintian them in pa30 in infotype40 if firslty before mainting asset no for 1 i maintian it for pernr no 2 it is displaying asset no 14000235 which is for pernr no 1 not for pernr no 2 is their any way that respective asset number should come in personal to whom i assigned in FI
    Regards

  • A challenge for the pros

    this one is a tough one.. ive checked all the forum archives this topic has not been "discussed" yet so maybe there is a "pro" out there up to the challenge!! i am trying to convert an mpeg1 into dv for use in imovie. streamclip 1.5.1 will not work i get the message "cannot find video or audio track" is anyone up to the challenge ?? can u figure this one out ?!!

    Will the MPEG open in QuickTime and display as Mpeg track? Do you KNOW it is MPEG1?
    Give iSquint a try to see if it has the same problem but as they both are built on QuickTime, they both may have the same problems.

  • TODAYS LITTLE CHALLENGE  FOR JAVA DEVELOPERS!!!

    This challenge is related to EventListener.
    I initialized a String i.e
    String data = "myname";
    What i wnat to do;
    whenever the string data changes some event generate's so that in Listener
    method i received the the data .
    What kind of Listener should be used i not no.
    Be sure not to initialize like this "static String data = "myname";
    Example:
    String data = "myname";
    data.add...Listener(this);
    for(int i = 0; i< 10; i++)
    data = "myname"+i;
    public event...Listaner( Event ...e)//Event listener
    string s = e.getdata();// OR some other function
    Thank's

    First, I think this is a cool idea, and there is a new language specifically designed to achieve this kind of event programming.
    Second, I don't think this can be done with the Java language, at least not with the current Java architecture. Among the few problems implementing this, the greatest obstacle is here:
    String data = "myname";
    data = "myname"+i;Now, to event trigger this data = "myname" + i; , or to the JVM data = new String("myname" + i); , is problematic. The String variable data did not change value, it changed its reference. You can not intercept the = operator in Java. You can not change the String constructor behavior legally. (Well, even you do, it applies to all Strings and not just the data variable).
    So, the only work around solution to achieve a similar effect is to wrap the String class to a MutableString class. (Note: wrap, not extend) And expose get/set method for this wrapper string class, then you can do whatever listener in the get/set method of your class. However, you still can not add listener for object reference change.
    The above is only my take though. Do you have the answer to the challenge? I would love to hear others or the answer.
    --lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • A challenge - for me anyhow

    Here is a challenge. I am attempting to create staff meetings that are interesting. I would like to have a ‘Jeopardy‘ type game created on keynote.
    I take the first slide and add text boxes to look like the Jeopardy game board.
    I hyperlink the text box to a slide with the question.
    I then hyperlink the question back to the original slide, to allow for another question to be asked.
    Difficulty I am having is in having asked questions fade off the game board or somehow become marked that they are already played.
    Every time I go back to the original slide, it is original. I need the text box to change as it hyperlinks.
    Is what I am trying to do possible, or am I dreaming?

    DFB,
    You might want to explore RealStudio (http://www.realsoftware.com/realbasic/hobbyists.php) or similar VB development platforms.
    A very nice Sudoku game available free here (http://www.madoverlord.com/projects/sudoku.t) was done with the Real software suite and may give you some ideas.
    Jerry

  • Challenge for Cyclosaurus!

    Cyclosaurus, your kung fu is the best!
    Your scripts are amazing, and I was wondering if you had any idea how to put together a script for iWeb similar to this iPhoto script:
    http://www.versiontracker.com/dyn/moreinfo/macosx/13198
    iPhoto librarian is a useful script that lets you choose from multiple iPhoto files at program startup. It would be so cool if the iWeb community had a similar script that could swap out the default iWeb domain file with another domain file the user selects.
    Then we could easily work on multiple websites -- and you'd be an even greater legend!!!
    Only you can help us, Cyclosaurus!!!

    Domain Juggler, here it is: http://www.geocities.com/[email protected]/iWeb_utils
    I tested it as much as I could.
    You can modify it anyway you want, it's editable with Script Editor. Following is what you should be aware of.
    Domain Juggler
    Domain Juggler juggles iWeb's Domain.sites with minimal intrusions. It doesn't alter any Domain.sites items.
    Exceptions:
    If 'Library/Application Support/iWeb' is present during launch time, Domain Juggler WILL rename it to 'Library/Application Support/iWeb Latest'. You can move it anywhere in your home folder, anywhere but 'Library/Application Support' folder.
    iWeb only allows one 'Library/Application Support/iWeb' folder.
    On launch and re-open (click on Dock icon), It will scan your home folder for any Domain.sites items. You then can make your selection. This will take some time depend on the size of your home folder.
    Prior to switch Domain, it will quit iWeb then make an Unix symbolic link 'Library/Application Support/iWeb' (similar to Finder alias), and launch iWeb.
    It allows you to 'Make New Domain...' (top of the list). When 'Make New Domain...' is selected, you have to navigate to a folder (or create a new folder) for the new Domain.sites. This folder CAN NOT BE 'Library/Application Support/iWeb'.
    Note: Make back up of all you works, it's just a common sense.

  • Anyone around here with an apple developer program membership who lives in the us and wants to participate in entering the atari  indie developer challenge for pong? I have the great idea required, ample coding skills and a completed game design document.

    If you have a membership with the apple developer community or know anyone who has and also resides within the united states, please contact.
    The purpose is to partake in http://www.atari.com/pongdeveloperchallenge
    The initial game design document is fully completed and the ideas expressed in it are more than strong enough to compete for the top prizes.
    I'm well versed in different programming languages (c, scheme, js, assembly, python,...) as well as being a proficient sound designer and musician and a skilled graphics and animation manipulator myself. Assistance with the actual development would appreciated but is not really necessary.
    Winnings and proceedings arising from participation would distributed most fairly. If you know anyone besides yourself that is able to help out, you would also be rewarded financially from an ensuing victory.
    Reply to this post, pm or send  a gmail to aelgoa
    Have a good one
    Marnix

    If you have a membership with the apple developer community or know anyone who has and also resides within the united states, please contact.
    The purpose is to partake in http://www.atari.com/pongdeveloperchallenge
    The initial game design document is fully completed and the ideas expressed in it are more than strong enough to compete for the top prizes.
    I'm well versed in different programming languages (c, scheme, js, assembly, python,...) as well as being a proficient sound designer and musician and a skilled graphics and animation manipulator myself. Assistance with the actual development would appreciated but is not really necessary.
    Winnings and proceedings arising from participation would distributed most fairly. If you know anyone besides yourself that is able to help out, you would also be rewarded financially from an ensuing victory.
    Reply to this post, pm or send  a gmail to aelgoa
    Have a good one
    Marnix

  • Message mapping challenge for a newbie

    Dear PI message mapping experts,
    I'm a newbie in PI and facing a mapping problem using graphical message mapping.
    I'm in an IDOC (INVOIC.INVOICE02) to FILE (EDI) scenario.
    Here after is the mapping i need to perform :
    Source structure IDOC :
    <E1EDKA1> (0..99)
       <NAME1> A </NAME1>  (0..1)
       <NAME2> B </NAME2>  (0..1)
       <NAME3> C </NAME3>  (0..1)
       <NAME4> D </NAME4>  (0..1)
    </E1EDKA1>
    Target structure :
    <AccountingCustomerParty>  (1..1)
       <Party> (0..1)
          <PartyName> (0..unbounded)
              <Name>A</Name> (1..1)
          </PartyName>
          <PartyName>
              <Name>B</Name>
          </PartyName>
          <PartyName>
              <Name>C</Name>
          </PartyName>
          <PartyName>
              <Name>D</Name>
          </PartyName>
       </Party>
    </AccountingCustomerParty>
    I know i have to play with context and queues with stanard function or UDF but cannot succeed to do it.
    Could you please help me ?
    Thanks in advance,
    Alysee

    Hi,
    Please try as below:
    1. Create a source structure
    <AccountingCustomerParty>  (1..1)
       <Party> (0..1)
           <PartyName> (0..unbounded)
                <Name>A</Name> (1..1)
           </PartyName>
       </Party>
    </AccountingCustomerParty>
    2. When in message mapping, duplicate the node 'PartyName' 4 times. Right click on the 'PartyName' Node and you would find Duplicate Subtree.
    3. Map 'Name1' field in the source to the first 'PartyName' node in the target. Similarly, map Name2, Name3 and Name4 fields to their respective 'PartyName' nodes.
    4. Map the 'Name1' field in the source structure to first 'Name' field in the first 'PartyName' Node. Similarly, follow the same process for Name2, Name3 and Name4 fields. By doing so, your requirement would be met.
    Thank  you.
    Regards,
    Subbu

  • A challenge for anyone who wants one : )

    Hi, I am trying to write a method that basically takes in a vector containing short objects which have variable legnth codes in them. I want to manipulate these shorts and create a new Vector of shorts that contain fixed length code versions of these;
    Right now you can think of the shorts as overlapping on its neighbour in the vector, some of the bits are spilling over into the next short.
    Heres an example to make it clearer
    every short should have two parts, a 3 bit 'id' that tells the algorithm how many bits folling these 3 bits are to be associated with the id. The id can be used to get this number of bits from an array:
    indexlengths[] = {7, 6, 8, 5, 4, 7, 9, 8}
    so, when the algorithm encounters id #2 (the in the 3 leftmost bits) it looks in this array in position 2 and then knows that following the id is 6 bits to be extracted. once this has been extracted a new short should created and, these 6 bits should be added but shifted over to the very right of the short(shifted 13-6 in this case) and this id should added but to the very leftmost 3 bits.
    so:
    010 1111110100000
    (id:2) (6 bits)
    should go to:
    010 0000000111111
    now this wouldn't be too much of a problem BUT the remaining bits that were discarded (in this case 0100000) must be kept and plugged to the next short in the vector
    so if the next short in the vector is
    1010000011111110
    it will have this remainder from the previous short plugged into the right of it
    010 0000101000001 and 'pushed' off is:1111110
    now this process must continue making sure that this remainder that was 'pushed' off in plugged in to the next short BUT FIRST the process that we started with must be applied, a new short is created(for which the resulting fixed legnth code will be stored in), the ID is extracted from the leftmost 3 bits (id: 0) of the current short and the number of bits to follow is found from the above array indexLengths[0] which is 7 bits. these 7 bits are shifted by (16-3)-7 = 6 positions to the right so they are stored in to the rightmost part of this new short and the id will stay at the leftmost 3 bits:
    010 0000000000101 'pushed off: 000001'
    so now we have both 1111110 and 000001 'pushed' off of the same short, as the length of bits of this remainder gets longer and reaches 16, a new short should be created and added to the result vector.
    One more example just to show it visually:
    this time the indexes after the 'id' part are all 6
    int[] indexLengths = {6, 6, 6, 6, 6, 6, 6, 6};
    a vector of 3 shorts:
    111 1000011111111, 011 0111111100000, 101 1000000000000,
    results in:
    111 0000000100001, 111 1111011 011111, 110 00001011000000, 000000
    looking at the first resulting short:
    (id) (6 bits that followed the index shifted to the right most 6 bits)
    111 0000000100001
    the remiander that had to be 'pushed off' is inserted in to the start of the next short and the process starts again.
    I know this is alot to ask, but any tips would be great, java isn't being any help when working with bits and shorts, for example when extracting the id (using a mask and then shifting to the right 13 places) I get negative numbers sometimes!
    Any suggestions on how to break this down into a managable problem to solve would be great too : )
    Thanks!
    Message was edited by:
    digiology

    this might help, heres a method doing the opposite, turning fixed legnth codes into variable length codes, the whole idea of this method is to splim down the array of shorts before sending it in a message. This works fine, however the problem above of doing it the other way around has caused me alot of grief after 3 attempts!
    public Vector convertVectorToSlimmerVector(Vector v)
              System.out.println("initial:");
              for(int i=0;i<v.size();i++)
                   System.out.print(toBinaryString(((Short)v.get(i)).shortValue())+",  ");
              System.out.println();
              Vector result = new Vector();
              //assume vector starts at message part for now
              //seems to be fine for legnths
              int[] indexLengths = {6, 6, 6, 6, 6, 6, 6, 6}; //this will be passes as a parameter or stored in the incomming vector later!
              // above values cant be greater than 13!
              short mask1 = 0x1;
              short mask2 = 0x3;
              short mask3 = 0x7;    //000 0000000000111;
              short mask4 = 0xF;       //000 0000000001111;
              short mask5 = 0x1F;       //000 0000000011111;
              short mask6 = 0x3F;       //000 0000000111111;
              short mask7 = 0x7F;       //000 0000001111111;
              short mask8 = 0xFF;       //000 0000011111111;
              short mask9 = 0x1FF;  //000 0000111111111;
              short mask10 = 0x3FF; //000 0001111111111;
              short mask11 = 0x7FF; //000 0011111111111;
              short mask12 = 0xFFF; //000 0111111111111;
              short mask13 = 0x1FFF;//000 1111111111111;
              short mask14 = 0x3FFF;//001 1111111111111;
              short mask15 = 0x7FFF;//011 1111111111111;
              //short mask16 = 0xFFFF;//111 1111111111111;
              long longMask1 = 0x8000;//100 0000000000000;
              long longMask2 = 0xC000;//110 0000000000000;
              long longMask3 = 0xE000;//111 0000000000000;
              long longMask4 = 0xF000;
              long longMask5 = 0xF800;
              long longMask6 = 0xFC00;
              long longMask7 = 0xFE00;
              long longMask8 = 0xFF00;
              long longMask9 = 0xFF80;
              long longMask10 = 0xFFC0;
              long longMask11 = 0xFFE0;
              long longMask12 = 0xFFF0;
              long longMask13 = 0xFFF8;
              long longMask14 = 0xFFFC;
              long longMask15 = 0xFFFE;
              //others omitted for now
              Vector redundantShortPositions = new Vector();
              //short lengthMask=0xE000;
              long lengthMask = (long)0xF000; //111 0000000000000;
              short[] masks = {mask1, mask2, mask3, mask4, mask5, mask6, mask7, mask8, mask9, mask10, mask11, mask12, mask13, mask14, mask15}; 
              long[] longMasks = {longMask1, longMask2, longMask3, longMask4, longMask5, longMask6, longMask7, longMask8, longMask9, longMask10, longMask11, longMask12, longMask13, longMask14, longMask15};
              short currentShort;
              Short currentShortObject;
              long currentWordLength;
              int indexLength;
              int currentBitLength;
              int numberOfCarriedBits = 0;
              int numberOfBitsToSpillOver = 0; //number of bits that cant be stored in this iteration and will spill over into the next
              int numberOfBitsLeftOver = 0; //number of redundant bits at the end of the current byte(/short?)
              short valueCarriedOver = 0;
              long currentLong;
              String currentProgress;
              Short lastShort = null;
              short l;
              System.out.println();
              for(int index=0; index<v.size(); index++)
                   System.out.println("index:"+index);
                   currentShort = ((Short)v.get(index)).shortValue();
                   currentProgress = toBinaryString(currentShort);
                   System.out.println("progress: "+currentProgress);
                   currentShortObject = (Short)(v.get(index));
                   currentLong = currentShortObject.longValue();
                   currentWordLength = (long)(currentLong & lengthMask);
                   currentWordLength = (currentWordLength>>13);
                   //currentShort = (short)currentLong;
              //     short l2 = (short)currentWordLength;
                   indexLength = indexLengths[(int)currentWordLength]; //make sure that the index length for word legnth 0 is stored above somewhere
                   //System.out.print("isolated legnth: "+toBinaryString((short)currentWordLength)+", ");
                   //l = (short)(currentShort & lengthMask);
                   //currentWordLength = (short)(currentShort & lengthMask);
                   //l = (short)currentWordLength;
                   //currentWordLength >> 13;
              //System.out.println(toBinaryString((short)l));//currentWordLength));
                   //that 1 is added to it
                   if(currentWordLength != 0)
                        currentShort = (short)(currentShort & masks[indexLength-1]); //extract index
                        currentShort = (short)(currentShort << ((16-3)-indexLength));//shift index over (just 3 bits from the left most bit, next to where the length will go)
                                                                                              //number of bits from this short placed in previous short
                        currentBitLength = (3 + indexLength + numberOfCarriedBits)-numberOfBitsLeftOver;
                        currentWordLength = currentWordLength<<13;
                        currentShort = (short)(currentWordLength + currentShort);
                        currentProgress = toBinaryString(currentShort);
                        System.out.println("progress: "+currentProgress);
                        if(index!=0)
                             //number of free bits from last short is > 0
                             if(numberOfBitsLeftOver > 0)
                                  System.out.println("last short: "+toBinaryString(lastShort));
                                  System.out.println("current short: "+toBinaryString(currentShort));
                                  //isolate left most bits from current short that can be stored in previous short
                                  short tmp = (short)(currentShort & longMasks[numberOfBitsLeftOver-1]);
                                  System.out.println("tmp after mask: "+toBinaryString(tmp));
                                  //shift over to rightmost position
                                  tmp = (short)(tmp >> (16-numberOfBitsLeftOver));
                                  tmp = (short)(tmp & masks[numberOfBitsLeftOver-1]);
                                  System.out.println("tmp: "+toBinaryString(tmp));
                                  lastShort = new Short((short)(lastShort.shortValue() + tmp));
                                  System.out.println("lastshort fter spillage: "+toBinaryString(lastShort));
    //                              v.setElementAt(lastShort,(index-1));
    //                              v.remove(index-1);
    //                              v.add(index-1,lastShort);
                                  result.setElementAt(lastShort,(index-1)); //could be buggy (check with dict legnths of 2!)
                                  currentShort = (short)(currentShort << numberOfBitsLeftOver);
                        currentProgress = toBinaryString(currentShort);
                        System.out.println("progress after spilling to previous: "+currentProgress);
    //                    if(currentBitLength <= 8)
    //                         numberOfBitsLeftOver = 8 - currentBitLength;
    //                    else
                        {// if currentBitLength > 8
                             numberOfBitsLeftOver = 16 - currentBitLength;
                             if(numberOfBitsLeftOver < 0)
                                  numberOfBitsToSpillOver = Math.abs(numberOfBitsLeftOver);
                                  numberOfBitsLeftOver = 0;
                             else
                                  numberOfBitsToSpillOver = 0;
                             short pluggedInValue = (short)(valueCarriedOver << (16-numberOfCarriedBits)); //shift value to appropriate left most position
                             if(numberOfCarriedBits > 0)
    //                              isolate part of currentShort that will be 'pushed off' to the right
                                  short temp = (short)(currentShort & masks[numberOfCarriedBits-1]);
                                  valueCarriedOver = temp;
                             else
                                  valueCarriedOver = 0;
                             currentShort = (short)(currentShort >> numberOfCarriedBits);
                             currentShort = (short)(pluggedInValue + currentShort);
                             lastShort = new Short(currentShort);
                             numberOfCarriedBits = numberOfBitsToSpillOver;
                             currentProgress = toBinaryString(currentShort);
                             System.out.println("number of carried bits: "+numberOfCarriedBits);
                             System.out.println("num bits left over: "+numberOfBitsLeftOver);
                             System.out.println("progress: "+currentProgress);
                             //System.out.print(toBinaryString(currentShort)+", ");
                   else
                   {// currentWordLength = 0
                        System.out.println("word length is zero");                    
                   if(numberOfBitsLeftOver >= 16)     //hopefully should be ok, remove condition if not and remove redundant shorts afterwards
                        //reset this value and dont add current shot
                        numberOfBitsLeftOver = numberOfBitsLeftOver - 16;
    //                    System.out.println("BOOLEAN");
    //                    System.out.println(toBinaryString((Short)result.get(index-1)));
                        //result.add(new Boolean(false)); //just to act as a flag
                        System.out.println("position of redundantness? "+index);
                        //store position of redundant short
                        redundantShortPositions.add(new Integer(index));
    //               else
    //                    result.add(new Short(currentShort));
                   result.add(new Short(currentShort));
              //remove redundant shorts
              int offset = 0;
              for(int j=0;j<redundantShortPositions.size();j++)
                   int p = ((Integer)(redundantShortPositions.get(j))).intValue();
                   result.remove(p-offset);
                   offset++;
              System.out.println("result:");
              for(int i=0;i<result.size();i++)
                   System.out.print(toBinaryString(((Short)result.get(i)).shortValue())+",  ");
              return result;
         }here my crappy attempt at solving the first mentioned problem (converting from variable length to fixed legnth):
    public Vector convertToFatterVector(Vector v)
              System.out.println("initial:");
              for(int i=0;i<v.size();i++)
                   System.out.print(toBinaryString(((Short)v.get(i)).shortValue())+",  ");
              short mask1 = 0x1;
              short mask2 = 0x3;
              short mask3 = 0x7;    //000 0000000000111;
              short mask4 = 0xF;       //000 0000000001111;
              short mask5 = 0x1F;       //000 0000000011111;
              short mask6 = 0x3F;       //000 0000000111111;
              short mask7 = 0x7F;       //000 0000001111111;
              short mask8 = 0xFF;       //000 0000011111111;
              short mask9 = 0x1FF;  //000 0000111111111;
              short mask10 = 0x3FF; //000 0001111111111;
              short mask11 = 0x7FF; //000 0011111111111;
              short mask12 = 0xFFF; //000 0111111111111;
              short mask13 = 0x1FFF;//000 1111111111111;
              short mask14 = 0x3FFF;//001 1111111111111;
              short mask15 = 0x7FFF;//011 1111111111111;
              //short mask16 = 0xFFFF;//111 1111111111111;
              long longMask1 = 0x8000;//100 0000000000000;
              long longMask2 = 0xC000;//110 0000000000000;
              long longMask3 = 0xE000;//111 0000000000000;
              long longMask4 = 0xF000;//111 1000000000000;
              long longMask5 = 0xF800;
              long longMask6 = 0xFC00;
              long longMask7 = 0xFE00;
              long longMask8 = 0xFF00;
              long longMask9 = 0xFF80;
              long longMask10 = 0xFFC0;
              long longMask11 = 0xFFE0;
              long longMask12 = 0xFFF0;
              long longMask13 = 0xFFF8;
              long longMask14 = 0xFFFC;
              long longMask15 = 0xFFFE;
              short[] masks = {mask1, mask2, mask3, mask4, mask5, mask6, mask7, mask8, mask9, mask10, mask11, mask12, mask13, mask14, mask15}; 
              long[] longMasks = {longMask1, longMask2, longMask3, longMask4, longMask5, longMask6, longMask7, longMask8, longMask9, longMask10, longMask11, longMask12, longMask13, longMask14, longMask15};
              Vector result = new Vector();
              int[] indexLengths = {6, 6, 6, 6, 6, 6, 6, 6};
              long lengthMask = (long)0xF000;
              //long tmp = 0xE000;
              //short lengthMask = (short)tmp;      //111 0000000000000;
              short indexMask = 0x1FFF;           //000 1111111111111;
              System.out.println();
              System.out.println("length mask: "+toBinaryString((short)lengthMask));
              System.out.println();
              short currentShort;
              long currentLong;
              String currentProgress;
              Short currentShortObject;
              long currentWordLength;
              int indexLength;
              //int numberOfBitsSpillingOver=0;
              short spillValue = 0;
              Short lastShort;
              int currentBitLength;
              int numBitsCarriedOver=0;
              short firstShort;
              short secondShort;
              long firstLong;
              long secondLong;
              short valueThatWasSpilledOver=0;
              short valueThatWillSpillOver=0;
              for(int index=0;index<v.size();index++)
                   currentShort = ((Short)v.get(index)).shortValue();
                   currentLong = ((Short)v.get(index)).longValue();
                   if(index == 0)
                        currentWordLength = (short)(currentShort >> 13);
    //                    currentWordLength = (long)(currentShort & lengthMask);
    //                    System.out.println("currentShort: ");
    //                    currentWordLength = (long)(currentWordLength>>13);
                        System.out.println("current word legnth: " + toBinaryString((short)currentWordLength));
                        indexLength = indexLengths[toAbsoluteIntValue((short)currentWordLength)];//(int)currentWordLength];
                        //numBitsCarriedOver = (int)(13-indexLength);//////
                   //valueThatWillSpillOver = (short)(masks[numBitsCarriedOver-1]&currentShort);
                   currentWordLength = (valueThatWasSpilledOver<<(16-numBitsCarriedOver)&lengthMask);
                   currentWordLength = (short)(currentWordLength>>13);
                                                           //dont forget might need to be set somewhere!
                   currentShort = (short)((currentShort>>numBitsCarriedOver)+(valueThatWasSpilledOver<<(16-numBitsCarriedOver)));
                   System.out.println("progress after spilling from previous:"+toBinaryString(currentShort));
                   //currentShort should now have the length and index contained in it but the index is shifted to the left
                   indexLength = indexLengths[(int)currentWordLength];
                   numBitsCarriedOver = (int)(13-indexLength);
                   valueThatWillSpillOver = masks[13-indexLength];
                   valueThatWasSpilledOver = valueThatWillSpillOver; //?
                   //get index(shifted to the right) on its own
                   short temp = (short)((currentShort & indexMask)>>(13-indexLength));
                   System.out.println("index on its own shifted to the right: "+toBinaryString(temp));
                   //get length on its own
                   short temp2 = (short)(currentShort & lengthMask);
                   System.out.println("length on its own: "+toBinaryString(temp2));
                   currentShort = (short)(temp + temp2);
                   System.out.println("progress after shifting index to the right: "+toBinaryString(currentShort));
                   result.add(new Short(currentShort));
              System.out.println("result");
              for(int i=0;i<result.size();i++)
                   System.out.print(toBinaryString(((Short)result.get(i)).shortValue())+",  ");
              }     

  • Challenge for SQL Query Experts

    Hello Everybody.
    I'm sorry but my English language is not good enough.
    I Have 2 tables.
    First 'tb_Transaction_In' Contains all sales  invoices (items Output from the stock)
    Second 'tb_Transaction_Out' Contains all purchases invoices  (items input  to the stock)
    I want to add  to every Invoice (which has many items) a column which calculate the cost value.
    example:
    stock 1 has an input invoice:
    Quantity of the invoice items 'x' is 10
    UTPrice is 100 for the one 'x'
    so my stock now has 10 pieces of x and the cost of the x is 100$
    =====================
    then the first Output:
    Quantity of the invoice items 'x' is 3
    Current Cost is 100$ for the one 'x'
    My stock has 7 pieces of x 
    =====================
    then the second input:
    Quantity of the invoice items 'x' is 5
    UTPrice is 75$ for the one 'x'
    so my stock now has 7+5 pieces of x and the cost of the x is (100*7 + 75*5) / 7+5
    =====================
    then the seconde Output:
    Quantity of the invoice items 'x' is 10
    Current Cost is 89.5 $ for the one 'x'
    My stock has 2 pieces of x 
    =====================
    ID Stock
    Product Price
    QtyIn QtyOut
    CurrentQty Cost
    1 R1
    x 100$
    10 0 10
    100$
    2 R1
    x 150$
    0 3 7
    100$
    3 R3
    x 75$ 5
    0 12
    89.5
    4 R2
    x 105$
    0 10 2
    89.5
    This is the DDL:
    USE [6]
    GO
    /****** Object:  Table [dbo].[tb_Transaction_In]    Script Date: 25/03/2014 1:19:25 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[tb_Transaction_In](
    [Date] [datetime] NOT NULL,
    [Quantity] [decimal](18, 5) NOT NULL,
    [ProductCode] [nvarchar](50) NOT NULL,
    [StockCode] [nvarchar](23) NOT NULL,
    [Type] [nvarchar](5) NOT NULL,
    [UTPrice] [decimal](18, 5) NULL,
    [NotUsedQty] [decimal](18, 5) NULL,
    [ID] [uniqueidentifier] NOT NULL,
     CONSTRAINT [PK_dbo.tb_Transaction_in] PRIMARY KEY CLUSTERED 
    [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    /****** Object:  Table [dbo].[tb_Transaction_Out]    Script Date: 25/03/2014 1:19:25 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[tb_Transaction_Out](
    [Date] [datetime] NOT NULL,
    [Quantity] [decimal](18, 5) NOT NULL,
    [ProductCode] [nvarchar](50) NOT NULL,
    [StockCode] [nvarchar](50) NOT NULL,
    [Type] [nvarchar](5) NOT NULL,
    [PendingAmount] [decimal](18, 5) NULL,
    [UTPrice] [decimal](18, 5) NULL,
    [ID] [uniqueidentifier] NOT NULL,
     CONSTRAINT [PK_dbo.tb_Transaction_out] PRIMARY KEY CLUSTERED 
    [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(48.00000 AS Decimal(18, 5)), N'TX121/50/W', N'RI', N'AI', CAST(11.09000 AS Decimal(18,
    5)), NULL, N'3b626123-799f-4e92-8fec-003cbeb2f6fc')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'RVS/SP-5-669-59', N'RI', N'AI', CAST(0.00045 AS Decimal(18,
    5)), NULL, N'b65e6927-969f-4bfb-aa0e-0273066bbdea')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501341DBC AS DateTime), CAST(20.00000 AS Decimal(18, 5)), N'YYIS-ICF2S13H1LDK*255', N'RP255', N'ST', CAST(61.08273
    AS Decimal(18, 5)), NULL, N'82de4604-ad11-40ae-a8d2-0926444123cd')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A5014657A5 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'BJ3361L', N'RO', N'RSL', CAST(7905.00000 AS Decimal(18,
    5)), NULL, N'8f3350d5-5cb7-49da-8b69-0e0c61d6c546')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'YYDG-CDM-R 35W', N'RI', N'AI', CAST(152.58000 AS Decimal(18,
    5)), NULL, N'f10eca1d-7215-4015-89de-10f629bc4091')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A50121C4DC AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'AF700F0/1T1.PT.01', N'RT', N'ST', CAST(82.79003 AS Decimal(18,
    5)), NULL, N'617576aa-5c6a-406c-8d76-168f8ba9d62b')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A5012F0B4C AS DateTime), CAST(2.00000 AS Decimal(18, 5)), N'YYHE-SIS180 220V*255', N'RP255', N'ST', CAST(49.64832 AS
    Decimal(18, 5)), NULL, N'a524aea7-2c75-4818-b6ac-196e80aef011')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(12.00000 AS Decimal(18, 5)), N'FO191116', N'RI', N'AI', CAST(132.52000 AS Decimal(18,
    5)), NULL, N'e1804c98-a753-44d2-9fe0-1b41a04099d2')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501341DBC AS DateTime), CAST(21.00000 AS Decimal(18, 5)), N'YYIS-IZT-2S26-M5-LD*255', N'RP255', N'ST', CAST(243.82820
    AS Decimal(18, 5)), NULL, N'93217ef1-a1c5-47af-8c49-1c8cacaf7f35')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'CIDV-ITACA/48*GOLD', N'RT', N'AI', CAST(441.94000 AS Decimal(18,
    5)), NULL, N'a9de52c4-a814-4db8-8db8-1e7a391f6450')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'FO25131', N'RI', N'AI', CAST(45.70000 AS Decimal(18, 5)),
    NULL, N'57480184-b8a7-43f3-a522-effc3733bcb7')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'NNSRC-181', N'RP303', N'AI', CAST(272.04000 AS Decimal(18,
    5)), NULL, N'292d363f-9be4-471c-b868-f41fc1a74138')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A5012F0B4C AS DateTime), CAST(42.00000 AS Decimal(18, 5)), N'YYHE-TC126-42*255', N'RP255', N'ST', CAST(47.80049 AS
    Decimal(18, 5)), NULL, N'732adced-785d-4c0a-b675-f436e9fcd430')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'SKDVW0808EA', N'RI', N'AI', CAST(3862.27000 AS Decimal(18,
    5)), NULL, N'f00853e4-f585-4cf7-994c-f4edf8cb421b')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(3.00000 AS Decimal(18, 5)), N'LLIL-89147', N'RI', N'AI', CAST(62.50219 AS Decimal(18,
    5)), NULL, N'3e7a26cd-ece2-44b0-8416-f500e5bb0bfb')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A5012F0B4C AS DateTime), CAST(100.00000 AS Decimal(18, 5)), N'YYHE-SI218-40*255', N'RP255', N'ST', CAST(52.80909 AS
    Decimal(18, 5)), NULL, N'90ad3dcd-6478-4b86-bdec-f7818ad7156f')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(135.00000 AS Decimal(18, 5)), N'LA4903020*294', N'RI', N'AI', CAST(379.04000 AS Decimal(18,
    5)), NULL, N'0b62da54-5db6-465f-8229-f79a93c4dbf1')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'DN921/FL 2X28*303', N'RI', N'AI', CAST(69.74000 AS Decimal(18,
    5)), NULL, N'270cb795-83c2-43b1-ae43-f8bef36b3470')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A501207B90 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'FO173011/220V*407', N'RI', N'AI', CAST(118.00000 AS Decimal(18,
    5)), NULL, N'cca4ac36-7538-45d0-90f8-f9a941515b74')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A5012F0B4C AS DateTime), CAST(12.00000 AS Decimal(18, 5)), N'YYHE-SI217-32-UNI*255', N'RP255', N'ST', CAST(51.15577
    AS Decimal(18, 5)), NULL, N'9da49db4-8bfb-488d-a153-fd36ef21df47')
    INSERT [dbo].[tb_Transaction_In] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [UTPrice], [NotUsedQty], [ID]) VALUES (CAST(0x0000A2A600DE48DC AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'LLIL-84700*253', N'RI', N'ST', CAST(143.01118 AS Decimal(18,
    5)), NULL, N'01831955-485b-4d6c-9665-fda401b8a5d1')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A500C6CA8F AS DateTime), CAST(25.00000 AS Decimal(18, 5)), N'KHBG-4345*318', N'RI', N'ST', CAST(0.00000 AS Decimal(18,
    5)), CAST(1431.68531 AS Decimal(18, 5)), N'77d8fe2b-b7f7-4afb-baf2-00371e49ef50')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A600DE48DC AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'FO81177', N'RP318', N'ST', CAST(0.00000 AS Decimal(18,
    5)), CAST(125.19275 AS Decimal(18, 5)), N'64bb5a74-4f36-40bb-8a15-0178d9ce3532')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A500E4483C AS DateTime), CAST(2202.00000 AS Decimal(18, 5)), N'TNSP-0594*020', N'RI', N'TO', CAST(0.00000 AS Decimal(18,
    5)), CAST(4.88155 AS Decimal(18, 5)), N'a6d2c5e8-315e-427f-9745-01c5f6857f62')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A50120C690 AS DateTime), CAST(10.00000 AS Decimal(18, 5)), N'ES651900S*253', N'RI', N'AO', CAST(0.00000 AS Decimal(18,
    5)), CAST(94.01000 AS Decimal(18, 5)), N'ae8a9ba7-74db-4f7d-b830-01f099ac24de')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A501139E98 AS DateTime), CAST(29.00000 AS Decimal(18, 5)), N'KHZM-42176950*255', N'RI', N'ST', CAST(0.00000 AS
    Decimal(18, 5)), CAST(361.52127 AS Decimal(18, 5)), N'2611d667-8db3-4e71-a543-0245258a5788')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A501203C48 AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'TN802/21', N'RP255', N'ST', CAST(0.00000 AS Decimal(18,
    5)), CAST(222.08500 AS Decimal(18, 5)), N'01027e8a-e576-4605-a420-03524fab994e')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A500BE530C AS DateTime), CAST(13.00000 AS Decimal(18, 5)), N'ES651900S*253', N'RP253', N'SL', CAST(0.00000 AS Decimal(18,
    5)), CAST(120.00000 AS Decimal(18, 5)), N'dce64410-15b5-4ecc-88b4-04e2b7eac306')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A5011CE020 AS DateTime), CAST(5.00000 AS Decimal(18, 5)), N'LA9801023*313', N'RI', N'TO', CAST(0.00000 AS Decimal(18,
    5)), CAST(1288.96600 AS Decimal(18, 5)), N'3ce3c4b9-b0b4-45c6-b14e-058cb08608d2')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A500D8910A AS DateTime), CAST(4.00000 AS Decimal(18, 5)), N'LA4906203*294', N'RI', N'ST', CAST(0.00000 AS Decimal(18,
    5)), CAST(62.34000 AS Decimal(18, 5)), N'25332af7-8f8c-489f-9e96-06427e4b64db')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A50103903E AS DateTime), CAST(24.00000 AS Decimal(18, 5)), N'YYLT-TRWW 155 HFP*294', N'RP313', N'SL', CAST(0.00000
    AS Decimal(18, 5)), CAST(325.00000 AS Decimal(18, 5)), N'4550841e-8ec9-4528-99d9-fcbef5215030')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A5012F0B4C AS DateTime), CAST(2.00000 AS Decimal(18, 5)), N'YYHE-SIS180 220V*255', N'RI', N'ST', CAST(0.00000 AS
    Decimal(18, 5)), CAST(49.64832 AS Decimal(18, 5)), N'10018f9c-a6ba-47c4-aff3-fd515f18c883')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A5012F0B4C AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'YYHE-SH150IZ*255', N'RI', N'ST', CAST(0.00000 AS Decimal(18,
    5)), CAST(74.20504 AS Decimal(18, 5)), N'2a43869a-4300-486d-b534-fe336cc37aeb')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A500BE530C AS DateTime), CAST(4.00000 AS Decimal(18, 5)), N'YYVL-00358', N'RP253', N'SL', CAST(0.00000 AS Decimal(18,
    5)), CAST(80.00000 AS Decimal(18, 5)), N'c22c794d-cefe-40a2-b813-fea8aa2cc5fb')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A500DBEC64 AS DateTime), CAST(50.00000 AS Decimal(18, 5)), N'TX203/50/BR', N'RI', N'ST', CAST(0.00000 AS Decimal(18,
    5)), CAST(33.85686 AS Decimal(18, 5)), N'3367f8a0-75ff-476e-b3ca-ff095ed25ba6')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A500BE530C AS DateTime), CAST(1.00000 AS Decimal(18, 5)), N'TN0453/3/21', N'RP253', N'SL', CAST(0.00000 AS Decimal(18,
    5)), CAST(250.00000 AS Decimal(18, 5)), N'6c87e1ad-98f8-485d-87e6-ff238eb2317e')
    INSERT [dbo].[tb_Transaction_Out] ([Date], [Quantity], [ProductCode], [StockCode], [Type], [PendingAmount], [UTPrice], [ID]) VALUES (CAST(0x0000A2A501341DBC AS DateTime), CAST(244.00000 AS Decimal(18, 5)), N'YYIS-ICF2S26H1LDK*255', N'RI', N'ST', CAST(0.00000
    AS Decimal(18, 5)), CAST(61.08273 AS Decimal(18, 5)), N'2d04ada8-ee92-4f28-9cbe-ffb855ebd93b')
    ALTER TABLE [dbo].[tb_Transaction_In] ADD  CONSTRAINT [DF_tb_Transaction_In_Date]  DEFAULT (getdate()) FOR [Date]
    GO
    ALTER TABLE [dbo].[tb_Transaction_In] ADD  CONSTRAINT [DF_tb_Transaction_In_Quantity]  DEFAULT ((0)) FOR [Quantity]
    GO
    ALTER TABLE [dbo].[tb_Transaction_In] ADD  CONSTRAINT [DF_tb_Transaction_in_ID]  DEFAULT (newid()) FOR [ID]
    GO
    ALTER TABLE [dbo].[tb_Transaction_Out] ADD  CONSTRAINT [DF_tb_Transaction_Out_Date]  DEFAULT (getdate()) FOR [Date]
    GO
    ALTER TABLE [dbo].[tb_Transaction_Out] ADD  CONSTRAINT [DF_tb_Transaction_Out_Quantity]  DEFAULT ((0)) FOR [Quantity]
    GO
    ALTER TABLE [dbo].[tb_Transaction_Out] ADD  CONSTRAINT [DF_tb_Transaction_Out_Type]  DEFAULT ((0)) FOR [Type]
    GO
    ALTER TABLE [dbo].[tb_Transaction_Out] ADD  CONSTRAINT [DF_tb_Transaction_oUT_ID]  DEFAULT (newid()) FOR [ID]
    GO

    You can do it by means of computed column based on a UDF. 
    so in your table just add a column like below
    CREATE TABLE
    cost as dbo.GetItemCode(ItemCode)
    and function would be as below
    CREATE FUNCTION dbo.GetItemCode
    @ItemCode varchar(20)
    RETURNS Numeric(10,2)
    AS
    BEGIN
    DECLARE @WAP Numeric(10,2)
    SELECT @WAP = SUM((COALESCE(i.Qty,0) - COALESCE(o.Qty,0)) * i.UTPrice)* 1.0/NULLIF(SUM(COALESCE(i.Qty,0) - COALESCE(o.Qty,0)),0)
    FROM (SELECT ProductCode,StockCode,UTPrice,SUM(Quantity) AS Qty
    FROM transaction_in
    GROUP BY ProductCode,StockCode,UTPrice)i
    FULL OUTER JOIN SELECT ProductCode,StockCode,UTPrice,SUM(Quantity) AS Qty
    FROM transaction_out
    GROUP BY ProductCode,StockCode,UTPrice) o
    ON o.ProductCode = i.ProductCode
    AND o.StockCode = i.StockCode
    RETURN (@WAP)
    END
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Challenger for a serious troubleshooter - shuffles thru songs...

    For some reason the Ipod will play thru an album or shuffle song lists but will not acutally play songs. All of the song info comes up on the screen but it just changes to the next song without playing. I also cannot get the ipod to reset. When plugged in to usb(pc), permanent "do not disconnect comes up". ipod is also not identified on itunes. Ipod is identified as a computer drive though. Drive contains folders called :notes, contacts, calender and a notepad file called bootex. no other files. If you try to open file you ge error message foldername is not accessible. The file or directory is corrupted and unreadable. Bootex file reads:
    Checking file system on M:
    The type of the file system is FAT32.
    One of your disks needs to be checked for consistency. You
    may cancel the disk check, but it is strongly recommended
    that you continue.
    Windows will now check the disk.
    Volume Serial Number is 7681-CEFE
    The specified disk appears to be a non-Windows XP disk.
    Do you want to continue? (Y/N) No
    Checking file system on M:
    The type of the file system is FAT32.
    One of your disks needs to be checked for consistency. You
    may cancel the disk check, but it is strongly recommended
    that you continue.
    Windows will now check the disk.
    Volume Serial Number is 7681-CEFE
    The specified disk appears to be a non-Windows XP disk.
    Do you want to continue? (Y/N) No
    (I just discovered this message and will run scandisk. Message came up when rebooting system after downloading ipod updater-thought it was referring to hard drive)
    There is music on this ipod but no other stuff. Unit is 5 months old with little use. Not dropped. Was working fine, ear plug was pulled out while playing (on purpose)and plugged back in while playing. I may have turned it off then back on and hit shuffle then noticed it wasn't working properly. Have not tried to restore to original settings but that will but next on the list.
    Has anyone ever experienced this?
    Thanks
    Bart

    Here's what I suggest:
    1) Copy the (hidden) Music directories over to your PC (assumes you can mount as a USB drive)
    2) Restore/reformat your Mini via the "standalone" iPod updater (don't do it via iTunes)
    3) Recover as many of the mp3's as possible (some will have unrecognizable names) and reload them into iTunes
    4) Properly update you iPod
    You may not be able to reload ALL of your music (depending on how much was "bought" and how much you "ripped"), but it will get you going again. I buy very little off of iTunes (most I make myself from CD's), so I actually used some of my backup recently when I upgraded my Mini.

Maybe you are looking for

  • In Columns mode, Preview QTs no longer have scroll bars...Why?

    I used to really like looking for files in the Finder mode, in the Column view; then finding the QT, and previewing it in the Preview column, complete with scroll bar. That was the Old Days. Is there anyway in Leopard to get the scroll bar back? (BTW

  • Temporal hierarchy join - validity (0TCTVINTV)

    Hello experts, today it is a hierachy display problem in a report: We present a time dependent hierarchy structure with a temporal join. This is to have the postings in the correct periods of the hierarchy. A characteristic of this hierarchy is the v

  • Manually updating podcasts in 7

    I may be missing something but I can't find how to manually update podcasts in 7.

  • Odd Vibrate Behaviour after 3.1.2 Update

    I saw one other post concerning this issue, and was curious how many others have experienced this 'problem' (or if anyone has stumbled on a 'fix'): Since I updated to 3.1.2, with my iPhone vibrate setting ON, after the 'sound switch' is placed to sil

  • Why will Firefix not open after updating to version 28?

    Just updated to version 28 on a Windows 7 64-bit machine. I get nothing on the screen if I attempt to open Firefox, but it does appear to be running in the background if I open Task Manager. I re-installed my original version 20 and it works.