Friday, March 8, 2019

Resizing PDF size when exported from MsVisio



You can follow these steps:

  1. In MsVisio, on the File tab, click Options, and then in the navigation pane, click Customize Ribbon.
  2. In the Main Tabs pane, click to select the Developer check box, and then click OK.
  3. On the Developer tab, click Show ShapeSheet, and then click Page.
  4. In the Print Properties section of the ShapeSheet, set the following values to 0:

           PageLeftMargin
           PageRightMargin
           PageTopMargin
           PageBottomMargin

           Use the Fit to Drawing command again.
           The page now resizes to fit the same dimensions of the drawing, and there is no margin.

Thursday, October 29, 2015

Convert .ogv files to .mp4 without losing quality in Ubuntu

Hey

There are two methods to achieve this.


  1. Type the following: avconv -i my-video.ogv -c:v libx264 -preset veryslow -qp 0 -vf scale="1280:trunc(ow/a/2)*2" -c:a libmp3lame -qscale:a 3 -ac 2 my-video.mp4
  2. Use vlc media player:
  • go to "Media" -> "Convert/Save" -> "File" and then add your file
  • Press "Convert/Save" and choose "Video H.264 + mp3 (mp4)"

Cheers !!!

Wednesday, June 17, 2015

Open files with different encoding (like Shift-JIS) in Visual C++

Hey,

If you happened to be in Japan and need to go through comments which are written in Japanese for some of your Visual C++ projects, then you may also have encountered that the comments are not displayed properly.

The reason is that the files are opened with different encoding; not in Shift-JIS.

To resolve this issue,
- in the "Solution Explorer", right click on some file and choose "Open with"
- in "Choose the program you want to use to open this file", select "C++ Source Code Editor (with encoding)" at set it as default.
- in next popup, choose "Japanese (Shift-JIS) - Codepage 932"and press OK

If the comments are still not visible, you may want to choose a different encoding scheme until you get it right.

PS
I am using Visual Studio 2013 Professional Edition

Cheers!

Wednesday, March 11, 2015

Importing LaTeX equations to MS Word

Hey,

This is how it is done.
The credit should go to original contributor at [here]


  • Let's assume your equation is x=y+z
  • Create the following .html file using your favorite text editor and insert the equation between $$ marks.


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<title>tex texample</title>
</head>
<body>

$$x=y+z$$

</body>
</html>
  • View that in a web browser, right click and select "show MathML as/MathML Code"
  • Select all and copy it into your favorite text editor in a new document.
  • Add <?xml version="1.0"?> at the beginning and again copy everything.
  • Paste it in MS Word and there you have your equation.

Friday, December 19, 2014

Matlab R2014a on Mac Maverick Retina Display

Hi guys,


  • I think you have also encountered that the Matlab GUI is blurry. 
  • The reason for this is that previous versions of Matlab like R2013b (and R2014a) includes a Java runtime (JRE) on the package itself, which however does not support the new features like Retina displays.
  • As a workaround, you can install the latest JRE and make Matlab point to this JRE.
  • This is how it is done. Credit should go to original contributors; I am just putting the links here.
    • Install latest JRE from link (you can choose jre-7u71-macosx-x64.dmg); may be you want to restart the machine.
    • Create an AppleScript with the following script and save it as app. Note that all the code needs to be in one line.
do shell script "export MATLAB_JAVA=\"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home\"" & "; export MATLAB_USE_USERWORK=1" & ";/Applications/MATLAB_R2014a.app/bin/matlab -desktop &> /dev/null &"
      • To create an AppleScript: Finder->Applications and find for AppleScript Editor (find within applications; not "This Mac") and paste the above script
      • Save it as an app.
    • If you would like to change its icon, 
      • select app in Finder and open app directory through “Show Package Contents”
      • go to Contents/Resources and copy/paste the new icon (.icns file) onto applet.icns (you can find Matlab icons from Matlab application folder itself)
      • the above steps themselves do not work usually, so do the following as well.
      • select the app, again in Finder and this time, click on “Get Info”
      • select the app icon at the top - a blue outline will appear
      • copy the icon (.icns file) onto this outlined icon (command-v)
      • now, check the .app directory using a terminal - “ls -la”
      • the “Icon?” file should be there
      • delete this file - “rm Icon^M”
      • immediately, the app should have the copied icon beside it in the Finder
Credit should go to

Cheers!

Sunday, November 9, 2014

Remove Pyramid Grid from ODE Drawstuff

Hi,

Here is how it is done.


  • In the ode source find drawstuff.cpp
  • In that you will find the call to the method drawPyramidGrid();
    • comment this out
  • Next, run the following in the source folder


$ ./configure --enable-double-precision --enable-shared
         $ make
         $ make install



  • To copy .h files and libraries to /usr/local/include and /usr/local/lib: 


$ sudo make install
$ sudo cp -p drawstuff/src/.libs/libdrawstuff.a /usr/local/lib/
$ sudo cp -p drawstuff/src/libdrawstuff.la /usr/local/lib/
$ sudo cp -rp include/drawstuff /usr/local/include/
$ sudo cp -rp drawstuff/textures /usr/local/include/drawstuff/


That's it
Cheers!

