Posts

Showing posts from December, 2012

Bootstrap Datatable Cdn Code Example

Example: datatable cdn //DataTables 1.10.24 https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js

Centering In Latex Code Example

Example: figure centering latex \begin{figure} \centering ... (Code for pictures, captions) ... \end{figure}

CloudFlare And Logging Visitor IP Addresses Via In PHP

Answer : Extra server variables that are available to cloud flare are: $_SERVER["HTTP_CF_CONNECTING_IP"] real visitor ip address, this is what you want $_SERVER["HTTP_CF_IPCOUNTRY"] country of visitor $_SERVER["HTTP_CF_RAY"] $_SERVER["HTTP_CF_VISITOR"] this can help you know if its http or https you can use it like this: if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; } If you do this, and the validity of the visiting IP address is important, you might need to verify that the $_SERVER["REMOTE_ADDR"] contains an actual valid cloudflare IP address, because anyone can fake the header if he was able to connect directly to the server IP. Update : CloudFlare has released a module mod_cloudflare for apache, the module will log and display the actual visitor IP Addresses rather than those accessed by cloudflare! https://www.cloudfla

Cannot Find Assert.Fail And Assert.Pass Or Equivalent

Answer : The documentation includes a comparison chart including this: Fail - xUnit.net alternative: Assert.True(false, "message") (It doesn't show Assert.Pass , and I've never used that myself, but I suspect the alternative is just to return from the test. Of course that doesn't help if you want to throw it in a nested method call. My suspicion is that it's not very frequently used in NUnit, hence its absence in the comparison chart.) An alternative to Assert.Fail("messsage") suggested by xUnit docs xUnit.net alternative: Assert.True(false, "message") has a downside – its output is message Expected: True Actual: False To get rid of Expected: True Actual: False don't call Assert.True(false, "message") throw Xunit.Sdk.XunitException instead. For example, create a helper method similar to this: public static class MyAssert { public static void Fail(string message) => thro

Append Array In Array Python Code Example

Example 1: append element to an array python x = [ 'Red' , 'Blue' ] x . append ( 'Yellow' ) Example 2: append item to array python data = [ ] data . append ( "Item" ) print ( data )

4 Pillars Of Democracy Code Example

Example: 4 pillars of democracy Legislative, Executive, Judiciary, Press

Chrome, Javascript, Window.open In New Tab

Answer : You can't directly control this, because it's an option controlled by Internet Explorer users. Opening pages using Window.open with a different window name will open in a new browser window like a popup, OR open in a new tab, if the user configured the browser to do so. EDIT: A more detailed explanation: 1. In modern browsers, window.open will open in a new tab rather than a popup. 2. You can force a browser to use a new window (‘popup’) by specifying options in the 3rd parameter 3. If the window.open call was not part of a user-initiated event, it’ll open in a new window. 4. A “user initiated event” does not have to the same function call – but it must originate in the function invoked by a user click 5. If a user initiated event delegates or defers a function call (in an event listener or delegate not bound to the click event, or by using setTimeout for example), it loses it’s status as “user initiated” 6. Some popup blockers will allow win

How To Make Random Code Generator In C Code Example

Example 1: c generate random number # import < stdlib . h > # import < time . h > int r ; srand ( time ( NULL ) ) ; r = rand ( ) ; /* This will give you a pseudo random integer between 0 and RAND_MAX. srand(time(NULL)) is used to give it a random starting seed, based on the current time. rand() could be used without it, but would always return the same sequence of numbers. To generate a random number in between 0 (included) and X (excluded), do the following: */ # import < stdlib . h > # import < time . h > int r ; srand ( time ( NULL ) ) ; r = rand ( ) % X ; Example 2: random number generator c rand ( ) % ( maxlimit + 1 - minlimit ) + minlimit ;

Anaconda/conda - Install A Specific Package Version

Answer : To install a specific package: conda install <pkg>=<version> eg: conda install matplotlib=1.4.3 There is no version 1.3.0 for rope . 1.3.0 refers to the package cached-property . The highest available version of rope is 0.9.4 . You can install different versions with conda install package=version . But in this case there is only one version of rope so you don't need that. The reason you see the cached-property in this listing is because it contains the string "rope" : "cached-p rope erty" py35_0 means that you need python version 3.5 for this specific version. If you only have python3.4 and the package is only for version 3.5 you cannot install it with conda. I am not quite sure on the defaults either. It should be an indication that this package is inside the default conda channel. If any of these characters, '>', '<', '|' or '*', are used, a single or double quotes must be

