Search Results

Search found 19 results on 1 pages for 'ina'.

Page 1/1 | 1 

  • How to generate a random unique string with more than 2^30 combination. I also wanted to reverse the process. Is this possible?

    - by Yusuf S
    I have a string which contains 3 elements: a 3 digit code (example: SIN, ABD, SMS, etc) a 1 digit code type (example: 1, 2, 3, etc) a 3 digit number (example: 500, 123, 345) Example string: SIN1500, ABD2123, SMS3345, etc.. I wanted to generate a UNIQUE 10 digit alphanumeric and case sensitive string (only 0-9/a-z/A-Z is allowed), with more than 2^30 (about 1 billion) unique combination per string supplied. The generated code must have a particular algorithm so that I can reverse the process. For example: public static void main(String[] args) { String test = "ABD2123"; String result = generateData(test); System.out.println(generateOutput(test)); //for example, the output of this is: 1jS8g4GDn0 System.out.println(generateOutput(result)); //the output of this will be ABD2123 (the original string supplied) } What I wanted to ask is is there any ideas/examples/libraries in java that can do this? Or at least any hint on what keyword should I put on Google? I tried googling using the keyword java checksum, rng, security, random number, etc and also tried looking at some random number solution (java SecureRandom, xorshift RNG, java.util.zip's checksum, etc) but I can't seem to find one? Thanks! EDIT: My use case for this program is to generate some kind of unique voucher number to be used by specific customers. The string supplied will contains 3 digit code for company ID, 1 digit code for voucher type, and a 3 digit number for the voucher nominal. I also tried adding 3 random alphanumeric (so the final digit is 7 + 3 digit = 10 digit). This is what I've done so far, but the result is not very good (only about 100 thousand combination): public static String in ="somerandomstrings"; public static String out="someotherrandomstrings"; public static String encrypt(String kata) throws Exception { String result=""; String ina=in; String outa=out; Random ran = new Random(); Integer modulus=in.length(); Integer offset= ((Integer.parseInt(Utils.convertDateToString(new Date(), "SS")))+ran.nextInt(60))/2%modulus; result=ina.substring(offset, offset+1); ina=ina+ina; ina=ina.substring(offset, offset+modulus); result=result+translate(kata, ina, outa); return result; } EDIT: I'm sorry I forgot to put the "translate" function : public static String translate(String kata,String seq1, String seq2){ String result=""; if(kata!=null&seq1!=null&seq2!=null){ String[] a=kata.split(""); for (int j = 1; j < a.length; j++) { String b=a[j]; String[]seq1split=seq1.split(""); String[]seq2split=seq2.split(""); int hint=seq1.indexOf(b)+1; String sq=""; if(seq1split.length>hint) sq=seq1split[hint]; String sq1=""; if(seq2split.length>hint) sq1=seq2split[hint]; b=b.replace(sq, sq1); result=result+b; } } return result; }

    Read the article

  • how to create <tr> row and append/insert it into a table a run time ina web page + MSHTML

    - by madhu
    Hi I'm using IHTMLdocument2 to create Element This is my code: IHTMLdocument2 pDoc2;//it is initialized in ma code BSTR eTag = SysAllocString(L"TR"); IHTMLElement *pTRElmt = NULL; hr = pDoc2->createElement(eTag,&pTRElmt); if(FAILED(hr)) return hr; IHTMLDOMNode *pTRNode = NULL; hr = pTRElmt->QueryInterface(IID_IHTMLDOMNode, (void **)&pTRNode); if(FAILED(hr)) return hr; // create TD node IHTMLElement *pTDElmt = NULL; hr = pDoc2->createElement(L"TD",&pTDElmt); if(FAILED(hr)) return hr; IHTMLDOMNode *pTDNode = NULL; hr = pTDElmt->QueryInterface(IID_IHTMLDOMNode,(void **)&pTDNode); if(FAILED(hr)) return hr; IHTMLDOMNode *pRefNode = NULL; hr = pTRNode->appendChild(pTDNode,&pRefNode); if(FAILED(hr)) return hr; // create TEXT Node IHTMLDOMNode *pTextNode = NULL; hr = pDoc3->createTextNode(L"madhu", &pTextNode); if(FAILED(hr)) return hr; IHTMLDOMNode *pRefNod = NULL; hr = pTDNode->appendChild(pTextNode,&pRefNod); if(FAILED(hr)) return hr; //********* setting attributes for <tr> /* VARIANT bgclor; bgclor.vt = VT_I4; bgclor.lVal =0xC0C0C0; hr = newElem->setAttribute(L"bgcolor",bgclor,1); if(FAILED(hr)) return hr; VARIANT style; style.vt = VT_BSTR; style.bstrVal = SysAllocString(L"display: table-row"); hr = newElem->setAttribute(L"style",style,1); if(FAILED(hr)) return hr; VARIANT id; id.vt = VT_BSTR; id.bstrVal = SysAllocString(L"AttrRowMiddleName"); hr = newElem->setAttribute(L"id",id,1); if(FAILED(hr)) return hr; */ //create <td> for row <tr> /* VARIANT Name; Name.vt = VT_BSTR; Name.bstrVal = SysAllocString(L"MiddleName"); hr = newElem->setAttribute(L"name",Name,1); if(FAILED(hr)) return hr; VARIANT Type; Type.vt = VT_BSTR; Type.bstrVal = SysAllocString(L"text"); hr = newElem->setAttribute(L"type",Type,1); if(FAILED(hr)) return hr; VARIANT Value; Value.vt = VT_BSTR; Value.bstrVal = SysAllocString(L"button"); hr = newElem->setAttribute(L"value",Value,1); if(FAILED(hr)) return hr; */ //IHTMLDOMNode *pReturn = NULL; //hr = pParentNode->replaceChild(pdn,pFirstchild,&pReturn); //if(FAILED(hr)) // return hr; VARIANT refNode; refNode.vt = VT_DISPATCH; refNode.pdispVal = pDomNode; IHTMLDOMNode *pREfTochild = NULL; hr = pParentNode->insertBefore(pTRNode,refNode,&pREfTochild); if(FAILED(hr)) return hr; This is inserting something but not visible and inserting as and when tr tag comes I even tried with clone but same problem. pls anybody give right code for this

    Read the article

  • Is it possible to replace values ina queryset before sending it to your template?

    - by Issy
    Hi Guys, Wondering if it's possible to change a value returned from a queryset before sending it off to the template. Say for example you have a bunch of records Date | Time | Description 10/05/2010 | 13:30 | Testing... etc... However, based on the day of the week the time may change. However this is static. For example on a monday the time is ALWAYS 15:00. Now you could add another table to configure special cases but to me it seems overkill, as this is a rule. How would you replace that value before sending it to the template? I thought about using the new if tags (if day=1), but this is more of business logic rather then presentation. Tested this in a custom template tag def render(self, context): result = self.model._default_manager.filter(from_date__lte=self.now).filter(to_date__gte=self.now) if self.day == 4: result = result.exclude(type__exact=2).order_by('time') else: result = result.order_by('type') result[0].time = '23:23:23' context[self.varname] = result return '' However it still displays the results from the DB, is this some how related to 'lazy' evaluation of templates? Thanks! Update Responding to comments below: It's not stored wrong in the DB, its stored Correctly However there is a small side case where the value needs to change. So for example I have a From Date & To date, my query checks if todays date is between those. Now with this they could setup a from date - to date for an entire year, and the special cases (like mondays as an example) is taken care off. However if you want to store in the DB you would have to capture several more records to cater for the side case. I.e you would be capturing the same information just to cater for that 1 day when the time changes. (And the time always changes on the same day, and is always the same)

    Read the article

  • php function output ina table row... how?

    - by user352868
    I want to run this function but show the result in a table row strlen($cat_row['sms'] This is what i came up with but it is not working: echo "<tr><td bgcolor=#626E7A>".**strlen($cat_row['cars']**."</td></tr>"; How do you show result of a php function in a table row? i am trying to format the output some how. please help

    Read the article

  • Best way to migrate servers without losing any data and with no downtime(?)

    - by ina
    This is a methodology question from a freelancer, with a corollary on MySQL.. Is there a way to migrate from an old dedicated server to a new one without losing any data in-between - and with no downtime? In the past, I've had to lose MySQL data between the time when the new server goes up (i.e., all files transferred, system up and ready), and when I take the old server down (data still transferred to old until new one takes over). There is also a short period where both are down for DNS, etc., to refresh. Is there a way for MySQL/root to easily transfer all data that was updated/inserted between a certain time frame?

    Read the article

  • regular expression code

    - by Gaia Andreoletti
    Deal all, I need to find match between two tab delimited files files like this: File 1: ID1 1 65383896 65383896 G C PCNXL3 ID1 2 56788990 55678900 T A ACT1 ID1 1 56788990 55678900 T A PRO55 File 2 ID2 34 65383896 65383896 G C MET5 ID2 2 56788990 55678900 T A ACT1 ID2 2 56788990 55678900 T A HLA what I would like to do is to retrive the matching line between the two file. What I would like to match is everyting after the gene ID So far I have written this code but unfortunately perl keeps giving me the error: use of "Use of uninitialized value in pattern match (m//)" Could you please help me figure out where i am doing it wrong? Thank you in advance! use strict; open (INA, $ARGV[0]) || die "cannot to open gene file"; open (INB, $ARGV[1]) || die "cannot to open coding_annotated.var files"; my @sample1 = <INA>; my @sample2 = <INB>; foreach my $line (@sample1) { my @tab = split (/\t/, $line); my $chr = $tab[1]; my $start = $tab[2]; my $end = $tab[3]; my $ref = $tab[4]; my $alt = $tab[5]; my $name = $tab[6]; foreach my $item (@sample2){ my @fields = split (/\t/,$item); if ($fields[1]=~ m/$chr(.*)/ && $fields[2]=~ m/$start(.*)/ && $fields[4]=~ m/$ref(.*)/ && $fields[5]=~ m/$alt(.*)/&& $fields[6]=~ m/$name(.*)/){ print $line,"\n",$item; } } }

    Read the article

  • how can I handle user defined exceptions and after handling them resume the flow of program. here is

    - by fari
    /** * An exception thrown when an illegal side pit was * specified (i.e. not in the range 1-6) for a move */ public class IllegalSidePitNumException extends RuntimeException { /** * Exception constructor. * @param sidePitNum the illegal side pit that was selected. */ public IllegalSidePitNumException(int sidePitNum) { super("No such side pit number: "+sidePitNum); } } how do i use this ina program and then resume for there. I do not want the program to end but want to handle the exception and continue.

    Read the article

  • How to delete files on the command line with regular expressions?

    - by Jack
    Lets say I have 20 files named FOOXX, where XX is the number of the file, eg 01, 02 etc. At the moment, if I want to delete all files lower than the number 10, this is easy and I just use a wildcard, eg rm FOO0* However, if I want to delete specific files ina range, eg 13-15, this becomes more difficult. rm FPP[13-15] does not work, and asks me if I wish to delete all files. Likewse rm FOO1[3-5] wishes to delete all files that begin with FOO1 So, what is the best way to delete ranges of files like this? I have tried with both bash and zsh, and I don't think they differ so much for such a basic task?

    Read the article

  • update query on multiple tables

    - by jon
    I have a schema like : employees (eno, ename, zip, hdate) customers (cno, cnmae, street, zip, phone) zipcodes (zip, city) where zip is pk in zipcodes and fk in other tables. I have to write an update query which updates all the occurence of zipcode 4994 to 1234 throughout the database. update zipcodes,customers,employees set zip = 0 where customers.zip = zipcodes.zip and employees.zip = zipcodes.zip; but i know i am not doing it right. Is there a way to update all the tables zip ina single update query?

    Read the article

  • Table data display in HTML

    - by Hulk
    In the following table how to adjust the height and width automatically for the table. i.e, if the data is more it should display all the data else present data ina fashionable manner <table="mytable"> <tr><td>more data.............................................................................</td> <td>a</td> </tr> In the nothing should be wrapped wither in case of large chuks of data or small chunks of data. Thanks....

    Read the article

  • jquery background image fade

    - by Nick
    I am using jQuery to load ina background image that fills the page width / height. I have the following in the Head: $(document).ready(function() { $('body').css({ 'background-image' : 'url({HTML_BASE}images/backgrounds/randoms/{BACK_IMG})', 'background-repeat' : 'no-repeat', 'background-position' : 'center top', 'background-attachment': 'fixed', 'background-size': '100% 100%', }); $('#home-promo').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: 'auto' }); $('.model-search').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: '393' }); }); This works fine and can be seen at http://projects.snowshtechnologies.com/golden_dragon/home/ I want the BG image to fade in from the black background colour. I have looked at a few other threads on Stack that suggest its not possible as a body element defined in css, but in this scenario the BG image is being loaded in by jQuery. How would I go about adding a fade in to this code to bring the image in with a nice fadein?

    Read the article

  • trouble finding element on page using xpath or css

    - by doneright
    Guys, I'm trying to write xpath or css to find/click on list element "All" based on known span(in this case SNG NAME below). On page, there are different lists Which can contain same list item called as "All". So we have to identify "All" based on span(in this case SNG NAME below) can someone shed some light on my issue <html> <head> <body> <div class="grc_selected"> <div class ="lbl_selected"> <span> SNG NAME </span> </div> <div id="id1" class="cl1"> <ul id="id_ul"> <li class="tclass" title="[1] All"> <img class="treeIcon" src="1/2/3.gif"/> <span class="inA">All</span> </li> </ul> </div> </body> </head> </html>

    Read the article

  • Silverlight Cream for January 11, 2011 -- #1024

    - by Dave Campbell
    1,000 blogposts is quite a few, but to die-hard geeks, 1000 isn't the number... 1K is the number, and today is my 1K blogpost! I've been working up to this for at least 11 months. Way back at MIX10, I approached some vendors about an idea I had. A month ago I contacted them and others, and everyone I contacted was very generous and supportive of my idea. My idea was not to run a contest, but blog as normal, and whoever ended up on my 1K post would get some swag... and I set a cut-off at 13 posts. So... blogging normally, I had some submittals, and then ran my normal process to pick up the next posts until I hit a total of 13. To provide a distribution channel for the swag, everyone on the list, please send me your snail mail (T-shirts) and email (licenses) addresses as soon as possible.   I'd like to thank the following generous sponsors for their contributions to my fun (in alphabetic order): and Rachel Hawley for contributing 4 Silverlight control sets First Floor Software and Koen Zwikstra for contributing 13 licenses for Silverlight Spy and Sara Faatz/Jason Beres for contributing 13 licenses for Silverlight Data Visualization controls and Svetla Stoycheva for contributing T-Shirts for everyone on the post and Ina Tontcheva for contributing 13 licenses for RadControls for Silverlight + RadControls for Windows Phone and Charlene Kozlan for contributing 1 combopack standard, 2 DataGrid for Silverlight, and 2 Listbox for Silverlight Standard And now finally...in this Issue: Nigel Sampson, Jeremy Likness, Dan Wahlin, Kunal Chowdhurry, Alex Knight, Wei-Meng Lee, Michael Crump, Jesse Liberty, Peter Kuhn, Michael Washington, Tau Sick, Max Paulousky, Damian Schenkelman Above the Fold: Silverlight: "Demystifying Silverlight Dependency Properties" Dan Wahlin WP7: "Using Windows Phone Gestures as Triggers" Nigel Sampson Expression Blend: "PathListBox: making data look cool" Alex Knight From SilverlightCream.com: Using Windows Phone Gestures as Triggers Nigel Sampson blogged about WP7 Gestures, the Toolkit, and using Gestures as Triggers, and actually makes it looks simple :) Jounce Part 9: Static and Dynamic Module Management Jeremy Likness has episode 9 of his explanation of his MVVM framework, Jounce, up... and a big discussion of Modules and Module Management from a Jounce perspective. Demystifying Silverlight Dependency Properties Dan Wahlin takes a page from one of his teaching opportunities, and shares his knowledge of Dependency Properties with us... beginning with what they are, defining them in code, and demonstrating their use. Customizing Silverlight ChildWindow Style using Blend Kunal Chowdhurry has a great post up about getting your Child Windows to match the look & feel of the rest of youra app... plus a bunch of Blend goodness thrown in. PathListBox: making data look cool File this post by Alex Knight in the 'holy crap' file along with the others in this series! ... just check out that cool Ticker Style Path ListBox at the top of the blog... too cool! Web Access in Windows Phone 7 Apps Wei-Meng Lee has the 3rd part of his series on WP7 development up and in this one is discussing Web Access... I mean *discussing* it... tons of detail, code, and explanation... great post. Prevent your Silverlight XAP file from caching in your browser. Michael Crump helps relieve stress on Silverlight developers everywhere by exploring how to avoid caching of your XAP in the browser... (WPFS) MVVM Light Toolkit: Soup To Nuts Part I Jesse Liberty continues his Windows Phone from Scratch series with a new segment exploring Laurent Bugnion's MVVMLight Toolkit beginning with acquiring and installing the toolkit, then proceeds to discuss linking the View and ViewModel, the ViewModel Locator, and page navigation. Silverlight: Making a DateTimePicker Peter Kuhn attacks a problem that crops up on the forums a lot -- a DateTimePicker control for Silverlight... following the "It's so simple to build one yourself" advice, he did so, and provides the code for all of us! Windows Phone 7 Animated Button Press Michael Washington took exception to button presses that gave no visual feedback and produced a behavior that does just that. Using TweetSharp in a Windows Phone 7 app Tau Sick demonstrates using TweetSharp to put a twitter feed into a WP7 app, as he did in "Hangover Helper"... all the instructions from getting Tweeetshaprt to the code necessary. Bindable Application Bar Extensions for Windows Phone 7 Max Paulousky has a post discussing some real extensions to the ApplicationBar for WP7.. he begins with a bindable application bar by Nicolas Humann that I've missed, probably because his blog is in French... and extends it to allow using DelegateCommand. How to: Load Prism modules packaged in a separate XAP file in an OOB application Damian Schenkelman posts about Prism, AppModules in separate XAPs and running OOB... if you've tried this, you know it's a hassle.. Damian has the solution. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Jquery get selected checkboxes

    - by kevin
    Hi id like to get the list of selected checkboxes ina page, actually what I really need is th get the text of the element next to the checkbox which is a html element the code is below and its not working the html is as follows <script type="text/javascript"> $(document).ready(function () { $('#target').click(function () { alert("in"); var checkValues = []; $('input[name=checkboxlist]:checked').each(function() { alert($(this)val()); checkValues.push($(this)val()); }); }); }); </script> HTML: <ul id="7b1fe2bd-1b26-4185-8cd9-aec10e652a70"> <li>Structured Products<input type="checkbox" name="checkboxlist"</li> <li>Global FID <ul> <li>PowerPoint Presentations<input type="checkbox" name="checkboxlist"</li> <li>Global Deck <ul> <li>Test1<input type="checkbox" name="checkboxlist"</li> <li>Test2<input type="checkbox" name="checkboxlist"</li> <li>Test3<input type="checkbox" name="checkboxlist"</li> </ul> <input type="checkbox" name="checkboxlist"</li> <li>Credit Default Swaps Position <ul> <li>Test4<input type="checkbox" name="checkboxlist"</li> <li>Test5<input type="checkbox" name="checkboxlist"</li> </ul> <input type="checkbox" name="checkboxlist"</li> <li>Thought Leadership<input type="checkbox" name="checkboxlist"</li> <li>Fixed Income Perspectives<input type="checkbox" name="checkboxlist"</li> <li>Public Policy Information and Regulatory<input type="checkbox" name="checkboxlist"</li> <li>Regional FID<input type="checkbox" name="checkboxlist"</li> </ul> <input type="checkbox" name="checkboxlist"</li> <li>Global Rates<input type="checkbox" name="checkboxlist"</li> <li>Global Credit Products<input type="checkbox" name="checkboxlist"</li> <li>FX<input type="checkbox" name="checkboxlist"</li> <li>Emerging Markets<input type="checkbox" name="checkboxlist"</li> <li>Commodities<input type="checkbox" name="checkboxlist"</li> <li>testcat<input type="checkbox" name="checkboxlist"</li> <li>testcat<input type="checkbox" name="checkboxlist"</li> </ul>

    Read the article

  • Cross Browser Issue

    - by dazedandconfused
    My background is in WinForms programming and I'm trying to branch out a bit. I'm finding cross-browser issues a frustrating barrier in general, but have a specific one that I just can't seem to work through. I want to display an image and place a semi-transparent bar across the top and bottom. This isn't my ultimate goal, of course, but it demonstrates the problem I'm having ina a relatively short code fragment so let's go with it. The sample code below displays as intended in Chrome, Safari, and Firefox. In IE8, the bar at the bottom doesn't appear at all. I've researched it for hours but just can't seem to come up with the solution. I'm sure this is some dumb rookie mistake, but gotta start somewhere. Code snippet... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript" language="javascript"> </script> <style type="text/css"> .workarea { position: relative; border: 1px solid black; background-color: #ccc; overflow: hidden; cursor: move; -moz-user-focus: normal; -moz-user-select: none; unselectable: on; } .semitransparent { filter: alpha(opacity=70); -moz-opacity: 0.7; -khtml-opacity: 0.7; opacity: 0.7; background-color: Gray; } </style> </head> <body style="width: 800px; height: 600px;"> <div id="workArea" class="workarea" style="width: 800px; height: 350px; left: 100px; top: 50px; background-color: White; border: 1px solid black;"> <img alt="" src="images/TestImage.jpg" style="left: 0px; top: 0px; border: none; z-index: 1;" /> <div id="topBar" class="semitransparent" style="position: absolute;width: 800px; height: 75px; left: 0px; top: 0px; min-height: 75px; border: none; z-index: 2;" /> <div id="bottomBar" class="semitransparent" style="position: absolute; width: 800px; height: 75px; left: 0px; top: 275px; min-height: 75px; border: none; z-index: 2;" /> </div> </body> </html>

    Read the article

1