Thursday, November 6, 2014

DC Motor Torque, Speed

  • There is a torque-speed curve for motors, which looks like:



[reference: link]
  • This curve has been drawn for constant voltage and changing load.
    
  • First things first. There is no need to confuse the word “torque” related to a motor.
    If we recall that when a current carrying conductor in a magnetic field is subjected to a force and it is this force that creates the torque to rotate the rotor (conductor), it is this torque we are still talking about.
    [reference: link]
    • If there is a load attached to the rotor it wont affect the torque generated by the motor as it only depends on the current, the field, number of turns and the area of the coil.
      T = BINA Cosθ
      
  • It is important to note that the above curve has not been drawn for transients of motor speed; it is drawn for the final stabilized speed ω of the motor.
  • We discuss the transients of motor speed in order to understand what is going on but will draw the stabilized speed ω in the curve versus the torque.

  • Let's say we have some fixed load attached to the motor and the applied voltage is constant.
  • Now there is one thing we should remember. That is the existence of electrical torque and mechanical torque.
    • We already know what electrical torque is.
    • Mechanical torque is the usual force x distance in relation to the load.
    • That is the mechanical torque we need to turn the input shaft of the load.
    • When the motor is running in steady state, the armature current is constant, and the electrical torque is equal and opposite of the mechanical torque or load torque. 
    • When the motor is decelerating, the motor torque is less than the load torque. Conversely, when a motor is accelerating, the motor torque is higher than the load torque.
        
    • so, it is the resultant torque, τm - τl = τ, that will account for the acceleration of the load. 
    • This is somewhat like friction when we apply a force to a box or something.
      
  • At the beginning, ω=0 and CEMF (counter electro motive force or back emf), which is proportional to ω, will be zero.
  • Without any CEMF and small resistance of the coil, a huge current will be drawn from the DC source.
  • This will result in large torque τm; torque is proportional to current (or current2 in series DC motor).
  • τm - τl = τ will be large and ω will gradually increase.
  • When ω increases, however, there will be CEMF building up, which will reduce the applied voltage to the current coil.
    VDC – CEMF = v (VDC const.)
  • When v drops → the current drops → τm drops → τm - τl = τ drops
  • There will be, however, a torque and still there will be acceleration. What is happening is that this acceleration is gradually decreasing.
  • Finally,  τm = τl  and there wont be any resultant torque. 
  • As a result, ω will stabilize → CEMF will stabilize → VDC – CEMF = v will stabilize → current i will stabilize.
  • Now we have a point in curve. (τm, ω)
Reduce load (or load torque)
  • Now, we reduce the load. This means the mechanical torque required to turn the load τl will be reduced.
  • And we start everything from the beginning  ω=0
  • Now τm - τl = τ will be large. (τl has become smaller)
  • As a result, the acceleration of motor will be high. So, ω will attain higher values than the previous case.
  • Again CEMF will come into play. And, τm will start to decrease and will eventually equal τl which is smaller than the previous case.
  • As a result, ω will stabilize (at a higher value) → CEMF will stabilize → VDC – CEMF = v will stabilize → current i will stabilize.
  • Now we have another point in the curve. This time the torque will be lesser and ω will be higher, than the previous case.
    
  • So we saw that when the load (or load torque) decreases we need a small τm at stability. That is we needed little current. That is we needed VDC – CEMF = v to be small. This is achieved by higher CEMF, which is achieved by higher ω. 
  • For a huge load (or load torque), τm  will not be sufficient to turn the motor. Therefore,  ω=0 and there wont be any CEMF. Thus, i max → τmax 
  • Actually, this is kind of equal to the case of initial instance of a regular load, too. The only difference is the starting torque is enough to drive the load in this case.
Increase speed

  • For a given load we saw that ω stabilizes after its initial transients.
  • So, how can we increase the speed for a given load (e.g. fan)?
  • To increase speed we need more torque τm.
  • That is we need more current.
  • The only way we can do that is by increasing the voltage.
  • When the voltage is increased, we have more current and we will have a resultant torque.
  • This will increase the speed ω from its current value.
  • Again CEMF will come into play and, the resultant voltage will be reduced.
  • When v drops → the current drops → τm drops → τm - τl = τ drops.
  • Finally,  τm = τl  and there wont be any resultant torque. 
  • As a result, ω will stabilize → CEMF will stabilize → VDC – CEMF = v will stabilize → current i will stabilize.
  • Note that in this case ω has stabilized at a higher value than previous.  
Runaway
  • Let's say we want to control current/torque in a motor.
  • Assume that with a given load, the motor was drawing, say 100mA, turning at a speed of 1000rpm  and everything is steady.
  • Say we wanted to control current at 200mA.
  • And we increase the voltage.
  • So the current increases →  ω increases → CEMF increases → current starts to decrease.
  • That is we need higher voltage to maintain the current at the new set value.
  • Higher voltage → higher ω → higher CEMF → higher applied voltage needed → higher ω …
  • As a result, the motor speed runs away up to the maximum speed that is possible with the given supply voltage.
  • Such a runaway condition can occur unless it is limited by a higher-level control loop (velocity or position control), a mechanical stop (e.g. stopping by hand) or an additional safety speed limitation.

cheers!