Daily Archives

Articles indexed Friday June 6 2014

Page 10/17 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • implementing the generic interface

    - by user845405
    Could any one help me on implementing the generic interface for this class. I want to be able to use the below Cache class methods through an interface. Thank you for the help!. public class CacheStore { private Dictionary<string, object> _cache; private object _sync; public CacheStore() { _cache = new Dictionary<string, object>(); _sync = new object(); } public bool Exists<T>(string key) where T : class { Type type = typeof(T); lock (_sync) { return _cache.ContainsKey(type.Name + key); } } public bool Exists<T>() where T : class { Type type = typeof(T); lock (_sync) { return _cache.ContainsKey(type.Name); } } public T Get<T>(string key) where T : class { Type type = typeof(T); lock (_sync) { if (_cache.ContainsKey(key + type.Name) == false) throw new ApplicationException(String.Format("An object with key '{0}' does not exists", key)); lock (_sync) { return (T)_cache[key + type.Name]; } } } public void Add<T>(string key, T value) { Type type = typeof(T); if (value.GetType() != type) throw new ApplicationException(String.Format("The type of value passed to cache {0} does not match the cache type {1} for key {2}", value.GetType().FullName, type.FullName, key)); lock (_sync) { if (_cache.ContainsKey(key + type.Name)) throw new ApplicationException(String.Format("An object with key '{0}' already exists", key)); lock (_sync) { _cache.Add(key + type.Name, value); } } } } Could any one help me on implementing the generic interface for this class. I want to be able to use the below Cache class methods through an interface.

    Read the article

  • Cant center dropdown menu

    - by sonicboom
    I have a dropdown below ive creaeted, but im having troulbe centering the the menu. Ive tried to put <center> tags around it and also set the ul to margin auto 0 but its not working. Is there anything im missing? <style type="text/css"> ul { font-family: Arial, Verdana; font-size: 14px; margin: 0; padding: 0; list-style: none; } ul li { display: block; position: relative; float: left; } li ul { display: none; } ul li a { display: block; text-decoration: none; color: #ffffff; border-top: 1px solid #ffffff; padding: 5px 15px 5px 15px; background: #1e7c9a; margin-left: 1px; white-space: nowrap; } ul li a:hover { background: #3b3b3b; } li:hover ul { display: block; position: absolute; } li:hover li { float: none; font-size: 11px; } li:hover a { background: #3b3b3b; } li:hover li a:hover { background: #1e7c9a; } </style> </head> <body> <ul id="menu"> <li><a href="#">Home</a></li> <li><a href="#">Portfolio</a> <ul> <li><a href="#">Web Design</a></li> <li><a href="#">Graphic Design</a></li> <li><a href="#">Logo Design</a></li> <li><a href="#">Blog Design</a></li> </ul> </li> <li><a href="#">Projects</a> <ul> <li><a href="#">This is a project</a></li> <li><a href="#">So is this</a></li> <li><a href="#">and this</a></li> <li><a href="#">don't forget this too</a></li> </ul> </li> <li><a href="#">Contact</a> <ul> <li><a href="#">Support</a></li> <li><a href="#">Quote</a></li> <li><a href="#">General Enquiry</a></li> </ul> </li> </ul> I went ahead and put it on jsfiddle Here

    Read the article

  • Calculate Spearman's Rank Correlation Coefficient

    - by Arvigeus
    I'm trying to calculate correlations using this method. However, when I do the math by hand, I get one result, and when I do it with R - cor(dt, use="complete.obs", method="spearman") - I get totally different thing. Example data below: --------------------------------- AnswerPosID.1007 AnswerPosID.1008 --------------------------------- 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 --------------------------------- Manual result: 0.799777530589544; R cor: -0.07142857

    Read the article

  • Trying to make a reusable function and display the result in a div

    - by user3709033
    I have this function that I am trying to work with. All I am trying to do is to get the values of days, hours, min and sec into the .overTime div. I want to use the same function over and over again because i have more divs in which I want to display the same values but in a diff manner. You guys are awesome Thank You. NowTime = new Date(); //Time Now StartTime = new Date($('#StartTime').val()); StopTime = new Date($('#StopTime').val()); function fixIntegers(integer){ if (integer < 0) integer = 0; if (integer < 10) return '0' + integer; return '' + integer; } function Test( difference ) { var toReturn = { days: 0, hours: 0, minutes: 0, seconds: 0 }; toReturn.seconds = fixIntegers(difference % 60); difference = Math.floor(difference / 60); toReturn.minutes = fixIntegers(difference % 60); difference = Math.floor(difference / 60); toReturn.hours = fixIntegers(difference % 24); difference = Math.floor(difference / 24); toReturn.days = fixIntegers(difference); return toReturn; } function run() { var output = Test( Math.floor( ( NowTime - StopTime ) / 1000 ) ); $('.OverTime').html( output.days + ':' + output.hours + ':' + output.minutes + ':' + seconds); } setInterval(run, 1000) FIDDLE: http://jsfiddle.net/8943U/47/

    Read the article

  • Returning a Value from a jQuery Dialog Button Instead of Running a Function

    - by kamera
    I'm working on an admin UI and I can't wrap my head around how to get a specific kind of modal behaviour. I'm using jQuery. I already have a system for modal dialogs in place, where an openModal(settings) function opens a modal. Based on the settings, it will show/hide or sometimes inject various dialogs. I also have a generic confirmation dialog and this is the one I'm not sure how to make work. The layout is simple: <div id="confirmation-dialog"> <h2>Are you sure?</h2> <button class="button.yes">Yes</button> <button class="button.no">No</button> </div> I could just hard-code each button to do what I need it to do but I would like this to be more generic. Ideally, I would like it to function like this: (I know this doesn't work) function deleteImportantThing() { if (confirmThis() == true) { // Delete the thing } else { // Do nothing, close dialog } } function confirmThis() { openModal({kind: "confirm"}); // Check which button is clicked, then return true or false } I guess I just don't know enough JavaScript to get this to work, or to even figure out where to look. Any advice? I know there are modal dialog plug-ins out there but I'd have to change how the rest of my modals work to integrate them, and I'd like to do this myself if at all possible.

    Read the article

  • Reading XML or objects from a Web service

    - by Shawn
    This is my first time working with webservices and I am a bit lost. I successfully called the functions, but I only can get one value from the service. I read that the easiest way is to read xml or create objects and then call their values. Currently I use functions that return the desired value but I need to call them 3 times to get all the data witch is a waste of time and resources. I tried to call the service with the URL and use it as a website or getting the service to work the same way without importing into the program. The thing is that i cant find a way to pass the values into the url, because of that i get only blank pages. What is the fastest way to get my data from the services? I need city name, temperature and a flag if the city is valid. I need to pass the zip code to the service. Thank you. My current code wetther.Weather wether = new wetther.Weather(); string farenhait = wether.GetCityWeatherByZIP(zip).Temperature; string city = wether.GetCityWeatherByZIP(zip).City; bool correct = wether.GetCityWeatherByZIP(zip).Success; I tried it that way // Retrieve XML document XmlTextReader reader = new XmlTextReader("http://xml.weather.yahoo.com/forecastrss?p=94704"); // Skip non-significant whitespace reader.WhitespaceHandling = WhitespaceHandling.Significant; // Read nodes one at a time while (reader.Read()) { // Print out info on node Console.WriteLine("{0}: {1}", reader.NodeType.ToString(), reader.Name); } This one works for the yahoo page but not for mine. I need to use this webservice - http://wsf.cdyne.com/WeatherWS/Weather.asmx

    Read the article

  • Add class to elements which already have a class

    - by bwstud
    I have a group of divs which I'm dynamically generating when a button is clicked with the class, "brick". This gives them dimension and starting position of top: 0. I'm trying to get them to animate to the bottom of the view using a css transition with a second class assignment which gives them a bottom position: 0;. Can't figure out the syntax for adding a second class to elements with a pre-existing class. On inspection they only show the original class of, "brick". HTML <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> <div id="container"> <div id="button" >Click Me</div> </div> </body> </html> CSS #container { width: 100%; height: 100vh; padding: 10vmax; } #button { position: fixed; } .brick { position: relative; top: 0; height: 10vmax; width: 20vmax; background: white; margin: 0; padding: 0; transition: all 1s; } .drop { transition: all 1s; bottom 0; } The offending JS: var brickCount = function() { var count = prompt("How many boxes you lookin' for?"); for(var i=0; i < count; i++) { var newBrick = document.createElement("div"); newBrick.className="brick"; document.querySelector("#container") .appendChild(newBrick); } }; var getBricks = function(){ document.getElementByClass("brick"); }; var changeColor = function(){ getBricks.style.backgroundColor = '#'+Math.floor(Math.random()*16777215).toString(16); }; var addDrop = function() { getBricks.brick = "getBricks.brick" + " drop"; }; var multiple = function() { brickCount(); getBricks(); changeColor(); addDrop(); }; document.getElementById("button").onclick = function() {multiple();}; Thanks!

    Read the article

  • RegEx expression or jQuery selector to NOT match "external" links in href

    - by TrueBlueAussie
    I have a jQuery plugin that overrides link behavior, to allow Ajax loading of page content. Simple enough with a delegated event like $(document).on('click','a', function(){});. but I only want it to apply to links that are not like these ones (Ajax loading is not applicable to them, so links like these need to behave normally): target="_blank" // New browser window href="#..." // Bookmark link (page is already loaded). href="afs://..." // AFS file access. href="cid://..." // Content identifiers for MIME body part. href="file://..." // Specifies the address of a file from the locally accessible drive. href="ftp://..." // Uses Internet File Transfer Protocol (FTP) to retrieve a file. href="http://..." // The most commonly used access method. href="https://..." // Provide some level of security of transmission href="mailto://..." // Opens an email program. href="mid://..." // The message identifier for email. href="news://..." // Usenet newsgroup. href="x-exec://..." // Executable program. href="http://AnythingNotHere.com" // External links Sample code: $(document).on('click', 'a:not([target="_blank"])', function(){ var $this = $(this); if ('some additional check of href'){ // Do ajax load and stop default behaviour return false; } // allow link to work normally }); Q: Is there a way to easily detect all "local links" that would only navigate within the current website? excluding all the variations mentioned above. Note: This is for an MVC 5 Razor website, so absolute site URLs are unlikely to occur.

    Read the article

  • How to remove "index.php?" from HTACCESS [duplicate]

    - by Francis Goris
    This question already has an answer here: Reference: mod_rewrite, URL rewriting and “pretty links” explained 2 answers I have url like this: www.site.com/index.php?/genero/aventura/av/ But I would like this to be my new url: site.com/genero/aventura/av/ I used the following code: <IfModule mod_rewrite.c>RewriteEngine On RewriteCond %{HTTP_HOST} !^www.site.com/$ [NC] RewriteRule ^index.php\?/(.*)$ site.com/$1 [R=301,L] </IfModule> but only returns me: site.com/index.php?/genero/aventura/av/ This is my latest & full version: RewriteEngine on #RewriteCond $1 !^(index\.php|ver_capitulo\.html|google3436eb8eea8b8d6e\.html|BingSiteAuth\.xml |portadas|public|mp3|css|favicon\.ico|js|plantilla|i|swf|plugins|player\.swf|robots\.txt) RewriteCond $1 !^(index\.php|public|css|js|i|feed|portadas|robots\.txt|BingSiteAuth\.xml|plugins|i|mp3|favicon\.ico|pluginslist\.xml|google3436eb8eea8b8d6e\.html) RewriteRule ^(.*)$ /index.php?/$1 [L] #DirectoryIndex index.php #RewriteCond %{THE_REQUEST} http://www.page.com/index\.php [NC] #RewriteRule ^(.*?)index\.php$ http://page.com/$1 [L,R=301,NC,NE] #DirectoryIndex index.php #RewriteEngine On Thanks for reading.

    Read the article

  • Send the "ENTER" from a bash script

    - by Smat
    I am trying to create a bash script to simulate a mail attack to our mailserver. For this reason i want to create a bash script to send hundred of mails to our server, but when i launch the command: $telnet 192.168.12.1 25 <-- where 192.168.12.1 is the ip of our server The telnet session start and all the commands that i write later aren't executed. I also tried to create a second script to launch command on the telnet session after that this one are been created, but when i write from the second script: $echo -ne "EHLO domain.com\r\f" It print the command but doesn't do the ENTER so the command is not taken. Any idea?

    Read the article

  • How to roeder the rows of one matrix with respect to the other matrix?

    - by user2806363
    I have two big matrices A and B with diffrent dimensions.I want to order the rows of matrix B with respect to rows of the matrix A. and add the rows with values 0 to matrix B, if that row is not exist in B but in A Here is the reproduceable example and expected output: A<-matrix(c(1:40), ncol=8) rownames(A)<-c("B", "A", "C", "D", "E") > A [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] B 1 6 11 16 21 26 31 36 A 2 7 12 17 22 27 32 37 C 3 8 13 18 23 28 33 38 D 4 9 14 19 24 29 34 39 E 5 10 15 20 25 30 35 40 > B<-matrix(c(100:108),ncol=3) rownames(B)<-c("A", "E", "C") > B [,1] [,2] [,3] A 100 103 106 E 101 104 107 C 102 105 108 Here is the Expected output : >B [,1] [,2] [,3] B 0 0 0 A 100 103 106 C 102 105 108 D 0 0 0 E 101 104 107 > Would someone help me to implement this in R ?

    Read the article

  • Django naturaltime Localization error

    - by Edwin Lunando
    My language ID is 'id'. I used localized humanize library for my Django template tags and use the naturaltime, but the translation is partially wrong. The now translated to sekarang is right. second to detik. minute to menit, but when it comes to date, week, or months, the word is not translated to my language. It keeps printing date, week, and months. Here are my Django configuration TIME_ZONE = 'Asia/Jakarta' LANGUAGE_CODE = 'id' SITE_ID = 1 USE_I18N = True USE_L10N = True USE_TZ = True Here how I used the naturaltime template tags. <time class="discussion__info__item">{{ object.created|naturaltime }}</time> Do I forgot something? Thank you.

    Read the article

  • Can I get the original page source (vs current DOM) with phantomjs/casperjs?

    - by supercoco
    I am trying to get the original source for a particular web page. The page executes some scripts that modify the DOM as soon as it loads. I would like to get the source before any script or user changes any object in the document. With Chrome or Firefox (and probably most browsers) I can either look at the DOM (debug utility F12) or look at the original source (right-click, view source). The latter is what I want to accomplish. Is it possible to do this with phantomjs/casperjs? Before getting to the page I have to log in. This is working fine with casperjs. If I browse to the page and render the results I know I am on the right page. casper.thenOpen('http://'+customUrl, function(response) { this.page.render('example.png'); // *** Renders correct page (current DOM) *** console.log(this.page.content); // *** Gets current DOM *** casper.download('view-source:'+customUrl, 'b.html', 'GET'); // *** Blank page *** console.log(this.getHTML()); // *** Gets current DOM *** this.debugPage(); // *** Gets current DOM *** utils.dump(response); // *** No BODY *** casper.download('http://'+customUrl, 'a.html', 'GET'); // *** Not logged in ?! *** }); I've tried this.download(url, 'a.html') but it doesn't seem to share the same context since it returns HTML as if I was not logged in, even if I run with cookies casperjs test.casper.js --cookies-file=cookies.txt. I believe I should keep analyzing this option. I have also tried casper.open('view-source:url') instead of casper.open('http://url') but it seems it doesn't recognize the url since I just get a blank page. I have looked at the raw HTTP Response I get from the server with a utility I have and the body of this message (which is HTML) is what I need but when the page loads in the browser the DOM has already been modified. I tried: casper.thenOpen('http://'+url, function(response) { ... } But the response object only contains the headers and some other information but not the body. ¿Any ideas? Here is the full code: phantom.casperTest = true; phantom.cookiesEnabled = true; var utils = require('utils'); var casper = require('casper').create({ clientScripts: [], pageSettings: { loadImages: false, loadPlugins: false, javascriptEnabled: true, webSecurityEnabled: false }, logLevel: "error", verbose: true }); casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)'); casper.start('http://www.xxxxxxx.xxx/login'); casper.waitForSelector('input#login', function() { this.evaluate(function(customLogin, customPassword) { document.getElementById("login").value = customLogin; document.getElementById("password").value = customPassword; document.getElementById("button").click(); }, { "customLogin": customLogin, "customPassword": customPassword }); }, function() { console.log('Can't login.'); }, 15000 ); casper.waitForSelector('div#home', function() { console.log('Login successfull.'); }, function() { console.log('Login failed.'); }, 15000 ); casper.thenOpen('http://'+customUrl, function(response) { this.page.render('example.png'); // *** Renders correct page (current DOM) *** console.log(this.page.content); // *** Gets current DOM *** casper.download('view-source:'+customUrl, 'b.html', 'GET'); // *** Blank page *** console.log(this.getHTML()); // *** Gets current DOM *** this.debugPage(); // *** Gets current DOM *** utils.dump(response); // *** No BODY *** casper.download('http://'+customUrl, 'a.html', 'GET'); // *** Not logged in ?! *** });

    Read the article

  • tkinter frame does not show on startup

    - by Jzz
    this is my first question on SO, so correct me please if I make a fool of myself. I have this fairly complicated python / Tkinter application (python 2.7). On startup, the __init__ loads several frames, and loads a database. When that is finished, I want to set the application to a default state (there are 2 program states, 'calculate' and 'config'). Setting the state of the application means that the appropriate frame is displayed (using grid). When the program is running, the user can select a program state in the menu. Problem is, the frame is not displayed on startup. I get an empty application (menu bar and status bar are displayed). When I select a program state in the menu, the frame displays as it should. Question: What am I doing wrong? Should I update idletasks? I tried, but no result. Anything else? Background: I use the following to switch program states: def set_program_state(self, state): '''sets the program state''' #try cleaning all the frames: try: self.config_frame.grid_forget() except: pass try: self.tidal_calculations_frame.grid_forget() except: pass try: self.tidal_grapth_frame.grid_forget() except: pass if state == "calculate": print "Switching to calculation mode" self.tidal_calculations_frame.grid() #frame is preloaded self.tidal_calculations_frame.fill_data(routes=self.routing_data.routes, deviations=self.misc_data.deviations, ship_types=self.misc_data.ship_types) self.tidal_grapth_frame.grid() self.program_state = "calculate" elif state == "config": print "Switching to config mode" self.config_frame = GUI_helper.config_screen_frame(self, self.user) #load frame first (contents depend on type of user) self.config_frame.grid() self.program_state = "config" I understand that this is kind of messy to read, so I simplified things for testing, using this: def set_program_state(self, state): '''sets the program state''' #try cleaning all the frames: try: self.testlabel_1.grid_forget() except: pass try: self.testlabel_2.grid_forget() except: pass if state == "calculate": print "switching to test1" self.testlabel_1 = tk.Label(self, text="calculate", borderwidth=1, relief=tk.RAISED) self.testlabel_1.grid(row=0, sticky=tk.W+tk.E) elif state == "config": print "switching to test1" self.testlabel_2 = tk.Label(self, text="config", borderwidth=1, relief=tk.RAISED) self.testlabel_2.grid(row=0, sticky=tk.W+tk.E) But the result is the same. The frame (or label in this test) is not displayed at startup, but when the user selects the state (calling the same function) the frame is displayed. UPDATE the sample code in the comments (thanks for that!) pointed me in another direction. Further testing revealed (what I think) the cause of the problem. Disabling the display of the status bar made the program work as expected. Turns out, I used pack to display the statusbar and grid to display the frames. And they are in the same container, so problems arise. I fixed that by using only pack inside the main container. But the same problem is still there. This is what I use for the statusbar: self.status = GUI_helper.StatusBar(self.parent) self.status.pack(side=tk.BOTTOM, fill=tk.X) And if I comment out the last line (pack), the config frame loads on startup, as per this line: self.set_program_state("config") But if I let the status bar pack inside the main window, the config frame does not show. Where it does show when the user asks for it (with the same command as above).

    Read the article

  • Setting EditText imeOptions to actionNext has no effect

    - by Katedral Pillon
    I have a fairly complex (not really) xml layout file. One of the views is a LinearLayout (v1) with two children: an EditText(v2) and another LinearLayout(v3). The child LinearLayout in turn has an EditText(v4) and an ImageView(v5). For EditText v2 I have imeOptions as android:imeOptions="actionNext" But when I run the app, the keyboard's return does not check to next and I want it to change to next. How do I fix this problem? Also, when user clicks next, I want focus to go to EditText v4. I do I do this? For those who really need to see some code: <LinearLayout android:id="@+id/do_txt_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/col6" android:orientation="vertical" android:visibility="gone" > <EditText android:id="@+id/gm_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@drawable/coldo_text" android:hint="@string/enter_title" android:maxLines="1" android:imeOptions="actionNext" android:padding="5dp" android:textColor="pigc7" android:textSize="ads2" /> <LinearLayout android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal" > <EditText android:id="@+id/rev_text" android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:layout_margin="5dp" android:layout_weight="1" android:background="@drawable/coldo_text" android:hint="@string/enter_msg" android:maxLines="2" android:padding="5dp" android:textColor="pigc7" android:textSize="ads2" /> <ImageView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:background="@drawable/colbtn_r” android:clickable="true" android:onClick=“clickAct” android:paddingLeft="5dp" android:paddingRight="5dp" android:src="@drawable/abcat” /> </LinearLayout> </LinearLayout>

    Read the article

  • SharePoint 2010 Single Page Apps without a Master Page

    - by David Jacobus
    Originally posted on: http://geekswithblogs.net/djacobus/archive/2014/06/06/156827.aspxWell, maybe a stretch, but I am inclined to believe it is so.  I have been using  the JavaScript Client Object Model (JCSOM) for about 6 months now and I believe it can do about 80% of my job quickly without much fanfare.  When building sites in SharePoint no one wants the OOTB list views, etc. They want a custom look and feel!  I used to think in previous engagements that this would mean some custom server code or at least a data-form web part.   Since coming on-board in my current engagement, I have been forced because we don’t own the hosting site to come up with innovative ways to customize the UI of SharePoint.  We can push content via sandbox solutions and use JCSOM from within SharePoint Designer to do almost all customizations.  I have been using the following methodology to accomplish this: 1. Create an HTML file, which links CSS and JavaScript Files 2. Create and ASPX Web Part Page, Include a Content Editor Web Part and link to the HTML page created above.   So basically once it was done, I could copy , paste,  and rename those 4 items: CC, JS, HTML. ASPX and using MVVM just change the Model, View, and View-Model in the JavaScript file.  in about 5 minutes, I could create a completely new web part with SharePoint data.  Styling would take a little longer.  Some issues that would crop up: 1.  Multiple(s) of these web parts would not work well together on the same page (context). 2.  To separate the Web parts and context I would create a separate page for each web part and link them to a tabs layout via a Page Viewer web part or I frame.  Easy to do and not a problem but a big load problem as these web part pages even with minimal master had huge footprints.  (master page and page web part zones)   I kept thinking of my experience with SharePoint 2013 and apps!  The JavaScript was loaded from within the app, why can’t we do that in 2010 and skip the master page and web part zones. I thought at first, just link to sp.js but that didn’t work so I searched the web and found a link which did not work at all in my environment but helped me create a solution that would kudos to (Will). <!DOCTYPE html> <%@ Page %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <html> <head> <link rel="Stylesheet" type="text/css" href="../CSS/smoothness/jquery-ui-1.10.4.custom.min.css"> </head> <body > <form runat="server"> <!-- the following 5 js files are required to use CSOM --> <script src="/_layouts/1033/init.js" type="text/javascript" ></script> <script src="/_layouts/MicrosoftAjax.js" type="text/javascript" ></script> <script src="/_layouts/sp.core.js" type="text/javascript" ></script> <script src="/_layouts/sp.runtime.js" type="text/javascript" ></script> <script src="/_layouts/sp.js" type="text/javascript" ></script> <!-- include your app code --> <script src="../scripts/jquery-1.9.1.js" type="text/javascript" ></script> <script src="../Scripts/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script> <script src="../scripts/App.js" type="text/javascript" ></script> <div ID="Wrapper"> </div> <SharePoint:FormDigest ID="FormDigest1" runat="server"></SharePoint:FormDigest> </form> </body> </html> Notice that I have the scripts loaded within the body! I discovered this by accident in trying to get Will’s solution to work, it made this work just like normal JCSOM from the master page.  I am sure there are other ways to do this, but I am a full time developer, so I’ll let someone else investigate the alternatives.  I have an example page showing an Announcements list as a Booklet which is a JQuery Plug-In.  Here is the page source notice the footprint is light.   <!DOCTYPE html> <html> <head> <link rel="Stylesheet" type="text/css" href="../CSS/smoothness/jquery-ui-1.10.4.custom.min.css"> <link href="../CSS/jquery.booklet.latest.css" type="text/css" rel="stylesheet" media="screen, projection, tv" /> <link href="../CSS/bookletannouncement.css" type="text/css" rel="stylesheet" media="screen, projection, tv" /> </head> <body > <form name="ctl00" method="post" action="BookletAnnouncements2.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="ctl00"> <div> <input type="hidden" name="__REQUESTDIGEST" id="__REQUESTDIGEST" value="0x3384922A8349572E3D76DC68A3F7A0984CEC14CB9669817CCA584681B54417F7FDD579F940335DCEC95CFFAC78ADDD60420F7AA82F60A8BC1BB4B9B9A57F9309,06 Jun 2014 14:13:27 -0000" /> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUBMGRk20t+bh/NWY1sZwphwb24pIxjUbo=" /> </div> <script type="text/javascript"> //<![CDATA[ var g_presenceEnabled = true;var _fV4UI=true;var _spPageContextInfo = {webServerRelativeUrl: "\u002fsites\u002fDemo50\u002fTeamSite", webLanguage: 1033, currentLanguage: 1033, webUIVersion:4,pageListId:"{ee707b5f-e246-4246-9e55-8db11d09a8cb}",pageItemId:167,userId:1, alertsEnabled:false, siteServerRelativeUrl: "\u002fsites\u002fdemo50", allowSilverlightPrompt:'True'};//]]> </script> <script type="text/javascript" src="/_layouts/1033/init.js?rev=lEi61hsCxcBAfvfQNZA%2FsQ%3D%3D"></script> <script type="text/javascript"> //<![CDATA[ function WebForm_OnSubmit() { UpdateFormDigest('\u002fsites\u002fDemo50\u002fTeamSite', 1440000); return true; } //]]> </script> <!-- the following 5 js files are required to use CSOM --> <script src="/_layouts/1033/init.js"></script> <script src="/_layouts/MicrosoftAjax.js"></script> <script src="/_layouts/sp.core.js"></script> <script src="/_layouts/sp.runtime.js"></script> <script src="/_layouts/sp.js"></script> <!-- include your app code --> <script src="../scripts/jquery-1.9.1.js"></script> <script src="../Scripts/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script> <script src="../Scripts/jquery.easing.1.3.js"></script> <script src="../Scripts/jquery.booklet.latest.min.js"></script> <script src="../scripts/Announcementsbooklet.js"></script> <div ID="Accord"> </div> <script type="text/javascript"> //<![CDATA[ var _spFormDigestRefreshInterval = 1440000;//]]> </script> </form> </body> </html> Here is the source to make the booklet work: ExecuteOrDelayUntilScriptLoaded(retrieveListItems, "sp.js"); var context; var collListItem; var web; var listRootFolder; var oList; //retieve the list items from the host web function retrieveListItems() { context = SP.ClientContext.get_current(); web = context.get_web(); oList = context.get_web().get_lists().getByTitle('Announcements'); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml('<View><RowLimit>10</RowLimit></View>'); collListItem = oList.getItems(camlQuery); listRootFolder = oList.get_rootFolder(); context.load(listRootFolder); context.load(web); context.load(collListItem); context.executeQueryAsync(onQuerySucceeded, onQueryFailed); } //Model object var Dev = function (id, title, body, expires, url) { var self = this; self.ID = id; self.Title = title; self.Body = body; self.Expires = expires; self.Url = url; } //View model var DevVM = new ListViewModel() function ListViewModel() { var self = this; self.items = new Array(); } function onQuerySucceeded(sender, args) { var listItemEnumerator = collListItem.getEnumerator(); while (listItemEnumerator.moveNext()) { var oListItem = listItemEnumerator.get_current(); var javaDate = oListItem.get_item('Expires'); var fmtExpires = javaDate.format('dd MMM yyyy'); var url = ""; var goodUrl = oListItem.get_item('Url'); if (goodUrl == null) { url = web.get_serverRelativeUrl() + "/Lists/Announcements/EditForm.aspx?ID=" + oListItem.get_item('ID'); } else { url = web.get_serverRelativeUrl() + oListItem.get_item('Url') } DevVM.items.push(new Dev(oListItem.get_item('ID'), oListItem.get_item('Title'), oListItem.get_item('Body'), fmtExpires, url)); } $.each(DevVM.items, function (index) { $("#Accord").append(createAccordNode(DevVM.items[index].Title, DevVM.items[index].Body, " Expires: " + DevVM.items[index].Expires, DevVM.items[index].Url)); }); $("#Accord").booklet(); } function createAccordNode(title, body, expires, url) { return ( $("<div><h3>" + title + "</h3><p><span class='titlespan'><a href='" + url + "'>" + title + "</a></span><span class='dicussionspan'>" + body + "</span><span class='expiresspan'>" + expires + "</span></p></div>") ); } function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); } The idea behind this post is that this could be used to: 1.   Create landing pages that are very un-SharePoint like! 2.   Make lightweight pages that could be used in page viewer web part or I Frame. 3.  Utilize Deep Zoom Composer and Sea-Dragon/or Silver light I will be using this for much of my development work!

    Read the article

  • Rsync plugin to many local wordpress installs via script or cli

    - by Nick Abbey
    I am maintaining a large number of wordpress installs on a production server, and we are looking to deploy InfiniteWP for managing these installs. I am looking for a way to script the distribution of the plugin folder to all of these installs. On server wp-prod, all sites are stored in /srv//site/ The plugin needs to be copied from ~/iws-plugin to /srv//site/wp-content/plugins/ Here's some pseudo code to explain what I need to do: array dirs = <all folders in /srv> for each d in dirs if exits "/srv/d/site/wp-content/plugins" rsync -avzh --log-file=~/d.log ~/plugin_base_folder /srv/d/site/wp-content/plugins/ else touch d.log echo 'plugin folder for "d" not found' >> ~/d.log end end I just don't know how to make it happen from the cli or via bash. I can (and will) tinker with a bash or ruby script on my test server, but I'm thinking the command-line-fu here on SF is strong enough to handle this issue much more quickly than I can hack together a solution. Thanks!

    Read the article

  • How to make lighttpd respect X-Forwarded-Proto when constructing redirects for directories?

    - by Tim Landscheidt
    We have an nginx proxy at tools.wmflabs.org that receives requests by http and https and passes them by http on to lighttpds on a grid (one lighttpd per top-level path). Requests that reach the proxy by https are received by the lighttpds like this: HEAD /lighttpd-test/test HTTP/1.1 Connection: close Host: tools.wmflabs.org X-Forwarded-Proto: https X-Original-URI: /lighttpd-test/test User-Agent: curl/7.29.0 Accept: */* This works great except in the case where the URL references a physical directory and misses the trailing slash ("/"), as lighttpd then generates a redirect to the http URL: HTTP/1.1 301 Moved Permanently Location: http://tools.wmflabs.org/lighttpd-test/test/ Connection: close Date: Fri, 06 Jun 2014 14:50:29 GMT Server: lighttpd/1.4.28 The relevant parts of our lighttpd configurations are: server.modules = ( "mod_setenv", "mod_access", "mod_accesslog", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", "mod_fastcgi", "mod_cgi", ) server.port = $port [...] server.document-root = "$home/public_html" [...] server.follow-symlink = "enable" [...] server.stat-cache-engine = "fam" ssl.engine = "disable" alias.url = ( "/$tool" => "$home/public_html/" ) index-file.names = ( "index.php", "index.html", "index.htm" ) dir-listing.encoding = "utf-8" server.dir-listing = "disable" url.access-deny = ( "~", ".inc" ) [...] How can I make lighttpd respect X-Forwarded-Proto and use it when constructing redirects for directories? I'm aware that I could try to tackle this in nginx, but I'd prefer if I can fix it in lighttpd.

    Read the article

  • VM connected to network but not to internet in VMware Player 6 on Windows 8.1 host

    - by user1257262
    So I am running Bitnami's MEAN stack in VMware Player 6.0.2 on Windows 8.1 and the VM connects just fine to the network: https://www.dropbox.com/s/xfdzohjuuepz52w/ifconfig.PNG However, I am having a great deal of trouble getting the VM to communicate with the internet. No matter what sort of action I take (even something as simple as apt-get update), the machine just sits there and eventually fails to connect. Here is my VM's Network Adapter configuration: https://www.dropbox.com/s/xfdzohjuuepz52w/ifconfig.PNG On my host Windows 8.1 computer, I actually have the VMware Bridge Protocol enabled but for VMware Network Adapters (VMnet1 and VMnet 8), but they are listed as having No Internet access in my Network and Sharing Center. I am not entirely sure if these adapters are relevant to connecting the VM to the internet, to be honest. This is the first time I have ever had an issue connecting a virtual machine to the internet. This problem is also happening with other VM's I am trying to run. Can someone tell me what I am doing wrong and how I can fix it?

    Read the article

  • Setting up Group Managed Service Account on Windows Server 2012 R2

    - by Moo MinTroll
    I have a Windows 2012 R2 domain controller called cox.win.testlab. I have set up a group of hosts where I would like to use a gMSA (Group Managed Service Account). This group is called SQLManagedHosts. I created the account by following these steps in Powershell on the domain controller: PS C:\Windows\system32> Add-KdsRootKey -EffectiveTime ((get-date).addhours(-10)) Guid ---- 9b68b1e7-db76-c4e4-4978-63c2965e5596 PS C:\Windows\system32> New-ADServiceAccount mSQL -DNSHostName cox.win.testlab -PrincipalsAllowedToRetrieveManagedPassword SQLManagedHosts PS C:\Windows\system32> Get-ADServiceAccount msql DistinguishedName : CN=mSQL,CN=Managed Service Accounts,DC=win,DC=testlab Enabled : True Name : mSQL ObjectClass : msDS-GroupManagedServiceAccount ObjectGUID : cf9df74a-38e0-4d7a-856e-9af882b08800 SamAccountName : mSQL$ SID : S-1-5-21-3443997112-87545443-1733229669-1602 UserPrincipalName : On one of the hosts listed in SQLManagedHosts, I ran: PS C:\Windows\system32> Install-ADServiceAccount msql Install-ADServiceAccount : Cannot install service account. Error Message: 'An unspecified error has occurred'. At line:1 char:1 + Install-ADServiceAccount msql + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (mSQL:String) [Install-ADServiceAccount], ADException + FullyQualifiedErrorId : InstallADServiceAccount:PerformOperation:InstallServiceAcccountFailure,Microsoft.ActiveDirectory.Management.Commands.InstallADServiceAccount Any ideas why it might be failing? All servers involved are Windows Server 2012 R2.

    Read the article

  • Why am I having trouble viewing HTTPS websites only using Chrome only on my employer's network?

    - by user1742777
    I'm using Google Chrome on my new MacBook Pro that has been provided to me by my employer. Many of the HTTPS sites I visit do not work when I visit them using Google Crome while I am connected to my employer's network. Example: www.facebook.com These same sites work perfectly fine if I use a different browser (like Safari) or even with Chrome when my Macbook is connected to my home WiFi network. Chrome reports the error: "The certificate was signed by an unknown authority". See attached screenshots. How can I resolve this problem? I really want to use Chrome. But not having access to numerous important work and outside websites is unacceptable.

    Read the article

  • Apache form authentication issues

    - by rfcoder89
    I am trying to authenticate users through Apache using the form authentication method to restrict https requests to a certain folder. Although, regardless of whether the correct login details are provided it keeps reloading the same page except the url has the form values embedded in it instead of redirecting to the appropriate page. I need to use the form authentication type instead of basic so I can write my own html for the user to login. I am using Apache 2.4.9 and this is our current configuration. Apache config file <Location C:/wamp/www/directory> SetHandler form-login-handler AuthFormLoginRequiredLocation https://localNetwork.com/username/TestBed/HTML/login.html AuthFormLoginSuccessLocation https://localNetwork.com/username/TestBed/HTML/test.html AuthFormProvider file AuthUserFile "C:/wamp/passwords" AuthType form AuthName realm Session On SessionCookieName session path=/ SessionCryptoPassphrase secret </Location> And in the login html page I've added that for the user to login <form method="POST" action="/test.html"> User: <input type="text" name="httpd_username" value="" /> Pass: <input type="password" name="httpd_password" value="" /> <input type="submit" name="login" value="Login" /> </form>

    Read the article

  • CentOS (rel6) with default python 2.6, but seperate 3.3.5 installation

    - by Silvertiger
    I have a CentOS server (rel6) that had python installed (2.6), but I needed a few features in 3.3+. I installed 3.3 into a seperate folder and made a symbolic link to execute it: I installed setup tools: yum install python-setuptools I installed a needed module"pandas" easy_install pandas I executed my pyton script, which encountered an error that required i use a newer version I downloaded and installed Python 3.3.5 to it's own folder so as to not override my default python wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz tar xJf ./Python-3.3.5.tar.xz cd ./Python-3.3.5 ./configure --prefix=/opt/python make make install Made s symbolic link to allow me to execute this new python: ln -s /opt/python3.3/bin/python3.3 ~/bin/py The problem is that when I execute the python script with my new py alias, it does not have all the addons needed (explicitly MySQLdb) which the default install does. How do i go about installing the MySQLdb module, or any for that matter, to be reachable or useable for the new Python 3.3.5 installation? Or is there a way to make the current modules in 2.6 available to 3.3.5 as well?

    Read the article

  • Setting up WHM nameservers

    - by Miskone
    I am new to server administration and I've just got a dedicated root server from Hetzner. First I set up in Hetzner's robot DNS entries Registered nameservers: ns1.raybear.com 88.198.32.57 ns2.raybear.com 88.198.32.57 Under DNS entires I have buzz-buzz.me pointing to 88.198.32.57 // My server IP address and on my WHM I have DNS zone for buzz-buzz.me ; cPanel first:11.42.1.17 (update_time):1402062640 Cpanel::ZoneFile::VERSION:1.3 hostname:hosting.raybear.com latest:11.42.1.17 ; Zone file for buzz-buzz.me $TTL 14400 buzz-buzz.me. 86400 IN SOA ns1.raybear.com. miskone.gmail.com. ( 2014060605 ;Serial Number 86400 ;refresh 7200 ;retry 3600000 ;expire 86400 ) buzz-buzz.me. 86400 IN NS ns1.raybear.com. buzz-buzz.me. 86400 IN NS ns2.raybear.com. buzz-buzz.me. 14400 IN A 88.198.32.57 localhost 14400 IN A 127.0.0.1 buzz-buzz.me. 14400 IN MX 0 buzz-buzz.me. mail 14400 IN CNAME buzz-buzz.me. www 14400 IN CNAME buzz-buzz.me. ftp 14400 IN CNAME buzz-buzz.me. agent 14400 IN A 88.198.32.57 src 14400 IN A 88.198.32.57 platform 14400 IN A 88.198.32.57 But still I have some problems accesing buzz-buzz.me, agent.buzz-buzz.me and platform.buzz-buzz.me Also I have problem getting mails on Google account, I can send but not receive emails. How to solve this. As I said I am completly new here and I need urgent help.:(

    Read the article

  • cname and wordpress domain map

    - by andre
    I have a domain like this (www.example.com.br) and I'm also the manager for the domain and the nameservers too (the nameservers are Bind). Now I have a blog from wordpress.com and I wanted to map domain to www.88.example.com.br. The wordpress suggested to use this: 88.example.com.br IN CNAME example88.wordpress.com. Can I create a zone file with only that CNAME ? Can I use other zone file that already exists, like this ? $ORIGIN 88.example.com.br. 88.example.com.br IN CNAME exmple88.wordpress.com. Thanks in advance

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >