Posts

Showing posts from December, 2015

Batch Convert Ai Files To Pdf / Png Etc

Answer : You can use GhostScript for batch output .ai to various formats, i.e. transparent PNG: gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -sOutputFile=out.png in.ai Where -r300 is dpi resolution. For available devices with which you can convert .ai format, reference documentation. A typical .ai file (from version 9 up), saved the normal way (with PDF compatibility) does not need any special conversion (in most cases). For example, if you take a typical .ai file ...as I said, saved with PDF compatibility which is the default ... you can simply add .pdf to the end, and then open it in your default PDF viewer. No special conversion needed. On the other hand, if the file is not saved with PDF compatibility, the only option you have is to use Illustrator. All ai to pdf converters I have found require that the ai file have the PDF data to "convert" ... which they aren't really doing since its already a PDF to begin with (just change the extension to .pdf an

Can Redux Be Seen As A Pub/sub Or Observer Pattern?

Answer : Redux is not supposed to "replace the initial idea of react.js", think of it more like a library to managed shared state between components and to coordinate state mutations. Redux does use a pub/sub pattern indeed, see the store methods here: http://redux.js.org/docs/api/Store.html#store-methods You'll find a subscribe method that is used by components to subscribe to changes in the state tree. Normally you don't use store.subscribe directly, as the Redux-React bindings (Redux connect basically) do that for you. You can check out the actual implementation here, it's not that complicated to follow (in fact to me that's the main benefit of Redux over other Flux implementations): https://github.com/reduxjs/react-redux/blob/4.x/src/components/connect.js#L199 That code, apart from subscribing to the changes emitted by the store, also perform some optimisations, such as passing new props to the component (and hence triggering a re-render) only when

Blackeye Github Code Example

Example: blackeye github git clone https://github.com/thelinuxchoice/blackeye cd blackeye bash blackeye.sh

ASM X86_64 AVX: Xmm And Ymm Registers Differences

Image
Answer : xmm0 is the low half of ymm0 , exactly like eax is the low half of rax . Writing to xmm0 (with a VEX-coded instruction, not legacy SSE) zeros the upper lane of ymm0 , just like writing to eax zeros the upper half of rax to avoid false dependencies. Lack of zeroing the upper bytes for legacy SSE instructions is why there's a penalty for mixing AVX and legacy SSE instructions. Most AVX instructions are available with either 128-bit or 256-bit size. e.g. vaddps xmm0, xmm1, xmm2 or vaddps ymm0, ymm1, ymm2 . (The 256-bit versions of most integer instructions are only available in AVX2, with AVX only providing the 128-bit version. There are a couple exceptions, like vptest ymm, ymm in AVX1. And vmovdqu if you count that as an "integer" instruction). Scalar instructions like vmovd , vcvtss2si , and vcvtsi2ss are only available with XMM registers. Reading a YMM register is not logically different from reading an XMM register, but writing the low

Bootstrap Panel In Bootstrap 4 Code Example

Example: bootstrap + cards < div class = " card " style = " width : 18 rem ; " > < img class = " card-img-top " src = " ... " alt = " Card image cap " > < div class = " card-body " > < h5 class = " card-title " > Card title </ h5 > < p class = " card-text " > Some quick example text to build on the card title and make up the bulk of the card's content. </ p > < a href = " # " class = " btn btn-primary " > Go somewhere </ a > </ div > </ div >

90 Cm In Inches Code Example

Example: cm to inch 1 cm = 0.3937 inch

Aligning Pseudocode In LaTeX

Image
Answer : I have never used an algorithm package in Latex, what I'd do is use the verbatim environment and manually indent the code in the text editor. \begin{verbatim} 1 y=0 2 for i = n downto 0 3 y = a_i + x * y \end{verbatim} This will put exactly what you type in the environment in the output, including whitespace. If you need fancy Latex (like subscript and such) check the alltt package. Info on Verbatim If I were you and I was absolutely sure that the algorithmic package is not the way to go, I'd use something like this: \begin{align*} &y = 0 \\ &\text{for $i = n$ downto 0} \\ & \hspace{1cm} y = a_i + x * y \end{align*} This results in Edit 2: Sorry, from your code excerpt and another answer, I somehow thought you wanted verbatim text. I have had success using algorithmicx . It is customizable for your needs. Documentation (PDF) \usepackage{algorithm} \usepackage[noend]{algpseudocode} \begin{algorithm} \begin{algorithmic} \Stat

How To Take User Input In An String Array In Java Code Example

