Daily Archives

Articles indexed Tuesday April 27 2010

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

  • HTML to Text Conversion

    - by JSS
    Internet Explorer has an option to save a web page as a text file, with all the tags removed. I need a way to batch process that stuff for a project at work. Or there any command line utilities or libraries that can do the same thing for me? COM-interop with IE(not my first choice!)? It doesn't have to format exactly like IE, just give me plain text.

    Read the article

  • Trouble with Powershell and running a complex commandline

    - by Frank Rosario
    Hi, I've been trying to run the following command line from a Powershell build script we have; but keep running into issues & 'C:\Dev\Yadda\trunk\BuildScripts\U tilities\csmanage.exe' /create-deployme nt /name:yadddayaddyaddadev /label:yadddayaddyaddadev /package:https://yadddayaddyadda.blob.core.windows.net/mydeployments/20100426_202848_FamilyMoments.cspk g /config:C:\Dev\WalmartOne\trunk\yadddayaddyadda.CloudService\bin\Debug\ServiceCon figuration.cscfg /slot:Staging /hosted-service:yadddayaddyadda-dev" Note: the space in "Utilities" is intentional; trying to snif out a bug involving spaces in the executable path. I assure you, the path does exist with the space in it on my machine. What's the best way to call this command line from Powershell? I've tried Invoke-Expression, Diagnostic.Process::Start, &; each method coming up with some different type of error; usually that it could find the executable. Any constructive input is greatly appreciated. Thanks.

    Read the article

  • jquery small refactoring , json call

    - by Alexander Corotchi
    Hi everybody, I need you suggestion to make some refactoring in jquery code because now it looks terrible for me. I have 4 json calls but the difference it is just the URL call. EX: var userId = MyuserID; var perPage = '45'; var showOnPage = '45'; var tag = 'tag1'; var tag1 = 'tag2'; var tag2 = 'tagn'; $.getJSON('http://api.flickr.com/services/rest/?format=json&method='+ 'flickr.photos.search&api_key=' + apiKey + '&user_id=' + userId + '&tags=' + tag + '&per_page=' + perPage + '&jsoncallback=?', function(data){ var classShown = 'class="lightbox"'; var classHidden = 'class="lightbox hidden"'; $.each(data.photos.photo, function(i, rPhoto){ var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/' + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret; var thumbPhotoURL = basePhotoURL + '_s.jpg'; var mediumPhotoURL = basePhotoURL + '.jpg'; var photoStringStart = '<li><a '; var photoStringEnd = 'title="' + rPhoto.title + '" href="'+ mediumPhotoURL +'"><img src="' + thumbPhotoURL + '" alt="' + rPhoto.title + '"/></a><span>'+rPhoto.title+'</span></li>;' var photoString = (i < showOnPage) ? photoStringStart + classShown + photoStringEnd : photoStringStart + classHidden + photoStringEnd; $(photoString).appendTo("#flickr ul"); }); $("#flickr a").fancybox(); }); $.getJSON('http://api.flickr.com/services/rest/?format=json&method='+ 'flickr.photos.search&api_key=' + apiKey + '&user_id=' + userId + '&tags=' + tag1 + '&per_page=' + perPage + '&jsoncallback=?', function(data){ var classShown = 'class="lightbox"'; var classHidden = 'class="lightbox hidden"'; $.each(data.photos.photo, function(i, rPhoto){ var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/' + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret; var thumbPhotoURL = basePhotoURL + '_s.jpg'; var mediumPhotoURL = basePhotoURL + '.jpg'; var photoStringStart = '<li><a '; var photoStringEnd = 'title="' + rPhoto.title + '" href="'+ mediumPhotoURL +'"><img src="' + thumbPhotoURL + '" alt="' + rPhoto.title + '"/></a><span>'+rPhoto.title+'</span></li>;' var photoString = (i < showOnPage) ? photoStringStart + classShown + photoStringEnd : photoStringStart + classHidden + photoStringEnd; $(photoString).appendTo(".SetPinos1 ul"); }); $(".Sets a").fancybox(); }); $.getJSON('http://api.flickr.com/services/rest/?format=json&method='+ 'flickr.photos.search&api_key=' + apiKey + '&user_id=' + userId + '&tags=' + tagn + '&per_page=' + perPage + '&jsoncallback=?', function(data){ var classShown = 'class="lightbox"'; var classHidden = 'class="lightbox hidden"'; $.each(data.photos.photo, function(i, rPhoto){ var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/' + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret; var thumbPhotoURL = basePhotoURL + '_s.jpg'; var mediumPhotoURL = basePhotoURL + '.jpg'; var photoStringStart = '<li><a '; var photoStringEnd = 'title="' + rPhoto.title + '" href="'+ mediumPhotoURL +'"><img src="' + thumbPhotoURL + '" alt="' + rPhoto.title + '"/></a><span>'+rPhoto.title+'</span></li>;' var photoString = (i < showOnPage) ? photoStringStart + classShown + photoStringEnd : photoStringStart + classHidden + photoStringEnd; $(photoString).appendTo(".SetPinos ul"); }); $(".Sets a").fancybox(); }); var tag is only one difference in this url : Can somebody help me not to repeat all this stuff ?? Sorry by so long garbage :(

    Read the article

  • Vertical Scroll not working, are the guides but the screen does not scroll.

    - by Leandro
    package com.lcardenas.infoberry; import net.rim.device.api.system.DeviceInfo; import net.rim.device.api.system.GPRSInfo; import net.rim.device.api.system.Memory; import net.rim.device.api.ui.MenuItem; import net.rim.device.api.ui.component.Dialog; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.component.Menu; import net.rim.device.api.ui.component.SeparatorField; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.container.VerticalFieldManager; import net.rim.device.api.ui.decor.Background; import net.rim.device.api.ui.decor.BackgroundFactory; public class vtnprincipal extends MainScreen { //llamamos a la clase principal private InfoBerry padre; //variables para el menu private MenuItem mnubateria; private MenuItem mnuestado; private MenuItem mnuacerca; public vtnprincipal(InfoBerry padre) { super(); this.padre = padre; } public void incventana(){ VerticalFieldManager _ventana = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL | VerticalFieldManager.VERTICAL_SCROLLBAR); double tmemoria =((DeviceInfo.getTotalFlashSize()/1024)/1024.00); double fmemoria = ((Memory.getFlashFree()/1024)/1024.00); Background cyan = BackgroundFactory.createSolidBackground(0x00E0FFFF); Background gris = BackgroundFactory.createSolidBackground(0x00DCDCDC ); //Borramos todos de la pantalla this.deleteAll(); //llamamos al menu incMenu(); //DIBUJAMOS LA VENTANA try{ LabelField title = new LabelField("Info Berry", LabelField.FIELD_HCENTER | LabelField.USE_ALL_HEIGHT ); setTitle(title); _ventana.add(new LabelField("Información del Dispositivo", LabelField.FIELD_HCENTER |LabelField.RIGHT | LabelField.USE_ALL_HEIGHT | LabelField.NON_FOCUSABLE )); _ventana.add(new SeparatorField()); _ventana.add(new SeparatorField()); txthorizontal modelo = new txthorizontal("Modelo:", DeviceInfo.getDeviceName()); modelo.setBackground(gris); _ventana.add(modelo); txthorizontal pin = new txthorizontal("PIN:" , Integer.toHexString(DeviceInfo.getDeviceId()).toUpperCase()); pin.setBackground(cyan); _ventana.add(pin); txthorizontal imeid = new txthorizontal("IMEID:" , GPRSInfo.imeiToString(GPRSInfo.getIMEI())); imeid.setBackground(gris); _ventana.add(imeid); txthorizontal version= new txthorizontal("SO Versión:" , DeviceInfo.getSoftwareVersion()); version.setBackground(cyan); _ventana.add(version); txthorizontal plataforma= new txthorizontal("SO Plataforma:" , DeviceInfo.getPlatformVersion()); plataforma.setBackground(gris); _ventana.add(plataforma); txthorizontal numero= new txthorizontal("Numero Telefonico: " , "Hay que firmar"); numero.setBackground(cyan); _ventana.add(numero); _ventana.add(new SeparatorField()); _ventana.add(new SeparatorField()); _ventana.add(new LabelField("Memoria", LabelField.FIELD_HCENTER | LabelField.USE_ALL_HEIGHT | LabelField.NON_FOCUSABLE)); _ventana.add(new SeparatorField()); txthorizontal totalm= new txthorizontal("Memoria app Total:" , mmemoria(tmemoria) + " Mb"); totalm.setBackground(gris); _ventana.add(totalm); txthorizontal disponiblem= new txthorizontal("Memoria app Disponible:" , mmemoria(fmemoria) + " Mb"); disponiblem.setBackground(cyan); _ventana.add(disponiblem); ///txthorizontal estadoram = new txthorizontal("Memoria RAM:" , mmemoria(prueba) + " Mb"); //estadoram.setBackground(gris); //add(estadoram); _ventana.add(new SeparatorField()); _ventana.add(new SeparatorField()); this.add(_ventana); }catch(Exception e){ Dialog.alert("Excepción en clase vtnprincipal: " + e.toString()); } } //DIBUJAMOS EL MENU private void incMenu() { MenuItem.separator(30); mnubateria = new MenuItem("Bateria",40, 10) { public void run() { bateria(); } }; mnuestado = new MenuItem("Estado de Red", 50, 10) { public void run() { estado(); } }; mnuacerca = new MenuItem("Acerca de..", 60, 10) { public void run() { acerca(); } }; MenuItem.separator(70); }; // public void makeMenu(Menu menu, int instance) { if (!menu.isDisplayed()) { menu.deleteAll(); menu.add(MenuItem.separator(30)); menu.add(mnubateria); menu.add(mnuestado); menu.add(mnuacerca); menu.add(MenuItem.separator(60)); } } public void bateria(){ padre.vtnbateria.incventana(); padre.pushScreen(padre.vtnbateria); } public void estado(){ padre.vtnestado.incventana(); padre.pushScreen(padre.vtnestado); } public void acerca(){ padre.vtnacerca.incventana(); padre.pushScreen(padre.vtnacerca); } public boolean onClose(){ Dialog.alert("Hasta Luego"); System.exit(0); return true; } public double mmemoria(double x) { if ( x > 0 ) return Math.floor(x * 100) / 100; else return Math.ceil(x * 100) / 100; } }

    Read the article

  • Invoke gdb to automatically pass arguments to the program being debugged

    - by aistone
    Hi, I'd like to write a script that (under certain conditions) will execute gdb and automatically run some program X with some set of arguments Y. Once the program has finished executing the user should remain at gdb's prompt until s/he explicitly exits it. One way to do this would be to have the script output the run command plus arguments Y to some file F and then have the script invoke gdb like this: gdb X < F But is there a way to do this without introducing a temporary file? Thanks.

    Read the article

  • converting mysql database to sql server

    - by every_answer_gets_a_point
    i have a mysql database: /* MySQL Data Transfer Source Host: 10.0.0.5 Source Database: jnetdata Target Host: 10.0.0.5 Target Database: jnetdata Date: 5/26/2009 12:27:33 PM */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for chavrusas -- ---------------------------- CREATE TABLE `chavrusas` ( `id` int(11) NOT NULL auto_increment, `date_created` datetime default NULL, `luser_id` int(11) default NULL, `ruser_id` int(11) default NULL, `luser_type` varchar(50) default NULL, `ruser_type` varchar(50) default NULL, `SessionDay` varchar(250) default NULL, `SessionTime` datetime default NULL, `WeeklyReminder` tinyint(1) NOT NULL default '0', `reminder_phone` tinyint(1) NOT NULL default '0', `calling_card` varchar(50) default NULL, `active` tinyint(1) NOT NULL default '0', `notes` mediumtext, `ended` tinyint(1) NOT NULL default '0', `end_date` datetime default NULL, `initiated_by_student` tinyint(1) NOT NULL default '0', `initiated_by_volunteer` tinyint(1) NOT NULL default '0', `student_general_reason` varchar(50) default NULL, `volunteer_general_reason` varchar(50) default NULL, `student_reason` varchar(250) default NULL, `volunteer_reason` varchar(250) default NULL, `student_nli` tinyint(1) NOT NULL default '0', `volunteer_nli` tinyint(1) NOT NULL default '0', `jnet_initiated` tinyint(1) default '0', `belongs_to` varchar(50) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=5913 DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for tbluseravailability -- ---------------------------- CREATE TABLE `tbluseravailability` ( `availability_id` int(11) NOT NULL auto_increment, `user_id` int(11) NOT NULL, `weekday_id` int(11) NOT NULL, `timeslot_id` int(11) NOT NULL, PRIMARY KEY (`availability_id`) ) ENGINE=MyISAM AUTO_INCREMENT=10865 DEFAULT CHARSET=latin1; -- ---------------------------- -- Table structure for tblusers -- ---------------------------- CREATE TABLE `tblusers` ( `id` int(11) NOT NULL auto_increment, `password` varchar(50) default NULL, `title` varchar(255) default NULL, `first` varchar(255) default NULL, `last` varchar(255) default NULL, `gender` varchar(255) default NULL, `address` varchar(255) default NULL, `address_2` varchar(255) default NULL, `city` varchar(255) default NULL, `state` varchar(255) default NULL, `postcode` varchar(255) default NULL, `country` varchar(255) default NULL, `email` varchar(255) default NULL, `emailnotes` varchar(255) default NULL, `Home_Phone` varchar(255) default NULL, `Office_Phone` varchar(255) default NULL, `Cell_Phone` varchar(255) default NULL, `Contact_Preference` varchar(255) default NULL, `Birthdate` datetime default NULL, `Age` varchar(255 and it goes on for about 10mb i need to convert it to ms sql, how do i do it?

    Read the article

  • jQuery UI Tabs Not Working

    - by Christopher
    I just downloaded jQuery UI Tabs. In the included index.html file, it works fine, CSS and all, with no customization. I copied the files over to my web server, keeping the directory structure intact, and copied the content code to my already-existing index.html, but it does not work. My Header Code <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <link type="text/css" href="css/start/jquery-ui-1.8.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-ui-1.8.custom.min.js"></script> <script type="text/javascript"> $(function(){ // Tabs $('#tabs').tabs(); }); </script> My Body Code <div id="tabs"> <ul> <li><a href="#tabs-1">First</a></li> <li><a href="#tabs-2">Second</a></li> <li><a href="#tabs-3">Third</a></li> </ul> <div id="tabs-1">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div> <div id="tabs-2">Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.</div> <div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div> </div> My Output * First * Second * Third Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum. Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue. All of the files are referenced correctly, and it is all copied and pasted directly from a fully functional file., but it will not work.

    Read the article

  • finishing some functions in this code

    - by osabri
    i have problem to finish some functions in this code program lab4; var inFile : text; var pArray : array[1..10]of real; //array of 10 integer values containing patterns to search in a given set of numbers var rArray : array[1..10]of integer; //array containing result of pattern search, each index in rArray coresponds to number of occurences of //pattern from pArray in sArray. var sArray : array[1..100] of real; //array containing data read from file var accuracy : real; (****************************************************************************) function errMsg:integer; begin if ParamCount < 3 then begin writeln('Too few arguments'); writeln('Usage: ./lab4 lab4.txt <accuracy> <pattern_1> <pattern_2> <pattern_n>'); errMsg:=-1; end else if ParamCount > 12 then begin writeln('Too many arguments'); writeln('Maximum number of patterns is 10'); errMsg:=-1; end else begin assign(inFile,ParamStr(1)); {$I-} reset(inFile); if ioresult<>0 then begin writeln('Cannot open ',ParamStr(1)); errMsg:=-1; end else errMsg:=0; end; end; (****************************************************************************) procedure readPattern; var errPos,idx:integer; begin if errMsg=0 then begin for idx:=1 to ParamCount-2 do begin Val(ParamStr(idx+2),pArray[idx],errPos); writeln('pArray:',pArray[idx]:2:2); end; end; end; (****************************************************************************) procedure getAccuracy; //Function should get the accuracy as the first param (after the program name) begin (here where i stopped : (( ) end; (****************************************************************************) function readSet:integer; //Function returns number of elements read from file var idx,errPos:integer; var sChar: string; begin if errMsg=0 then begin idx:=1; repeat begin readln(inFile,sChar); VAL(sChar,sArray[idx],errPos); writeln('sArray:',sArray[idx]:2:2); idx:=idx+1; end until eof(inFile)=TRUE; end; readSet:=idx-1; end; (****************************************************************************) procedure searchPattern(sNumber:integer); //Function should search and count pattern(patterns) occurence in a given set what the best solution for this part?? (****************************************************************************) procedure dispResult; //Function should display the result of pattern(patterns) search begin (****************************************************************************) begin readPattern; getAccuracy; searchPattern(readSet); dispResult; end.

    Read the article

  • popen fails with "sh: <command>: not found"

    - by smallmeans
    I'm developing a server application and I recently encountered this wierd error on a testing server (Debian Squeeze). Every executable I pass to popen fails with a msg: sh: sort: not found // happens to any command This happens regardless whether I point to the full path returned by "type" or keep it short . As mentioned earlier, this happens at only one testing environment, to add confusion, am running the same OS and had no problem whatsoever. Popen is apparently using sh to execute commands, but if I run the same command thru the prompt (bash or sh), everything's fine Thanks in advance (PS: even tried Python os.popen just to nail this head scratcher, and it works!) Edit this is a simple call that fails: $command="tail -10 myfile"; $handle = popen($command.' 2>&1','r'); if($handle){ while (!feof($handle)){ ....//process buffer } } returns: sh: tail: not found

    Read the article

  • Multiple video overlay - need advice

    - by Marvin
    Hi, I'm working on a project and I need some advice. Just some background, Im not a programmer though at times I do some fiddling and I am generally comfortable with more specific terms. Now for the actual issue, I have a folder with 10 small videos (4/7 secs max each) and I would like to display them full screen looping and overlaid. I'm not too sure on at what should I be looking at, I thought maybe processing but my most serious issue if that I cant even ask for help since I don't know what I need. Thank you for your time.

    Read the article

  • java class creation dynamically and make it accessible across the network different jvms i.e. serial

    - by inj.rav
    Hi. I have a requirement of creating java classes dynamically and make it accessible different jvms across the network. I tried to use reflection and javassist tool,but nothing worked. Let me explain the scenario we are using Coherence distributed cache. It has a power of doing aggregation/filtering in parallel across the cluster. For example if a class has [dynamic class] has amount variable and getAmount/setAmount methods. Then if we execute COHERENCE queries, it will start process in parallel across the cluster. I tried to create classes at run time by using javassist and reflection. I am able to access it from single JVM, but when I tried to access the same class from other jvm [through coherence cluster]. I am getting exception of class not found [as remote jvm is not having idea of this class].I can over come this by creating same class dynamically on remote jvm also and access the methods. But coherence in built methods/functions are not able to find the class. could some one help me on this matter

    Read the article

  • How do I best run a search on Date when it is not a :has_many association?

    - by Angela
    I have a number of activities that have a calculated scheduled date. The activities, for example, Email, have a email.days method which is the days from a Contact.start_date on which it should be sent. This means contact.start_date + email.days yields a date on which email is sent to contact. I would like to use link_to around the date, so I can see all the emails and associated contacts that are to be scheduled on that date. However, this "date" is not an attribute or an associate, so I'm not linking to a model's view. It's calculated. So: 1) What should the actual "format" of the date that gets passed in the URl be? What is the method to do the consistent conversion? 2) How do I (find) all instances, because this "date" is not an actual attribute, is it a calculated value which changes depending on the two associated models of Contact and Email. Thanks.

    Read the article

  • jQuery CSS Custom Flyout Menu Styling Issue

    - by aherrick
    I'm close to nailing this flyout menu I have been working on, just have a couple of current pain points. I'm trying to get left/right padding on my submenu items, as you can see I am not quite there. Also when the first submenu is displayed, I want to create a bit of a gap between the first row of list items and the child. Below is my current code and a screen shot displaying what I want. Based on my current CSS, any thoughts on how to get this done in a clean way? <!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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> function mainmenu() { $("#nav ul").css({ display: "none" }); // Opera Fix $("#nav li").hover(function() { $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(400); }, function() { $(this).find('ul:first').css({ visibility: "hidden" }); }); } $(document).ready(function() { mainmenu(); }); </script> <style type="text/css"> * { padding: 0px; margin: 0px; } body { font-size: 0.85em; font-family: Verdana, Arial, Helvetica, sans-serif; } #nav, #nav ul { margin: 0; padding: 0; list-style-type: none; list-style-position: outside; position: relative; } #nav a { display: block; padding: 4px 0px 4px 0px; color: #dfca90; text-decoration: none; background-color: #ECE9D8; font-size: 9px; font-weight: bold; font: bold 15px Palatino, 'Palatino Linotype' , Georgia, serif; } #nav > li > a { font-size: 16px; font-variant: small-caps; border-right: 1px solid #dfca90; padding-right: 10px; padding-left: 10px; padding-bottom: 6px; padding-top: 6px; background-color: #fff; color: #dfca90; } #nav li ul li a:hover { color: #999; } #nav li { float: left; position: relative; } #nav ul { position: absolute; display: none; width: 170px; border: 2px solid #dfca90; } #nav ul li { } #nav li ul a { width: 170px; height: auto; float: left; } #nav ul ul { top: -2px; } #nav li ul ul { left: 170px; background-color: #ECE9D8; } #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul { display: none; } #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li li li:hover ul { display: block; } </style> </head> <body> <ul id="nav"> <li><a href="#">1 HTML</a></li> <li><a href="#">2 CSS</a></li> <li><a href="#">3 Javascript </a> <ul> <li><a href="#">3.1 jQuery</a> <ul> <li><a href="#">3.1.1 Download</a> </li> <li><a href="#">3.1.2 Tutorial</a> </li> </ul> </li> <li><a href="#">3.2 Mootools</a></li> <li><a href="#">3.3 Prototype</a></li> </ul> </li> </ul> </body> </html>

    Read the article

  • Change value of jquery variable based on a select box

    - by Nikos
    I have a jquery datepicker script and what I want to do is to change "minDate: 10" value by a select box. $(function() { $('#hotel').change(function() { // assign the value to a variable, so you can test to see if it is working var selectVal = $('#hotel :selected').val(); if( selectVal == "hotel_c" ) { var date = 10; } if( selectVal == "hotel_a" ) { var date = 15; } if( selectVal == "hotel_b" ) { var date = 6; } }); var dates = $('#from, #to').datepicker({ defaultDate: "+1w", changeMonth: true, dateFormat: 'yy-m-d', minDate: 10, numberOfMonths: 3, onSelect: function(selectedDate) { var option = this.id == "from" ? "minDate" : "maxDate"; var instance = $(this).data("datepicker"); var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings); dates.not(this).datepicker("option", option, date); } }); });

    Read the article

  • file.createNewFile() creates files with last-modified time before actual creation time

    - by Kaleb Pederson
    I'm using JPoller to detect changes to files in a specific directory, but it's missing files because they end up with a timestamp earlier than their actual creation time. Here's how I test: public static void main(String [] files) { for (String file : files) { File f = new File(file); if (f.exists()) { System.err.println(file + " exists"); continue; } try { // find out the current time, I would hope to assume that the last-modified // time on the file will definitely be later than this System.out.println("-----------------------------------------"); long time = System.currentTimeMillis(); // create the file System.out.println("Creating " + file + " at " + time); f.createNewFile(); // let's see what the timestamp actually is (I've only seen it <time) System.out.println(file + " was last modified at: " + f.lastModified()); // well, ok, what if I explicitly set it to time? f.setLastModified(time); System.out.println("Updated modified time on " + file + " to " + time + " with actual " + f.lastModified()); } catch (IOException e) { System.err.println("Unable to create file"); } } } And here's what I get for output: ----------------------------------------- Creating test.7 at 1272324597956 test.7 was last modified at: 1272324597000 Updated modified time on test.7 to 1272324597956 with actual 1272324597000 ----------------------------------------- Creating test.8 at 1272324597957 test.8 was last modified at: 1272324597000 Updated modified time on test.8 to 1272324597957 with actual 1272324597000 ----------------------------------------- Creating test.9 at 1272324597957 test.9 was last modified at: 1272324597000 Updated modified time on test.9 to 1272324597957 with actual 1272324597000 The result is a race condition: JPoller records time of last check as xyz...123 File created at xyz...456 File last-modified timestamp actually reads xyz...000 JPoller looks for new/updated files with timestamp greater than xyz...123 JPoller ignores newly added file because xyz...000 is less than xyz...123 I pull my hair out for a while I tried digging into the code but both lastModified() and createNewFile() eventually resolve to native calls so I'm left with little information. For test.9, I lose 957 milliseconds. What kind of accuracy can I expect? Are my results going to vary by operating system or file system? Suggested workarounds? NOTE: I'm currently running Linux with an XFS filesystem. I wrote a quick program in C and the stat system call shows st_mtime as truncate(xyz...000/1000).

    Read the article

  • Controlling the Mc's of a loaded SWF

    - by Ross
    I have a controller.swf which loads an external swf into a movieclip. news_mc = loadEvent.currentTarget.content as MovieClip; the swf is called "news.swf" and has a movieclip on the maintimeline, frame 1 called "sb". I have tried everything to access this such as mews_mc.sb.alpha = 0; but nothing works?

    Read the article

  • [C#] Improving method to read signed 8-bit integers from hexadecimal.

    - by JYelton
    Scenario: I have a string of hexadecimal characters which encode 8-bit signed integers. Each two characters represent a byte which employ the leftmost (MSB) bit as the sign (rather than two's complement). I am converting these to signed ints within a loop and wondered if there's a better way to do it. There are too many conversions and I am sure there's a more efficient method that I am missing. Current Code: string strData = "FFC000407F"; // example input data, encodes: -127, -64, 0, 64, 127 int v; for (int x = 0; x < strData.Length/2; x++) { v = HexToInt(strData.Substring(x * 2, 2)); Console.WriteLine(v); // do stuff with v } private int HexToInt(string _hexData) { string strBinary = Convert.ToString(Convert.ToInt32(_hexData, 16), 2).PadLeft(_hexData.Length * 4, '0'); int i = Convert.ToInt32(strBinary.Substring(1, 7), 2); i = (strBinary.Substring(0, 1) == "0" ? i : -i); return i; } Question: Is there a more streamlined and direct approach to reading two hex characters and converting them to an int when they represent a signed int (-127 to 127) using the leftmost bit as the sign?

    Read the article

  • Multiple range product in Python

    - by Tyr
    Is there a better way to do this: perms = product(range(1,7),range(1,7),range(1,7)) so that I can choose how many ranges I use? I want it to be equivalent to this, but scalable. def dice(num) if num == 1: perms = ((i,) for i in range(1,7)) elif num == 2: perms = product(range(1,7),range(1,7)) elif num == 3: perms = product(range(1,7),range(1,7),range(1,7)) #... and so on but I know there has to be a better way. I'm using it for counting dice outcomes. The actual code def dice(selection= lambda d: d[2]): perms = itertools.product(range(1,7),range(1,7),range(1,7)) return collections.Counter(((selection(sorted(i)) for i in perms))) where I can call it with a variety of selectors, like sum(d[0:2]) for the sum of the lowest 2 dice or d[1] to get the middle dice.

    Read the article

  • Why is my Pre to Postfix code not working?

    - by Anthony Glyadchenko
    For a class assignment, I have to use two stacks in C++ to make an equation to be converted to its left to right equivalent: 2+4*(3+4*8) -- 35*4+2 -- 142 Here is the main code: #include <iostream> #include <cstring> #include "ctStack.h" using namespace std; int main (int argc, char * const argv[]) { string expression = "2+4*2"; ctstack *output = new ctstack(expression.length()); ctstack *stack = new ctstack(expression.length()); bool previousIsANum = false; for(int i = 0; i < expression.length(); i++){ switch (expression[i]){ case '(': previousIsANum = false; stack->cmstackPush(expression[i]); break; case ')': previousIsANum = false; char x; while (x != '('){ stack->cmstackPop(x); output->cmstackPush(x); } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': cout << "A number" << endl; previousIsANum = true; output->cmstackPush(expression[i]); break; case '+': previousIsANum = false; cout << "+" << endl; break; case '-': previousIsANum = false; cout << "-" << endl; break; case '*': previousIsANum = false; cout << "*" << endl; break; case '/': previousIsANum = false; cout << "/" << endl; break; default: break; } } char i = ' '; while (stack->ltopOfStack > 0){ stack->cmstackPop(i); output->cmstackPush(i); cout << i << endl; } return 0; } Here is the stack code (watch out!): #include <cstdio> #include <assert.h> #include <new.h> #include <stdlib.h> #include <iostream> class ctstack { private: long* lpstack ; // the stack itself long ltrue ; // constructor sets to 1 long lfalse ; // constructor sets to 0 // offset to top of the stack long lmaxEleInStack ; // maximum possible elements of stack public: long ltopOfStack ; ctstack ( long lnbrOfEleToAllocInStack ) { // Constructor lfalse = 0 ; // set to zero ltrue = 1 ; // set to one assert ( lnbrOfEleToAllocInStack > 0 ) ; // assure positive argument ltopOfStack = -1 ; // ltopOfStack is really an index lmaxEleInStack = lnbrOfEleToAllocInStack ; // set lmaxEleInStack to max ele lpstack = new long [ lmaxEleInStack ] ; // allocate stack assert ( lpstack ) ; // assure new succeeded } ~ctstack ( ) { // Destructor delete [ ] lpstack ; // Delete the stack itself } ctstack& operator= ( const ctstack& ctoriginStack) { // Assignment if ( this == &ctoriginStack ) // verify x not assigned to x return *this ; if ( this -> lmaxEleInStack < ctoriginStack . lmaxEleInStack ) { // if destination stack is smaller than delete [ ] this -> lpstack ; // original stack, delete dest and alloc this -> lpstack = // sufficient memory new long [ ctoriginStack . lmaxEleInStack ] ; assert ( this -> lpstack ) ; // assure new succeeded // reset stack size attribute this -> lmaxEleInStack = ctoriginStack . lmaxEleInStack ; } // copy original to destination stack for ( long i = 0 ; i < ctoriginStack . lmaxEleInStack ; i ++ ) *( this -> lpstack + i ) = *( ctoriginStack . lpstack + i ) ; this -> ltopOfStack = ctoriginStack . ltopOfStack ; // reset stack position attribute return *this ; } long cmstackPush (char lplaceInStack ) { // Push Method if ( ltopOfStack == lmaxEleInStack - 1 ) // stack is full can't add element return lfalse ; ltopOfStack ++ ; // acquire free slot *(lpstack + ltopOfStack ) = lplaceInStack ; // add element return ltrue ; // any number other than zero is true } long cmstackPop (char& lretrievedStackEle ) { // Pop Method if ( ltopOfStack < 0 ) { // stack has no elements lretrievedStackEle = -1 ; // dummy element return lfalse ; } lretrievedStackEle = *( lpstack + ltopOfStack ) ; // stack has element -- return it ltopOfStack -- ; // stack is pop'd return ltrue ; // any number other than zero is true } long cmstackLookAtTop (char& lretrievedStackEle ) { // Pop Method if ( ltopOfStack < 0 ) { // stack has no elements lretrievedStackEle = -1 ; // dummy element return lfalse ; } lretrievedStackEle = *( lpstack + ltopOfStack ) ; // stack has element -- return it return ltrue ; // any number other than zero is true } long cmstackHasAnEle (char& lretrievedTopOfStack ) { // Has element method lretrievedTopOfStack = ltopOfStack ; return ltopOfStack < 0 ? lfalse : ltrue ; // 0 - false stack does not have any ele } // 1 - true stack has at least one element long cmstackMaxNbrOfEle (char& lretrievedMaxStackEle ) { // Maximum element method lretrievedMaxStackEle = lmaxEleInStack ; // return stack size in reference var return ltrue ; // Return Maximum Size of Stack } } ; Thanks, Anthony.

    Read the article

  • Saving a project as an .ipa

    - by itai alter
    Hello all! I wrote an app for the iPad, but I don't currently own an iPad. I would like to save my project as an .ipa file (assuming it's .ipa for the iPad, like the iPhone) so I could send it to a friend with a Jailbroken iPad to test it on an actual device before I release it to the App Store. Is there any way I can do this? Thanks a bunch!

    Read the article

  • How to unit test C# Web Service with Visual Studio 2008

    - by Steven Behnke
    How are you supposed to unit test a web service in C# with Visual Studio 2008? When I generate a unit test it adds an actual reference to the web service class instead of a web reference. It sets the attributes specified in: http://msdn.microsoft.com/en-us/library/ms243399(VS.80).aspx#TestingWebServiceLocally Yet, it will complete without executing the test. I attempted to add the call to WebServiceHelper.TryUrlRedirection(...) but the call does not like the target since it inherits from WebService not WebClientProtocol. Thanks, Steven

    Read the article

  • How do i create a group of h:selectOneRadio in JSF?

    - by Nitesh Panchal
    Hello, I am trying to create a grooup of h:selectOneRadio but ui:repeat gives it different id for each row. This is my code :- <ui:repeat id="themes" value="#{RegisterBean.objBlogTemplateList}" var="item"> <p:graphicImage alt="#{item.templatePicName}" style="border: solid 5px white;width: 200px;height: 200px;" value="#{app:getCommonImagePath(item.templatePicName)}"/> <h:selectOneRadio rendered="false" value="#{RegisterBean.blogTemplateId}" layout="lineDirection" id = "rdTemplateId"> <f:selectItem itemLabel="#{item.templateName}" itemValue="#{item.templateId}"/> </h:selectOneRadio> </ui:repeat> Actually i want to create a single radio button with different selectItems in it which should be from the rows of my table in database. How do i do this?

    Read the article

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