Search Results

Search found 491 results on 20 pages for 'aa'.

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

  • creating button

    - by eomer
    hi I started to learn as3 using fdt i managed to put texts on screen now i want to show the text after the button is clicked but the button does not appear here is the code ` package { import flash.events.MouseEvent; import flash.media.Camera; import mx.controls.Button; import flash.display.Sprite; import flash.text.TextField; public class test2 extends Sprite { private var tField:TextField; public function click(e:MouseEvent):void { tField = new TextField(); tField.text="ffff"; addChild(tField); } public function test2():void { var aa:Button=new Button(); aa.label="deneme"; aa.x=100; aa.y=200; aa.addEventListener(MouseEvent.CLICK, click) } } } ` help me pleaseee

    Read the article

  • PreparedStatement and 'null' value in WHERE clause

    - by bond
    I am using PrepareStatement and BatchUpdate for executimg a UPDATE query. In for loop I create a Batch. At end of loop I execute batch. Above logic works fine if SQL query used in PrepareStatement does not have null values in WHERE claues. Update Statement fails if there is null value in WHERE clasue. My code looks something like this, connection = getConnection(); PreparedStatement ps = connection.prepareStatement("UPDATE TEST_TABLE SET Col1 = true WHERE Col2 = ? AND Col3 = ?") for (Data aa : InComingData) { if(null == aa.getCol2()) { ps.setNull(1, java.sql.Types.INTEGER); } else { ps.setInteger(1,aa.getCol2()) } if(null == aa.getCol3()) { ps.setNull(2, java.sql.Types.INTEGER); } else { ps.setInteger(2,aa.getCol3()) } ps.addBatch(); } ps.executeBatch(); connection.commit(); Any help would be appreciated.

    Read the article

  • How do I extract a postcode from one column in SSIS using regular expression

    - by Aphillippe
    I'm trying to use a custom regex clean transformation (information found here ) to extract a post code from a mixed address column (Address3) and move it to a new column (Post Code) Example of incoming data: Address3: "London W12 9LZ" Incoming data could be any combination of place names with a post code at the start, middle or end (or not at all). Desired outcome: Address3: "London" Post Code: "W12 9LZ" Essentially, in plain english, "move (not copy) any post code found from address3 into Post Code". My regex skills aren't brilliant but I've managed to get as far as extracting the post code and getting it into its own column using the following regex, matching from Address3 and replacing into Post Code: Match Expression: (?<stringOUT>([A-PR-UWYZa-pr-uwyz]([0-9]{1,2}|([A-HK-Ya-hk-y][0-9]|[A-HK-Ya-hk-y][0-9] ([0-9]|[ABEHMNPRV-Yabehmnprv-y]))|[0-9][A-HJKS-UWa-hjks-uw])\ {0,1}[0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}|([Gg][Ii][Rr]\ 0[Aa][Aa])|([Ss][Aa][Nn]\ {0,1}[Tt][Aa]1)|([Bb][Ff][Pp][Oo]\ {0,1}([Cc]\/[Oo]\ )?[0-9]{1,4})|(([Aa][Ss][Cc][Nn]|[Bb][Bb][Nn][Dd]|[BFSbfs][Ii][Qq][Qq]|[Pp][Cc][Rr][Nn]|[Ss][Tt][Hh][Ll]|[Tt][Dd][Cc][Uu]|[Tt][Kk][Cc][Aa])\ {0,1}1[Zz][Zz]))) Replace Expression: ${stringOUT} So this leaves me with: Address3: "London W12 9LZ" Post Code: "W12 9LZ" My next thought is to keep the above match/replace, then add another to match anything that doesn't match the above regex. I think it might be a negative lookahead but I can't seem to make it work. I'm using SSIS 2008 R2 and I think the regex clean transformation uses .net regex implementation. Thanks.

    Read the article

  • is back_insert_iterator<> safe to be passed by value?

    - by afriza
    I have a code that looks something like: struct Data { int value; }; class A { public: typedef std::deque<boost::shared_ptr<Data> > TList; std::back_insert_iterator<TList> GetInserter() { return std::back_inserter(m_List); } private: TList m_List; }; class AA { boost::scoped_ptr<A> m_a; public: AA() : m_a(new A()) {} std::back_insert_iterator<A::TList> GetDataInserter() { return m_a->GetInserter(); } }; class B { template<class OutIt> CopyInterestingDataTo(OutIt outIt) { // loop and check conditions for interesting data // for every `it` in a Container<Data*> // create a copy and store it for( ... it = ..; .. ; ..) if (...) { *outIt = OutIt::container_type::value_type(new Data(**it)); outIt++; // dummy } } void func() { AA aa; CopyInterestingDataTo(aa.GetInserter()); // aa.m_a->m_List is empty! } }; The problem is that A::m_List is always empty even after CopyInterestingDataTo() is called. However, if I debug and step into CopyInterestingDataTo(), the iterator does store the supposedly inserted data!

    Read the article

  • Dynamic Filtering

    - by Ricardo Peres
    Continuing my previous posts on dynamic LINQ, now it's time for dynamic filtering. For now, I'll focus on string matching. There are three standard operators for string matching, which both NHibernate, Entity Framework and LINQ to SQL recognize: Equals Contains StartsWith EndsWith So, if we want to apply filtering by one of these operators on a string property, we can use this code: public enum MatchType { StartsWith = 0, EndsWith = 1, Contains = 2, Equals = 3 } public static List Filter(IEnumerable enumerable, String propertyName, String filter, MatchType matchType) { return (Filter(enumerable, typeof(T), propertyName, filter, matchType) as List); } public static IList Filter(IEnumerable enumerable, Type elementType, String propertyName, String filter, MatchType matchType) { MethodInfo asQueryableMethod = typeof(Queryable).GetMethods(BindingFlags.Static | BindingFlags.Public).Where(m = (m.Name == "AsQueryable") && (m.ContainsGenericParameters == false)).Single(); IQueryable query = (enumerable is IQueryable) ? (enumerable as IQueryable) : asQueryableMethod.Invoke(null, new Object [] { enumerable }) as IQueryable; MethodInfo whereMethod = typeof(Queryable).GetMethods(BindingFlags.Public | BindingFlags.Static).Where(m = m.Name == "Where").ToArray() [ 0 ].MakeGenericMethod(elementType); MethodInfo matchMethod = typeof(String).GetMethod ( (matchType == MatchType.StartsWith) ? "StartsWith" : (matchType == MatchType.EndsWith) ? "EndsWith" : (matchType == MatchType.Contains) ? "Contains" : "Equals", new Type [] { typeof(String) } ); PropertyInfo displayProperty = elementType.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance); MemberExpression member = Expression.MakeMemberAccess(Expression.Parameter(elementType, "n"), displayProperty); MethodCallExpression call = Expression.Call(member, matchMethod, Expression.Constant(filter)); LambdaExpression where = Expression.Lambda(call, member.Expression as ParameterExpression); query = whereMethod.Invoke(null, new Object [] { query, where }) as IQueryable; MethodInfo toListMethod = typeof(Enumerable).GetMethod("ToList", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(elementType); IList list = toListMethod.Invoke(null, new Object [] { query }) as IList; return (list); } var list = new [] { new { A = "aa" }, new { A = "aabb" }, new { A = "ccaa" }, new { A = "ddaadd" } }; var contains = Filter(list, "A", "aa", MatchType.Contains); var endsWith = Filter(list, "A", "aa", MatchType.EndsWith); var startsWith = Filter(list, "A", "aa", MatchType.StartsWith); var equals = Filter(list, "A", "aa", MatchType.Equals); Perhaps I'll write some more posts on this subject in the near future. SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.0.320/scripts/clipboard.swf'; SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp']; SyntaxHighlighter.all();

    Read the article

  • Several IPs for my VPS

    - by Serafim
    I bought vps on santrex.net but can't receive any reply from support. My Problem: I have 5 ip but it pings only 1!!! I can't setup DNS because I need 2 ip minimum . Could you help me to activate other my IPs? root@spnova:~# ifconfig eth0 Link encap:Ethernet HWaddr aa:00:b9:4f:19:01 inet addr:188.72.240.100 Bcast:188.72.240.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:163342 errors:0 dropped:0 overruns:0 frame:0 TX packets:13585 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:32862185 (32.8 MB) TX bytes:15189036 (15.1 MB) eth0:0 Link encap:Ethernet HWaddr aa:00:b9:4f:19:01 inet addr:188.72.240.101 Bcast:188.72.240.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:1 Link encap:Ethernet HWaddr aa:00:b9:4f:19:01 inet addr:188.72.240.102 Bcast:188.72.240.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:2 Link encap:Ethernet HWaddr aa:00:b9:4f:19:01 inet addr:188.72.240.103 Bcast:188.72.240.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:3 Link encap:Ethernet HWaddr aa:00:b9:4f:19:01 inet addr:188.72.240.104 Bcast:188.72.240.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:11885 errors:0 dropped:0 overruns:0 frame:0 TX packets:11885 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:8124693 (8.1 MB) TX bytes:8124693 (8.1 MB) root@spnova:~# nano /etc/network/interfaces # Auto generated eth0 interfaces auto eth0 lo iface eth0 inet static address 188.72.240.100 netmask 255.255.255.0 up route add -net 188.72.225.0 netmask 255.255.255.0 dev eth0 up route add default gw 188.72.225.1 iface lo inet loopback auto eth0:0 iface eth0:0 inet static address 188.72.240.101 netmask 255.255.255.0 auto eth0:1 iface eth0:1 inet static address 188.72.240.102 netmask 255.255.255.0 auto eth0:2 iface eth0:2 inet static address 188.72.240.103 netmask 255.255.255.0 auto eth0:3 iface eth0:3 inet static address 188.72.240.104 netmask 255.255.255.0

    Read the article

  • Incoming traceroute blocked by ufw

    - by Tobias Timpe
    One of my Proxmox VMs running Ubuntu 13.04 won't accept incoming trace routes while ufw is enabled. What command do give ufw to allow incoming traceroute(6)s? The following shows up in the syslog with ufw enabled: 50:15:15:aa:ae:8d:7d:e4:7a:97:08:00 SRC=79.236.233.97 DST=78.46.101.252 LEN=52 TOS=0x00 PREC=0x00 TTL=1 ID=33400 PROTO=UDP SPT=63757 DPT=33466 LEN=32 Nov 4 16:20:36 web kernel: [8078158.260409] [UFW BLOCK] IN=eth0 OUT= MAC=00:50:56:15:15:aa:ae:8d:7d:e4:7a:97:08:00 SRC=79.236.233.97 DST=78.46.101.252 LEN=52 TOS=0x00 PREC=0x00 TTL=1 ID=33401 PROTO=UDP SPT=63757 DPT=33467 LEN=32 Nov 4 16:20:41 web kernel: [8078163.262626] [UFW BLOCK] IN=eth0 OUT= MAC=00:50:56:15:15:aa:ae:8d:7d:e4:7a:97:08:00 SRC=79.236.233.97 DST=78.46.101.252 LEN=52 TOS=0x00 PREC=0x00 TTL=2 ID=33402 PROTO=UDP SPT=63757 DPT=33468 LEN=32 Nov 4 16:20:46 web kernel: [8078168.262927] [UFW BLOCK] IN=eth0 OUT= MAC=00:50:56:15:15:aa:ae:8d:7d:e4:7a:97:08:00 SRC=79.236.233.97 DST=78.46.101.252 LEN=52 TOS=0x00 PREC=0x00 TTL=2 ID=33403 PROTO=UDP SPT=63757 DPT=33469 LEN=32 Nov 4 16:20:51 web kernel: [8078173.260521] [UFW BLOCK] IN=eth0 OUT= MAC=00:50:56:15:15:aa:ae:8d:7d:e4:7a:97:08:00 SRC=79.236.233.97 DST=78.46.101.252 LEN=52 TOS=0x00 PREC=0x00 TTL=2 ID=33404 PROTO=UDP SPT=63757 DPT=33470 LEN=32 And the trace route just ends in starts after the Proxmox host machine. Thanks Tobias Timpe

    Read the article

  • How to refactor a myriad of similar classes

    - by TobiMcNamobi
    I'm faced with similar classes A1, A2, ..., A100. Believe it or not but yeah, there are roughly hundred classes that almost look the same. None of these classes are unit tested (of course ;-) ). Each of theses classes is about 50 lines of code which is not too much by itself. Still this is way too much duplicated code. I consider the following options: Writing tests for A1, ..., A100. Then refactor by creating an abstract base class AA. Pro: I'm (near to totally) safe by the tests that nothing goes wrong. Con: Much effort. Duplication of test code. Writing tests for A1, A2. Abstracting the duplicated test code and using the abstraction to create the rest of the tests. Then create AA as in 1. Pro: Less effort than in 1 but maintaining a similar degree of safety. Con: I find generalized test code weird; it often seems ... incoherent (is this the right word?). Normally I prefer specialized test code for specialized classes. But that requires a good design which is my goal of this whole refactoring. Writing AA first, testing it with mock classes. Then inheriting A1, ..., A100 successively. Pro: Fastest way to eliminate duplicates. Con: Most Ax classes look very much the same. But if not, there is the danger of changing the code by inheriting from AA. Other options ... At first I went for 3. because the Ax classes are really very similar to each other. But now I'm a bit unsure if this is the right way (from a unit testing enthusiast's perspective).

    Read the article

  • wakeonlan from remote host

    - by takeshin
    I have setup wake on lan service on my server. Everything works fine on local area network: root@server$: poweroff user@local$ wakeonlan AA:BB:CC:DD:EE:FF and the server wakes up. AA:BB:CC:DD:EE:FF is a MAC address of my server, which has IP 192.168.1.2 and hostname: example.com. It is connected to the router, which has IP 192.168.1.1 (public: xxx.xxx.xxx.xxx) When the server is up, I can ping: ping example.com or login via ssh: ssh [email protected] So far, so good. Now I'm able to wake the server up from local area, but how to wake the server from the remote location? I tried: user@local$ wakeonlan -i xxx.xxx.xxx.xxx AA:BB:CC:DD:EE:FF, but it does not work (nothing happens;). Do I have to configure my router somehow to forward magic packets? How?

    Read the article

  • ListView with Custom ArrayAdapter not updating

    - by Intelwalk
    I am currently trying to return a custom view of a textview, chrono, and checkbox. I have overriden the getView method but I am not sure if I did it correctly. I would appreciate some comments on the arrayadapter. It currently does not update in my application. Thanks! main java public class TaskTracker extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button addButton; addButton=(Button)findViewById(R.id.button1); ListView myListView= (ListView)findViewById(R.id.listView1); final EditText myEditText= (EditText)findViewById(R.id.editText1) ; //final ArrayList<String> taskitems = new ArrayList<String>(); final TTAdapterView aa = new TTAdapterView(this); // aa = new ArrayAdapter<String>(this, 0); myListView.setAdapter(aa); addButton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ aa.add(myEditText.getText().toString()); //taskitems.add(count, myEditText.getText().toString()); aa.notifyDataSetChanged(); myEditText.setText(""); myEditText.requestFocus(); } }); } } ArrayAdapter public class TTAdapterView extends ArrayAdapter<String> { public View v; public TTAdapterView(Context context){ super(context,R.layout.row); } @Override public View getView(int position, View convertView, ViewGroup parent){ this.v = convertView; if(v==null){ LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.row, null); } return v; }

    Read the article

  • choosing row (from group) with max value in a SQL Server Database

    - by sriehl
    I have a large database and am putting together a report of the data. I have aggregated and summed the data from many tables to get two tables that look like the following. id | code | value id | code | value 13 | AA | 0.5 13 | AC | 2.0 13 | AB | 1.0 14 | AB | 1.5 14 | AA | 2.0 13 | AA | 0.5 15 | AB | 0.5 15 | AB | 3.0 15 | AD | 1.5 15 | AA | 1.0 I need to get a list of id's, with the code (sumed from both tables) with the largest value. 13 | AC 14 | AA 15 | AB There are 4-6 thousand records and it is not possible to change the original tables. I'm not too worried about performance as I only need to run it a few times a year. edit: Let me see if I can explain a bit more clearly, imagine the id is the customer id, the code is who they ordered from and the value is how much they spent there. I need a list of the all the customer id's and the store that customer spent the most money at (and if they spent the same at two different stores, put a value such as 'ZZ' in for the store name).

    Read the article

  • php if clause inside foreach not retrieving data correctly

    - by Mike
    Here's my issue: In my controller, I want to grab user input from a form. I then parse the input, and compare it to database values to ensure I'm grabbing the correct input. I simply want to match the user's answers to the question, grab the user ID, the question ID, and then determine if the answer applies to a multiple choice or checkbox question, or something else. I take those values and insert them into the answer table. Ignore the waiver stuff. I'll test that once I get the answers input correctly. // add answers and waiver consent records try { $answerArray = array(); $waiverArray = array(); // retrieve answers, waiver consents, and the question ID's from form object foreach ($formData as $key => $value) { $parts = explode("_", $key); if ($parts[0] == 'question') { array_push($answerArray, $value); } if ($parts[0] == 'waiverTitle') { array_push($waiverArray, $value); } } $questions = new Model_DbTable_Questions(); $questionResults = $questions->getQuestionResults($session->idEvent); foreach ( $questionResults as $qr ) { if ($qr ['questionType'] == 'multipleChoice' || $qr ['questionType'] == 'checkBox') { foreach ( $answerArray as $aa ) { $answerData = $answers->addAnswer ( $lastUserID, $qr ['idQuestion'], null, $aa ); echo count ( $answerData ) . ', ' . $qr ['questionType'] . ', ' . $aa . '<br />'; } } else { foreach ( $answerArray as $aa ) { $answerData = $answers->addAnswer ( $lastUserID, $qr ['idQuestion'], $aa, null ); echo count ( $answerData ) . ', ' . $qr ['questionType'] . ', ' . $aa . '<br />'; } } } } catch (Zend_Db_Statement_Exception $e) { $e->getMessage(); throw $e; } From my test data, I expect to get 2 records that match the multiple choice and checkbox criteria, and 1 record for text in the ELSE clause like this: 3, checkbox, 1 3, multipleChoice, 1 3, text, question_2 What I get is a 3x3 Cartesian product, 3 question elements each with the 3 possible answers like this output from the echo statements: 4, checkBox, 1 4, checkBox, 1 4, checkBox, question_2 4, multipleChoice, 1 4, multipleChoice, 1 4, multipleChoice, question_2 4, text, 1 4, text, 1 4, text, question_2 I've tried placing the IF clause inside the inner foreach, but I get the same results. I've been staring at this problem for way too long and cannot see what I'm doing wrong. Your kind assistance would be greatly appreciated. Please let me know if my request requires more clarification.

    Read the article

  • Regex Query to get string value

    - by Alex
    Hi all, I am looking for a regex query that would allow me to retrieve a value from a string here are examples of my string: home.aspx?StudyID=0020101&aa=72 randompage.aspx?studyid=3023603&aa=40 myconfig.aspx?studyid=0021600&aa=40 I need to get the numerical value of the 'studyid' variable, please note that the name of the page will change so simply doing the substring and counting char spaces didn't work I unfortunately cannot use request.querystring method as this string is stored in the database and a select statement will be used for running this regex query Thanks

    Read the article

  • Simple Python Challenge: Fastest Bitwise XOR on Data Buffers

    - by user213060
    Challenge: Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python str type since this is traditionally the type for data buffers in python. Return the resultant value as a str. Do this as fast as possible. The inputs are two 1 megabyte (2**20 byte) strings. The challenge is to substantially beat my inefficient algorithm using python or existing third party python modules (relaxed rules: or create your own module.) Marginal increases are useless. from os import urandom from numpy import frombuffer,bitwise_xor,byte def slow_xor(aa,bb): a=frombuffer(aa,dtype=byte) b=frombuffer(bb,dtype=byte) c=bitwise_xor(a,b) r=c.tostring() return r aa=urandom(2**20) bb=urandom(2**20) def test_it(): for x in xrange(1000): slow_xor(aa,bb)

    Read the article

  • Unintentional concatenation in Bison/Yacc grammar.

    - by troutwine
    I am experimenting with lex and yacc and have run into a strange issue, but I think it would be best to show you my code before detailing the issue. This is my lexer: %{ #include <stdlib.h> #include <string.h> #include "y.tab.h" void yyerror(char *); %} %% [a-zA-Z]+ { yylval.strV = yytext; return ID; } [0-9]+ { yylval.intV = atoi(yytext); return INTEGER; } [\n] { return *yytext; } [ \t] ; . yyerror("invalid character"); %% int yywrap(void) { return 1; } This is my parser: %{ #include <stdio.h> int yydebug=1; void prompt(); void yyerror(char *); int yylex(void); %} %union { int intV; char *strV; } %token INTEGER ID %% program: program statement EOF { prompt(); } | program EOF { prompt(); } | { prompt(); } ; args: /* empty */ | args ID { printf(":%s ", $<strV>2); } ; statement: ID args { printf("%s", $<strV>1); } | INTEGER { printf("%d", $<intV>1); } ; EOF: '\n' %% void yyerror(char *s) { fprintf(stderr, "%s\n", s); } void prompt() { printf("> "); } int main(void) { yyparse(); return 0; } A very simple language, consisting of no more than strings and integer and a basic REPL. Now, you'll note in the parser that args are output with a leading colon, the intention being that, when combined with the first pattern of the rule of the statement the interaction with the REPL would look something like this: > aaa aa a :aa :a aaa> However, the interaction is this: > aaa aa a :aa :a aaa aa aa > Why does the token ID in the following rule statement: ID args { printf("%s", $<strV>1); } | INTEGER { printf("%d", $<intV>1); } ; have the semantic value of the total input string, newline included? How can my grammar be reworked so that the interaction I intended?

    Read the article

  • create program in c for permutation combination and showing frequency

    - by Vishal Oswal
    I have 2 strings where I have saved fixed 20 characters and these are “A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T” and same 20 char in string 2. so I will get 400 combinations of 2 character sets like AA,AB,AC,AD,AE,AF,……………AT BA,BB,BC,BD,BE,BF,…………..BT CA,CB,CC,CD,CE,CF……………CT This way we will get 400 combinations (Which program I have created successfully) but then user will put the value till 31 characters witch will be treated as 3rd string for E.g. “ABCDDAAAB” now I have to check the frequency of user input in the sequence of 12,23,34,45,56,67,78,89 (2 CHAR SET) means AB,BC,CD,DD,DA,AA,AA,AB and need to show the frequency of user input OUTPUT: AB=2 BC=1 CD=1 DD=1 DA=1 AA=2 please its urgent

    Read the article

  • use split() for splitting a string

    - by Hamed
    Hi again... Guys I'd asked 2 questions before and I'd said that I want to split a string like below: Input string: a=aa|b=b||b|c=cc and the output: a=aa b=b||b c=cc some guys answer my question but they use .Match(): var matches = "a=aa|b=b||b|c=cc".match(/(?:[^|]|\|\|)+/g) but I need to use the .split() method and store the outputs in an array. please help me guys... It's so critical... Thanks...

    Read the article

  • split html text in 2 paragraphs

    - by Luca Romagnoli
    hi i have a html text like this: aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa aa</a> adsfsadfsadfs i want to split it in 2 paragraphs. but i don't want to generate this situation: <p>aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa</p><p> aa</a> adsfsadfsadfs</p> how can i check if the split involves any tags and avoid it? thanks

    Read the article

  • c# error for index was outside the bounds of array

    - by iliailiaey
    i have written below code but i have the error:Index was outside the bounds of the array.i cant understand its reason.how can i correct the code for preventing the error?(in the code,i want to make an array byte of size 57600 from an array byte of size 38400) int q = 0; int nbytes = 57600; byte[] gh = new byte[38400]; byte[] byte8 = new byte[nbytes]; byte[] aa = { 0xf8, 0x07, 0XE0, 0X1F }; for (int y = 0; y < nbytes-3; y += 3) { if (q < 38400-3) { byte8[y] = (byte)(gh[q] & aa[1]); byte8[y + 1] = (byte)(((gh[q] & aa[1]) << 5) | ((gh[q + 1] & aa[2]) >> 3)); byte8[y + 2] = (byte)((gh[q + 1] & aa[3]) << 3); q += 2; } }

    Read the article

  • How to iterate javascript object properties in the order they were written.

    - by Jenea
    Hi. I identified a bug in my code which I hope to solve with minimal refactoring effort. This bug occurs in Chrome and Opera browsers. Problem: var obj = {23:"AA",12:"BB"}; //iterating through obj's properties for(i in obj) document.write("Key: "+i +" "+"Value: "+obj[i]); Output in FF,IE Key: 23 Value: AA Key: 12 Value: BB Output in Opera and Chrome (Wrong) Key: 12 Value BB Key: 23 Value AA I attempted to make an inverse ordered object like this var obj1={"AA":23,"BB":12}; for(i in obj1) document.write("Key: "+obj[i] +" "+"Value: "+i); However the output is the same. Is there a way to get for all browser the same behaviour with small changes?

    Read the article

  • how to use @ in python.. and the @property and the @classmethods

    - by zjm1126
    this is my code: def a(): print 'sss' @a() def b(): print 'aaa' b() and the Traceback is: sss Traceback (most recent call last): File "D:\zjm_code\a.py", line 8, in <module> @a() TypeError: 'NoneType' object is not callable so how to use the '@' thanks updated class a: @property def b(x): print 'sss' aa=a() print aa.b it print : sss None how to use @property thanks updated2 and the classmethods: class a: @classmethods def b(x): print 'sss' aa=a() print aa.b the Traceback is : Traceback (most recent call last): File "D:\zjm_code\a.py", line 5, in <module> class a: File "D:\zjm_code\a.py", line 6, in a @classmethods NameError: name 'classmethods' is not defined

    Read the article

  • PostgeSQL: Arrays Data Type with PHP

    - by ArchJ
    I'm working on PostgeSQL with PHP and I know that PosrgeSQL allow columns of a table to be defined as arrays. So let's say I have a table like this: CREATE TABLE sal_emp ( a text ARRAY, b text ARRAY, c text ARRAY, ); These are my arrays: $a = array(aa,bb,cc); $b = array(dd,dd,aa); $c = array(bb,ff,ee); and I want to insert them into respective column each like this: a | b | c -----------+------------+------------ {aa,bb,cc} | {dd,dd,aa} | {bb,ff,ee} Can I insert it this way? $a = implode(',', $a); $b = implode(',', $b); $c = implode(',', $c); $a = array('a' => $a, 'b' => $b, 'c' => $c); pg_insert($dbconn, 'table', $a); Or is there a better way to achieve the same result?

    Read the article

  • Incorrect string encodings

    - by James
    Note: I have read all of the related PHP, UTF-8, character encoding articles that are usually suggested, but my question relates to data inserted before I applied such techniques. I am wishing to retrospectively fix all character encoding problems. Now all connections are set as utf8 using PDO. PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' Unfortunately, a large amount of data was inserted that is of questionable encoding before I had implemented correct character encoding practices. As displayed by: $sql = "SELECT name FROM data LIMIT 3"; foreach ($pdo->query($sql) as $row) { $name = $row['name']; echo $name . "\n"; echo utf8_encode($name) . "\n"; echo utf8_decode($name) . "\n"; echo htmlspecialchars($name, ENT_QUOTES, 'UTF-8') . "\n"; echo htmlspecialchars(utf8_encode($name), ENT_QUOTES, 'UTF-8') . "\n"; echo htmlspecialchars(utf8_decode($name), ENT_QUOTES, 'UTF-8') . "\n"; echo '<hr/>'; } Which produces: Antonín Dvořák AntonÃÆín DvoÃâ¦Ãâ¢ÃÆák Anton??­n Dvo??????¡k Antonín Dvořák AntonÃÆín DvoÃâ¦Ãâ¢ÃÆák ---------- Ô±Ö€Õ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿Ö€ÕµÕ¡Õ¶ ñÃâ¬Ã¡Ã´ ýáùáÿÃâ¬ÃµÃ¡Ã¶ ????? ?????????? Ô±Ö€Õ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿Ö€ÕµÕ¡Õ¶ ñÃâ¬Ã¡Ã´ ýáùáÿÃâ¬ÃµÃ¡Ã¶ ---------- Tiësto Tiësto Tiësto Tiësto Tiësto Tiësto ---------- When removing 'SET NAMES utf8' with PDO it produces the data: Antonín DvoÅák Antonín DvoÃÂák Antonín Dvorák Antonín DvoÅák Antonín DvoÃÂák Antonín Dvorák ---------- ???? ????????? Ô±ÖÕ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿ÖÕµÕ¡Õ¶ ???? ????????? ???? ????????? Ô±ÖÕ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿ÖÕµÕ¡Õ¶ ???? ????????? ---------- Tiësto Tiësto Ti?sto Tiësto Tiësto ---------- And here is a dump of the database rows concerned: DROP TABLE IF EXISTS `data`; CREATE TABLE IF NOT EXISTS `data` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL, PRIMARY KEY (`id`), KEY `name` (`name`(10)), ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0; INSERT INTO `data` (`id`, `name`) VALUES (0, 'Antonín Dvořák'), (1, 'Ô±Ö€Õ¡Õ´ Ô½Õ¡Õ¹Õ¡Õ¿Ö€ÕµÕ¡Õ¶'), (2, 'Tiësto'); The 3rd and 6th lines of the 3rd row "Tiësto" are then correctly echoed. I'm just unsure what is the best way to correct encodings/detect the encodings of bad strings and correct, etc.

    Read the article

  • displaying mac address in right format

    - by califguy
    Hi, I am obtaining the mac(hw) address of an interface using CWNetwork. Now OS X gives me this mac address in the xx:xx:xx:xx:xx:xx format. But if the first digit is 0, OS X will output the address as 4:aa:dd:ee:34:40, instead of 04:aa:dd:ee:34:40. Now I am trying to take this string 4:aa:dd:ee:34:40 and convert it to 04:aa:dd:ee:34:40 before displaying it. Any ideas ? APpreciate the help.

    Read the article

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