Example 1: take string array input in java String [ ] array = new String [ 20 ] ; System . out . println ( "Please enter 20 names to sort" ) ; Scanner s1 = new Scanner ( System . in ) ; for ( int i = 0 ; i < 20 ; ) { array [ i ] = s1 . nextLine ( ) ; } Example 2: how to get array input in java public class TakingInput { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; System . out . println ( "enter number of elements" ) ; int n = s . nextInt ( ) ; int arr [ ] = new int [ n ] ; System . out . println ( "enter elements" ) ; for ( int i = 0 ; i < n ; i ++ ) { //for reading array arr [ i ] = s . nextInt ( ) ; } for ( int i : arr ) { //for printing array System . out . println ( i ) ; } } }

Base64 Encode Python Code Example

Example 1: base64 encode python import base64 message = "Python is fun" message_bytes = message.encode('ascii') base64_bytes = base64.b64encode(message_bytes) base64_message = base64_bytes.decode('ascii') print(base64_message) Example 2: decode base64 python import base64 msg = base64.b64decode(msg) Example 3: base64 decode python >>> import base64 >>> encoded = base64.b64encode(b'data to be encoded') >>> encoded b'ZGF0YSB0byBiZSBlbmNvZGVk' >>> data = base64.b64decode(encoded) >>> data b'data to be encoded' Example 4: base64 python decode import base64 coded_string = '''Q5YACgA...''' base64.b64decode(coded_string) Example 5: decode base64 with python #== Decoding ==# import base64 base64_message = 'UHl0aG9uIGlzIGZ1bg==' base64_bytes = base64_message.encode('ascii') message_bytes = base64.b64decode(base64_bytes) message = message_bytes.de

Can Mongo Upsert Array Data?

Answer : I'm not aware of an option that would upsert into an embedded array as at MongoDB 2.2, so you will likely have to handle this in your application code. Given that you want to treat the embedded array as sort of a virtual collection, you may want to consider modelling the array as a separate collection instead. You can't do an upsert based on a field value within an embedded array, but you could use $addToSet to insert an embedded document if it doesn't exist already: db.soup.update({ "tester":"tom" }, { $addToSet: { 'array': { "id": "3", "letter": "d" } } }) That doesn't fit your exact use case of matching by id of the array element, but may be useful if you know the expected current value. I just ran into this problem myself. I wasn't able to find a one-call solution, but I found a two-call solution that works when you have

48 Inch To Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

12 Oz To Grams Code Example

Example: oz to g 1 ounce (oz) = 28.3495231 grams (g)

Best Way To Mirror Folders

Image
Answer : You could take a look at SyncToy from Microsoft. It's got a number options for copying data between folders - this page has a useful guide on it's use and explains what the various options do: Now, you need to choose how you want to backup the information. You can perform the following tasks between two folders: Synchronize : New and updated files are copied both ways. Renames and deletes in one folder is repeated on the other. Echo : New and updated files are copied left to right. Renames and deletes on the left are repeated on the right. Subscribe : Updated files on the right are copied to the left is the file name already exists on the left. Contribute : New and updated files are copied left to right. Renames on the left are repeated on the right. Similar to Echo, except there are no deletions. Combine : New and updated files are copied both ways. Renamed and deleted files are ignored. If these folders are on the same computer, then you can create

Abstract Method Java Code Example

Example 1: abstract class in java Sometimes we may come across a situation where we cannot provide implementation to all the methods in a class . We want to leave the implementation to a class that extends it . In such case we declare a class as abstract . To make a class abstract we use key word abstract . Any class that contains one or more abstract methods is declared as abstract . If we don’t declare class as abstract which contains abstract methods we get compile time error . 1 ) Abstract classes cannot be instantiated 2 ) An abstarct classes contains abstract method , concrete methods or both . 3 ) Any class which extends abstarct class must override all methods of abstract class 4 ) An abstarct class can contain either 0 or more abstract method . Example 2: What are abstract methods in java An abstract method is the method which does’nt have any body . Abstract method is declared with keyword abstract

Card With Image And Text In Flutter Code Example

Example: flutter card with image and text Card( child: Container( decoration: BoxDecoration( image: DecorationImage( image: AssetImage("images/image.png"), fit: BoxFit.fitWidth, alignment: Alignment.topCenter, ), ), child: Text("YOUR TEXT"), ), ),

Codesign Failed With A Nonzero Exit Code Code Example

Example: Command CodeSign failed with a nonzero exit code flutter Run 'flutter clean' and it works!

Black Screen When Alt-tab Or Exiting Fullscreen Games In Windows 10

Image
Answer : You can fix this by running the game in full-screen windowed mode, instead of running it in full-screen. The difference here is that you might lose out a tiny bit on high graphic games. When a game runs in full screen, it occupies the whole of grapic card power, leaving none to the Host OS, While in full screen windowed mode, the game loses out a bit on the "exclusive mode" & graphical interface. Starting a Full Screen Windowed game Download Fullscreenizer from here Extract and run fullscreenizer. Run your game in a window. If your game runs in a regular window or you can run it in a window, go to Step 4. If your game runs in fullscreen mode, try going to the game settings and then try changing the window type to windowed mode. If it is not possible to do this, then try CTRL+ALT+DEL and open task manager. This should minimize the game. In the fullscreenizer, click refresh, click on your game and click on fullscreenize. Note that this is not likely to wo

Codeigniter Where Not Null Condition In Array Code Example

Example 1: codeigniter query builder where not null $this->db->where('field is NOT NULL', NULL, FALSE); Example 2: where not null query codeigniter $this->db->where('columnName !=', null);

Accentuate Sentence Code Example

Example: define accentuate // Don't bother

Android Emulator Error: "System UI Has Stopped"

Answer : This is still "unanswered", but it probably has been resolved. I just want to share my experience and clarify a few things, some of which may not matter. Anyway, if this helps someone else that's great. 1) I had this problem on one machine (a new, but slower machine), but not another (the faster one) when running a 4.0.3 emulator. It is not a hardware problem though, and CPU speed doesn't make a difference. 2) Both machines are fully up-to-date ADT (Eclipse 4.2.x and Android 4.2.2 (API 17) SDK environments. 3) Editing, or even Deleting the emulator and then recreating it did NOT fix it. 4) The best solution is to locate and update the config.ini file. In Windows 7 (x64) I found the config.ini file in C:\Users \ [your user name] \ .android\avd\ICS_4.0.3_API_15.avd [*see AVD names below]. NOTE: First make sure you have “show hidden files, folder, or drives” turned on in Explorer or you won't see the ".android" folder. 5) Not s

About_Execution_Policies Em Https://go.microsoft.com/fwlink/?LinkID=135170. Code Example

Example: fwlink/?LinkID=135170 set-executionpolicy remotesigned