Posts

normalization - MySQL Table Design - User Logon Times -

i need provide following data regarding member logins example: last hour 654 last day 15,648 last week 109,536 last month 460,051 last year 5,520,614 i wondering best possible structure of table hold information in mysql db. currently i'm thinking of storing: user datetime i expect large on time , become slow query. is there better way structure table information on logins - hourly, day, week, month, year etc? $current_time = strtotime(date('d-m-y g:i:s a')); $last_hour = $current_time - 3600; $last_day = $current_time - (3600*24); $last_week = strtotime("-1 week"); $last_month = strtotime("-1 month"); $last_year = strtotime("-1 year"); // count // count last hour $sql = "select count(user_id) cnt `your_table` datetime>='$last_hour' "; // count last day $sql = "select count(user_id) cnt `your_table` datetime>='$last_day' "; // count last week $sql = "select count(user_...

java - Android Calendar Intent event end always one hour after start, API level 8+ -

i understand same title used before, specific question (and answer) used contentvalues class, api level 14+; program uses minimum of api level 8. use intent putextra add values calendar: calendar begintime = calendar.getinstance(); begintime.set(year, month, day, fromhour, frommin, 0); calendar endtime = calendar.getinstance(); endtime.set(year, month, day, tohour, tomin, 0); long startmillis = begintime.gettimeinmillis(); long endmillis = endtime.gettimeinmillis(); intent intent = new intent(intent.action_edit); intent.settype("vnd.android.cursor.item/event"); intent.putextra("begintime", startmillis); intent.putextra("allday", false); intent.putextra("endtime", endmillis); intent.putextra("title", strselected); intent.putextra("description", strselected+" ...

ios - Titanium Appcelerator Alloy not supporting formFactor styles for widgets -

i have developed sample code in created widget having view adds image view inside it. works perfect when apply styles tss of controller directly when "formfactor" used it's not working. clarify same please check code placed here. you can create new alloy project , test same following code: note: dependencies included in config.json widget implementation: widget.xml <alloy> <view id="section" class="section"></view> </alloy> widget.tss ".section":{ backgroundcolor: 'red', layout : 'vertical' }, widget.js var args = arguments[0] || {}; $.section.applyproperties(args); $.setdata = function(view) { $.section.add(view); } coding index page index.xml <alloy> <scrollview class="baseview"> <widget id="contentview" class="contentview" src="com.investis.scrollablesection"></widget> </scrollview> ...

javascript - Use iframe for mvvm design pattern -

is idea use iframe mvvm pattern? using knockout js similate mvvm design pattern in c#. thinking of making independent components own html files (view) corresponding .js file (model) them, , render them using iframe whenever pages needs them. way can create many reusable components. can 1 please explain in details pros , cons of doing so? thanks using frames in web development, important parts of page, bad idea. should used embedding 3rd party plugins (like shoutbox). other stuff should use partial postbacks ajax instead (if need kind of behavior). can create reusable parts/controls both mvc , webforms frameworks, shouldn't have problems. if need know why frames bad idea, google it, there has been way many talks already.

php - How can I get array like this -

//i have array below: $a =array('1,2,6'); $b =array('2,3,1'); //then using arraycombine : $arr_combine = array_combine( $a, $b ); //output: //array( [1,2,6] => 2,3,1 ) ; how can array below? //output: array( 1=>2, 2=>3, 6=>1 ); if have array that, have explode element. $result = array_combine(explode(',', $a[0]), explode(',', $b[0]));

c# - How do I swap two characters in a string variable? -

i have string variable. want swap 2 characters in string word. want randomly swap 2 characters close each other. this have done: have done in words error. string word = txtword.text; random rand = new random(); int randomnumber= rand.next(0, word.length); string swappedword = swapcharacters(lastword, randomnumber, randomnumber + 1); private string swapcharacters(string value, int position1, int position2) { char[] array = value.tochararray(); // convert string char array char temp = array[position1]; // temporary copy of character array[position1] = array[position2]; // assign element array[position2] = temp; // assign element return new string(array); // return string } just change line below: int randomnumber= rand.next(0, word.length -1 ); let's see if works.

java - Array deep copy and shallow copy -

i'm learning deep copy , shallow copy. if have 2 arrays: int[]arr1={1,2,3,4,5}; int[]arr2={1,2,3,4,5}; question : both arrays point same references [1][2][3][4][5] . what happen if change arr1[2] ?does changes arr2[2] ? when pass array (random array, not arr1 or arr2 ) main method compiler makes shallow copy of array method, right? if java compiler re-written make , send deep copy of array data method. happens original array in main? think original array may change according method , pass main. not sure. question: both arrays point same references [1][2][3][4][5]. not exactly. arrays have identical content. being said, per initialization, data using not shared . initializing however: int[]arr1={1,2,3,4,5}; int[] arr2 = arr1 what happen if change arr1[2]?does changes arr2[2]? as per answer above question, no not. however, if change initialization mechanism per 1 pointed out, would. when pass array (random array, not arr1 or arr2) m...