Add Space In Math Mode Latex Code Example

Example 1: latex space in math mode \ ; - a thick space . \ : - a medium space . \ , - a thin space . \ ! - a negative thin space . Example 2: give space in latex Horizontal \hspace { 1 cm } spaces can be inserted manually . Useful to control the fine - tuning in the layout of pictures . Left Side \hfill Right Side

Alternative Console Host For Windows 7/Windows Server 2008

Answer : Below are some nice console-replacements products that are more user-friendly than cmd. As commented below, since Windows 7, all these shells are just an interface to conhost.exe, even powershell. For details, read What is conhost.exe and Why Is It Running. Therefore, the consoles below only replace the default visual interface to conhost which is the one exhibited by cmd, and are only useful when directly invoked as programs. They cannot be indirectly invoked, as when a console-executable such as diskpart is run, since this will invoke conhost, and conhost has its own I/O interface and API. Here is what Microsoft says in Windows 7 / Windows Server 2008 R2: Console Host : ConHost represents a permanent change in the way that console application I/O is handled. There is no registry key or group policy setting that can force Windows to revert back to “legacy mode” console behavior. The conclusion is that if you wish to replace the console in a deeper way t

Chef Supermarket Logs

[edit on GitHub] The Chef Supermarket omnibus package does not log Ruby on Rails messages by default. To enable debug logging, edit the /opt/supermarket/embedded/service/supermarket/config/environments/production.rb file and set the config.log_level setting to :debug : config . logger = Logger . new ( '/var/log/supermarket/rails/rails.log' ) config . logger . level = 'DEBUG' config . log_level = :debug Save the file, and then restart the Ruby on Rails service: supermarket - ctl restart rails

Bootstrap Color Palette Hex Code Example

Example: bootstrap primary color hex Vuetify Default Theme: primary: '#1976D2', secondary: '#424242', accent: '#82B1FF', error: '#FF5252', info: '#2196F3', success: '#4CAF50', warning: '#FFC107',

About "*.d.ts" In TypeScript

Answer : The "d.ts" file is used to provide typescript type information about an API that's written in JavaScript. The idea is that you're using something like jQuery or underscore, an existing javascript library. You want to consume those from your typescript code. Rather than rewriting jquery or underscore or whatever in typescript, you can instead write the d.ts file, which contains only the type annotations. Then from your typescript code you get the typescript benefits of static type checking while still using a pure JS library. d stands for Declaration Files: When a TypeScript script gets compiled there is an option to generate a declaration file (with the extension .d.ts) that functions as an interface to the components in the compiled JavaScript. In the process the compiler strips away all function and method bodies and preserves only the signatures of the types that are exported. The resulting declaration file can then be used to describ

90 F In C Code Example

Example: convert fahrenheit to celsius import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int far = sc . nextInt ( ) ; int cel = ( far - 32 ) * 5 / 9 ; System . out . printf ( "%d Fahrenheit is %d Celsius" , far , cel ) ; } }

Can I Check Playtime On PS4 Without PS Plus?

Answer : No There Is no official way for a user to check their playtime statistics. And as for checking RDR2 playtime exclusively Rockstar didnt include the ability to check it unlike their former games (you could check a lot of your in-game stats on their website for GTA-V etc. ). You can enable an email from playstation that will send you your total playtime for the year but you can't check this whenever you want. Sources: 1 2 3 Yes , you can check all stats including playtime on rockstar's social club website. Just login with your platform account.

Can One Get Hierarchical Graphs From Networkx With Python 3?

Image
Answer : [scroll down a bit to see what kind of output the code produces] edit (7 Nov 2019) I've put a more refined version of this into a package I've been writing: https://epidemicsonnetworks.readthedocs.io/en/latest/_modules/EoN/auxiliary.html#hierarchy_pos. The main difference between the code here and the version there is that the code here gives all children of a given node the same horizontal space, while the code following that link also considers how many descendants a node has when deciding how much space to allocate it. edit (19 Jan 2019) I have updated the code to be more robust: It now works for directed and undirected graphs without any modification, no longer requires the user to specify the root, and it tests that the graph is a tree before it runs (without the test it would have infinite recursion - see user2479115's answer for a way to handle non-trees). edit (27 Aug 2018) If you want to create a plot with the nodes appearing as rings around th