Posts

list - Python series writing issue -

i have code writing series in text file bin = int("377731") open('{0}/{0}.txt'.format(bin)) fine: cc in fine , in range(1000): name = cc[6:11] tg = open('{0}/{1}.txt'.format(bin,name), 'a') tg.write('{0}{1:03}'.format(cc,i)) tg.close() i wanted code write output this 37773100000000 37773100000001 ... but when excute code output shows this 37773100000 000 37773100000 001 ... why code writing ? error? when iterate on fine ( for cc in fine ) line with line break, hence linebreak between cc , i . if display it, see: >>> cc '37773100000\n' you can trim line using: cc = cc.strip()

asp.net mvc 4 - C# Complex Property Setter option -

i have asp.net mvc 5 (c#) application , i'm giving users ability posts , comments. for have model called likes following properties: public class { public like() { this.createdutc = system.datetime.utcnow; this.isactive = true; } public long id { get; set; } public string userid { get; set; } public bool isactive { get; set; } public liketype type { get; set; } public datetime createdutc { get; set; } } type enum , can either comments or posts . i've added following navigation property both post model , comment model: public virtual icollection<like> likes { get; set; } my question is, can have setter function in above line of code automatically set comments , posts type? know can use value variable in setter using google couldn't find how use complex types have above ( like ). i'm sure better way of doing in repository manually set enum every-time i'm going save like. update: seeing h...

how to do jquery function if wordpress metabox checkbox is checked Sync in add new post area -

in wordpress backend -> add new post area, how after metabox -> checkbox checked, example when checked category: this the checkbox before checked: <input value="1" type="checkbox" name="post_category[]" id="in-category-1"> this the checkbox after checked: <input value="1" type="checkbox" name="post_category[]" id="in-category-1"> ::before </input> so, how detect checkbox checked , function after checked? you can achieve using jquery. !(function($){ $(document).ready(function(){ $('#categorychecklist').on('change', 'input[type=checkbox]', function(){ if ($(this).is(':checked')) alert('category' + $(this).closest('label').text() + ' added.'); else alert('category' + $(this).closest('label').text() + ' removed.'); }); }); })(window.jque...

arc4random - how can i make my random text generator not repeat until all texts have been displayed? -

.h @interface viewcontroller : uiviewcontroller { iboutlet uilabel *textview; } -(ibaction)random; .m -(ibaction)random{ int text = arc4random() % 24; switch (text) { case 0: textview.text = @"example 1"; break; case 1: textview.text = @"example 2"; break; case 2: textview.text = @"example 3"; break; case 3: textview.text = @"example 4"; break; case 4: textview.text = @"example 5"; break; case 5: textview.text = @"example 6"; break; case 6: textview.text = @"example 7"; break; etc... want not repeat example 1, 3,6,2,5,4,7 or , start on without repeating same thing twice unless texts have been displayed in advance

php - Notice: Undefined index: intakeid -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers i trying since last hour update database using php unable update. i error notice: undefined index: intakeid in c:\wamp\www\multi_edit\edit_save.php on line 3. <?php include('dbcon.php'); $intakeid=$_post['intakeid']; $firstname=$_post['firstname']; $lastname=$_post['lastname']; $password=$_post['password']; $confirmpassword=$_post['confirmpassword']; $homeaddress=$_post['homeaddress']; $email=$_post['email']; $n = count($intakeid); for($i=0; $i < $n; $i++) { $result = mysql_query("update registration set firstname='$firstname[$i]', lastname='$lastname[$i]', ...

How can I overwrite the Newer version of DLL with Older version of DLL -

in our application using dll files. sometime need overwrite newer version of dll older version. we referencing dll followig path:c:\windows\downloaded program files so there way overwrite newer version of dll older version @ same location: c:\windows\downloaded program files

jquery - Converting isotime to shorttime in javascript -

i have ajax call returns time e.g 16:06:59 want convert 4:06 pm var mydate = obj[0].time; mydate comes 16:06:59 when try use var date = new date() , gives me todays date . is there solution realize want ? thanks try : function convert24hoursto12(time) { var timearray = time.split(':'); var hours = timearray[0]; var minutes = timearray[1]; var ampm = hours >= 12 ? 'pm' : 'am'; hours = hours % 12; hours = hours ? hours : 12; // hour '0' should '12' var strtime = hours + ':' + minutes + ' ' + ampm; return strtime; } and call it: convert24hoursto12(obj[0].time); see demo here.