Was trying to connect to a PostgreSQL database running through VirtualBox locally, but is only exposed though SSH. In order to do that, I have to connect through an SSH tunnel. I found the following article here http://www.heidisql.com/forum.php?t=15472 that says:

SSH tunnel is built into HeidiSQL for MySQL only. For using a tunnel to a PostgreSQL server, you will need to start a plink.exe command line seperately, and then let HeidiSQL connect to 127.0.0.1 on the port you specified in the command line.

But I had no idea how to do that!

Did some research, and here’s what I ended up running that worked for me:

Make sure you have Putty installed (which included plink.exe). Open up a windows command prompt and navigate to the folder you have the Putty executables:

cd "C:\Program Files (x86)\PuTTY"

From there, run the following:

plink -L 5432:localhost:5432 "my local ssh profile"

where “my local ssh profile” is the name of the session config you have saved in PUTTY.

What this does it route all requests from localhost port 5432 to the connection it created through PUTTY and forwards them to the same port (hence the second 5432)

Now you just need to change the config for HeidiSQL to connect to ‘localhost’, port 5432. Then provide the user and password for the postgres database user you want to connect with.

Hope that helps!

 
NODE.JS(1)                                                                                                                                                                                NODE.JS(1)

NAME
       node - Server-side JavaScript

SYNOPSIS
       node [ -v ] [ --debug | --debug-brk ] [ --v8-options ]
            [ -e command | script.js ] [ arguments ]

       Execute without arguments to start the REPL.

DESCRIPTION
       Node is a set of libraries for javascript which allows it to be used outside of the browser. It is primarily focused on creating simple, easy to build network clients and servers.

OPTIONS
         -v, --version          print node's version

         -e, --eval script      evaluate script

         -p, --print            print result of --eval

         -i, --interactive      always enter the REPL even if stdin
                                does not appear to be a terminal

         --no-deprecation       silence deprecation warnings

         --trace-deprecation    show stack traces on deprecations

         --throw-deprecation    throw errors on deprecations

         --v8-options           print v8 command line options

         --max-stack-size=val   set max v8 stack size (bytes)

         --enable-ssl2          enable ssl2 in crypto, tls, and https
                                modules

         --enable-ssl3          enable ssl3 in crypto, tls, and https
                                modules

ENVIRONMENT VARIABLES
       NODE_PATH
              ´:´-separated list of directories prefixed to the module search path.

       NODE_MODULE_CONTEXTS
              If set to 1 then modules will load in their own global contexts.

       NODE_DISABLE_COLORS
              If set to 1 then colors will not be used in the REPL.

V8 OPTIONS
         --use_strict (enforce strict mode)
               type: bool  default: false
         --es5_readonly (activate correct semantics for inheriting readonliness)
               type: bool  default: false
         --es52_globals (activate new semantics for global var declarations)
               type: bool  default: false
         --harmony_typeof (enable harmony semantics for typeof)
               type: bool  default: false
         --harmony_scoping (enable harmony block scoping)
               type: bool  default: false
         --harmony_modules (enable harmony modules (implies block scoping))
               type: bool  default: false
         --harmony_proxies (enable harmony proxies)
               type: bool  default: false
         --harmony_collections (enable harmony collections (sets, maps, and weak maps))
               type: bool  default: false
         --harmony (enable all harmony features (except typeof))
               type: bool  default: false
         --packed_arrays (optimizes arrays that have no holes)
               type: bool  default: false
         --smi_only_arrays (tracks arrays with only smi values)
               type: bool  default: true
         --clever_optimizations (Optimize object size, Array shift, DOM strings and string +)
               type: bool  default: true
         --unbox_double_arrays (automatically unbox arrays of doubles)
               type: bool  default: true
         --string_slices (use string slices)
               type: bool  default: true
         --crankshaft (use crankshaft)
               type: bool  default: true
         --hydrogen_filter (optimization filter)
               type: string  default:
         --use_range (use hydrogen range analysis)
               type: bool  default: true
         --eliminate_dead_phis (eliminate dead phis)
               type: bool  default: true
         --use_gvn (use hydrogen global value numbering)
               type: bool  default: true
         --use_canonicalizing (use hydrogen instruction canonicalizing)
               type: bool  default: true
         --use_inlining (use function inlining)
               type: bool  default: true
         --max_inlined_source_size (maximum source size in bytes considered for a single inlining)
               type: int  default: 600
         --max_inlined_nodes (maximum number of AST nodes considered for a single inlining)
               type: int  default: 196
         --max_inlined_nodes_cumulative (maximum cumulative number of AST nodes considered for inlining)
               type: int  default: 196
         --loop_invariant_code_motion (loop invariant code motion)
               type: bool  default: true
         --collect_megamorphic_maps_from_stub_cache (crankshaft harvests type feedback from stub cache)
               type: bool  default: true
         --hydrogen_stats (print statistics for hydrogen)
               type: bool  default: false
         --trace_hydrogen (trace generated hydrogen to file)
               type: bool  default: false
         --trace_phase (trace generated IR for specified phases)
               type: string  default: Z
         --trace_inlining (trace inlining decisions)
               type: bool  default: false
         --trace_alloc (trace register allocator)
               type: bool  default: false
         --trace_all_uses (trace all use positions)
               type: bool  default: false
         --trace_range (trace range analysis)
               type: bool  default: false
         --trace_gvn (trace global value numbering)
               type: bool  default: false
         --trace_representation (trace representation types)
               type: bool  default: false
         --stress_pointer_maps (pointer map for every instruction)
               type: bool  default: false
         --stress_environments (environment for every instruction)
               type: bool  default: false
         --deopt_every_n_times (deoptimize every n times a deopt point is passed)
               type: int  default: 0
         --trap_on_deopt (put a break point before deoptimizing)
               type: bool  default: false
         --deoptimize_uncommon_cases (deoptimize uncommon cases)
               type: bool  default: true
         --polymorphic_inlining (polymorphic inlining)
               type: bool  default: true
         --use_osr (use on-stack replacement)
               type: bool  default: true
         --array_bounds_checks_elimination (perform array bounds checks elimination)
               type: bool  default: false
         --array_index_dehoisting (perform array index dehoisting)
               type: bool  default: false
         --trace_osr (trace on-stack replacement)
               type: bool  default: false
         --stress_runs (number of stress runs)
               type: int  default: 0
         --optimize_closures (optimize closures)
               type: bool  default: true
         --inline_construct (inline constructor calls)
               type: bool  default: true
         --inline_arguments (inline functions with arguments object)
               type: bool  default: true
         --loop_weight (loop weight for representation inference)
               type: int  default: 1
         --optimize_for_in (optimize functions containing for-in loops)
               type: bool  default: true
         --experimental_profiler (enable all profiler experiments)
               type: bool  default: true
         --watch_ic_patching (profiler considers IC stability)
               type: bool  default: false
         --frame_count (number of stack frames inspected by the profiler)
               type: int  default: 1
         --self_optimization (primitive functions trigger their own optimization)
               type: bool  default: false
         --direct_self_opt (call recompile stub directly when self-optimizing)
               type: bool  default: false
         --retry_self_opt (re-try self-optimization if it failed)
               type: bool  default: false
         --count_based_interrupts (trigger profiler ticks based on counting instead of timing)
               type: bool  default: false
         --interrupt_at_exit (insert an interrupt check at function exit)
               type: bool  default: false
         --weighted_back_edges (weight back edges by jump distance for interrupt triggering)
               type: bool  default: false
         --interrupt_budget (execution budget before interrupt is triggered)
               type: int  default: 5900
         --type_info_threshold (percentage of ICs that must have type info to allow optimization)
               type: int  default: 15
         --self_opt_count (call count before self-optimization)
               type: int  default: 130
         --trace_opt_verbose (extra verbose compilation tracing)
               type: bool  default: false
         --debug_code (generate extra code (assertions) for debugging)
               type: bool  default: false
         --code_comments (emit comments in code disassembly)
               type: bool  default: false
         --enable_sse2 (enable use of SSE2 instructions if available)
               type: bool  default: true
         --enable_sse3 (enable use of SSE3 instructions if available)
               type: bool  default: true
         --enable_sse4_1 (enable use of SSE4.1 instructions if available)
               type: bool  default: true
         --enable_cmov (enable use of CMOV instruction if available)
               type: bool  default: true
         --enable_rdtsc (enable use of RDTSC instruction if available)
               type: bool  default: true
         --enable_sahf (enable use of SAHF instruction if available (X64 only))
               type: bool  default: true
         --enable_vfp3 (enable use of VFP3 instructions if available - this implies enabling ARMv7 instructions (ARM only))
               type: bool  default: true
         --enable_armv7 (enable use of ARMv7 instructions if available (ARM only))
               type: bool  default: true
         --enable_fpu (enable use of MIPS FPU instructions if available (MIPS only))
               type: bool  default: true
         --expose_natives_as (expose natives in global object)
               type: string  default: NULL
         --expose_debug_as (expose debug in global object)
               type: string  default: NULL
         --expose_gc (expose gc extension)
               type: bool  default: false
         --expose_externalize_string (expose externalize string extension)
               type: bool  default: false
         --stack_trace_limit (number of stack frames to capture)
               type: int  default: 10
         --builtins_in_stack_traces (show built-in functions in stack traces)
               type: bool  default: false
         --disable_native_files (disable builtin natives files)
               type: bool  default: false
         --inline_new (use fast inline allocation)
               type: bool  default: true
         --stack_trace_on_abort (print a stack trace if an assertion failure occurs)
               type: bool  default: true
         --trace (trace function calls)
               type: bool  default: false
         --mask_constants_with_cookie (use random jit cookie to mask large constants)
               type: bool  default: true
         --lazy (use lazy compilation)
               type: bool  default: true
         --trace_opt (trace lazy optimization)
               type: bool  default: false
         --trace_opt_stats (trace lazy optimization statistics)
               type: bool  default: false
         --opt (use adaptive optimizations)
               type: bool  default: true
         --always_opt (always try to optimize functions)
               type: bool  default: false
         --prepare_always_opt (prepare for turning on always opt)
               type: bool  default: false
         --trace_deopt (trace deoptimization)
               type: bool  default: false
         --min_preparse_length (minimum length for automatic enable preparsing)
               type: int  default: 1024
         --always_full_compiler (try to use the dedicated run-once backend for all code)
               type: bool  default: false
         --trace_bailout (print reasons for falling back to using the classic V8 backend)
               type: bool  default: false
         --compilation_cache (enable compilation cache)
               type: bool  default: true
         --cache_prototype_transitions (cache prototype transitions)
               type: bool  default: true
         --trace_debug_json (trace debugging JSON request/response)
               type: bool  default: false
         --debugger_auto_break (automatically set the debug break flag when debugger commands are in the queue)
               type: bool  default: true
         --enable_liveedit (enable liveedit experimental feature)
               type: bool  default: true
         --break_on_abort (always cause a debug break before aborting)
               type: bool  default: true
         --stack_size (default size of stack region v8 is allowed to use (in kBytes))
               type: int  default: 984
         --max_stack_trace_source_length (maximum length of function source code printed in a stack trace.)
               type: int  default: 300
         --always_inline_smi_code (always inline smi code in non-opt code)
               type: bool  default: false
         --max_new_space_size (max size of the new generation (in kBytes))
               type: int  default: 0
         --max_old_space_size (max size of the old generation (in Mbytes))
               type: int  default: 0
         --max_executable_size (max size of executable memory (in Mbytes))
               type: int  default: 0
         --gc_global (always perform global GCs)
               type: bool  default: false
         --gc_interval (garbage collect after  allocations)
               type: int  default: -1
         --trace_gc (print one trace line following each garbage collection)
               type: bool  default: false
         --trace_gc_nvp (print one detailed trace line in name=value format after each garbage collection)
               type: bool  default: false
         --print_cumulative_gc_stat (print cumulative GC statistics in name=value format on exit)
               type: bool  default: false
         --trace_gc_verbose (print more details following each garbage collection)
               type: bool  default: false
         --trace_fragmentation (report fragmentation for old pointer and data pages)
               type: bool  default: false
         --collect_maps (garbage collect maps from which no objects can be reached)
               type: bool  default: true
         --flush_code (flush code that we expect not to use again before full gc)
               type: bool  default: true
         --incremental_marking (use incremental marking)
               type: bool  default: true
         --incremental_marking_steps (do incremental marking steps)
               type: bool  default: true
         --trace_incremental_marking (trace progress of the incremental marking)
               type: bool  default: false
         --use_idle_notification (Use idle notification to reduce memory footprint.)
               type: bool  default: true
         --send_idle_notification (Send idle notification between stress runs.)
               type: bool  default: false
         --use_ic (use inline caching)
               type: bool  default: true
         --native_code_counters (generate extra code for manipulating stats counters)
               type: bool  default: false
         --always_compact (Perform compaction on every full GC)
               type: bool  default: false
         --lazy_sweeping (Use lazy sweeping for old pointer and data spaces)
               type: bool  default: true
         --never_compact (Never perform compaction on full GC - testing only)
               type: bool  default: false
         --compact_code_space (Compact code space on full non-incremental collections)
               type: bool  default: true
         --cleanup_code_caches_at_gc (Flush inline caches prior to mark compact collection and flush code caches in maps during mark compact cycle.)
               type: bool  default: true
         --random_seed (Default seed for initializing random generator (0, the default, means to use system random).)
               type: int  default: 0
         --use_verbose_printer (allows verbose printing)
               type: bool  default: true
         --allow_natives_syntax (allow natives syntax)
               type: bool  default: false
         --trace_sim (Trace simulator execution)
               type: bool  default: false
         --check_icache (Check icache flushes in ARM and MIPS simulator)
               type: bool  default: false
         --stop_sim_at (Simulator stop after x number of instructions)
               type: int  default: 0
         --sim_stack_alignment (Stack alignment in bytes in simulator (4 or 8, 8 is default))
               type: int  default: 8
         --trace_exception (print stack trace when throwing exceptions)
               type: bool  default: false
         --preallocate_message_memory (preallocate some memory to build stack traces.)
               type: bool  default: false
         --randomize_hashes (randomize hashes to avoid predictable hash collisions (with snapshots this option cannot override the baked-in seed))
               type: bool  default: true
         --hash_seed (Fixed seed to use to hash property keys (0 means random)(with snapshots this option cannot override the baked-in seed))
               type: int  default: 0
         --preemption (activate a 100ms timer that switches between V8 threads)
               type: bool  default: false
         --regexp_optimization (generate optimized regexp code)
               type: bool  default: true
         --testing_bool_flag (testing_bool_flag)
               type: bool  default: true
         --testing_int_flag (testing_int_flag)
               type: int  default: 13
         --testing_float_flag (float-flag)
               type: float  default: 2.500000
         --testing_string_flag (string-flag)
               type: string  default: Hello, world!
         --testing_prng_seed (Seed used for threading test randomness)
               type: int  default: 42
         --testing_serialization_file (file in which to serialize heap)
               type: string  default: /tmp/serdes
         --help (Print usage message, including flags, on console)
               type: bool  default: true
         --dump_counters (Dump counters on exit)
               type: bool  default: false
         --debugger (Enable JavaScript debugger)
               type: bool  default: false
         --remote_debugger (Connect JavaScript debugger to the debugger agent in another process)
               type: bool  default: false
         --debugger_agent (Enable debugger agent)
               type: bool  default: false
         --debugger_port (Port to use for remote debugging)
               type: int  default: 5858
         --map_counters (Map counters to a file)
               type: string  default:
         --js_arguments (Pass all remaining arguments to the script. Alias for "--".)
               type: arguments  default:
         --debug_compile_events (Enable debugger compile events)
               type: bool  default: true
         --debug_script_collected_events (Enable debugger script collected events)
               type: bool  default: true
         --gdbjit (enable GDBJIT interface (disables compacting GC))
               type: bool  default: false
         --gdbjit_full (enable GDBJIT interface for all code objects)
               type: bool  default: false
         --gdbjit_dump (dump elf objects with debug info to disk)
               type: bool  default: false
         --gdbjit_dump_filter (dump only objects containing this substring)
               type: string  default:
         --force_marking_deque_overflows (force overflows of marking deque by reducing its size to 64 words)
               type: bool  default: false
         --stress_compaction (stress the GC compactor to flush out bugs (implies --force_marking_deque_overflows))
               type: bool  default: false
         --log (Minimal logging (no API, code, GC, suspect, or handles samples).)
               type: bool  default: false
         --log_all (Log all events to the log file.)
               type: bool  default: false
         --log_runtime (Activate runtime system %Log call.)
               type: bool  default: false
         --log_api (Log API events to the log file.)
               type: bool  default: false
         --log_code (Log code events to the log file without profiling.)
               type: bool  default: false
         --log_gc (Log heap samples on garbage collection for the hp2ps tool.)
               type: bool  default: false
         --log_handles (Log global handle events.)
               type: bool  default: false
         --log_snapshot_positions (log positions of (de)serialized objects in the snapshot.)
               type: bool  default: false
         --log_suspect (Log suspect operations.)
               type: bool  default: false
         --prof (Log statistical profiling information (implies --log-code).)
               type: bool  default: false
         --prof_auto (Used with --prof, starts profiling automatically)
               type: bool  default: true
         --prof_lazy (Used with --prof, only does sampling and logging when profiler is active (implies --noprof_auto).)
               type: bool  default: false
         --prof_browser_mode (Used with --prof, turns on browser-compatible mode for profiling.)
               type: bool  default: true
         --log_regexp (Log regular expression execution.)
               type: bool  default: false
         --sliding_state_window (Update sliding state window counters.)
               type: bool  default: false
         --logfile (Specify the name of the log file.)
               type: string  default: v8.log
         --ll_prof (Enable low-level linux profiler.)
               type: bool  default: false

RESOURCES AND DOCUMENTATION
       See the website for documentation http://nodejs.org/

       Mailing list: http://groups.google.com/group/nodejs

       IRC: irc.freenode.net #node.js

                                                                                                2010                                                                                      NODE.JS(1)

 

What happens when PHP’s CURL library encounters a 301 Redirect header? It depends.

By default, it does NOT redirect. It will simply halt after the header is returned.

However, there is an option you can set that allows it to follow up to 5 redirects in a chain: the CURLOPT_FOLLOWLOCATION setting.

curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);

Hope that helps anyone else out there that was curious!

 

What happens when PHP’s file_get_contents() function encounters a 301 Redirect header? I thought I could find out by going to the PHP documentation, but I couldn’t find anything. So instead, I set up a simple test myself.

Just made a simple script that echos file_get_contents() and pointed it to a URL that I know has a 301 redirect. What happened? It followed it.

Now I’m not sure how many redirects it will follow (most environments have a limit to prevent infinite loops of one 301 redirect back to another), but by default file_get_contents() DOES follow redirects.

Hope that helps anyone else out there that was curious!

 

I’m writing code for a wordpress plugin of mine, and needed for the get_posts() function to return ALL posts. Here’s what I was using before:

$args = array(
‘post_type’ => ‘post’,
‘post_status’ => ‘publish’,
);
$posts = get_posts($args);

According to the wordpress documentation, the ‘posts_per_page’ option for this function has a default value of 5, meaning you’ll get at most 5 results back. I looked to see if there was a way to show all posts, and I couldn’t find it documented anywhere.

However, I did see some people provide code that had that value set at -1. I thought it might be a way of specifying no limit, so I tried it, and it’s working. Here’s what I use now:

$args = array(
‘post_type’ => ‘post’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => -1
);
$posts = get_posts($args);

It may not be a documented features, but it’s working for now. Give it a shot if you’re looking to have get_posts() return an unlimited number of posts.

 

Last week I had a site that Google was linking to securely, ie the https://www… instead of http://www.  I had a SSL cert set up on the site, but not all the content was being served over https, which was causing errors. So if you searched for my site on Google and clicked on the link that came up, you were seeing a broken site!

I figured there’d be a setting in Google Webmaster Tools that would allow you to specify the preferred protocol for your site. But there’s not. How did Google even know to use https in the first place?

To see if Google has indexed any of your urls securely, perform this search: “site:www.mysite.com -inurl:http”. I had several showing up.

It turns out that once Google knows you have https (all it takes is one link), they’ll prefer it over http and update all of their references to you. You can use a 301 redirect, but that seems like overkill. I searched and searched for a better solution, and finally found a solution to tell Google I wanted to use the non-secure version of our site as our home page.

The solution is this: Use the canonical tag on all your pages, pointing to your http page. That’s it. If your site is a wordpress blog, there are some plugins that can help you do this.

It’ll take a couple days for Google to recrawl you and honor your preferred urls specified in your canonicals, but it’ll work.

Here’s the original forum post that had the solution: StackExchange

 

I know it sounds weird to have a filter for ALL incoming mail, as it’s not really filtering anything. But sometimes there are actions you want Gmail to take on all of your email. This could include not sending anything to the spam folder, forwarding the email to a different address, or marking it with a label.

There is not ‘catch all’ setting, so you have to use a simple trick. When setting your filter search options, enter a nonsense value in the “Doesn’t have” field. Example: ‘ash87slkjhsdkjfsd8fsdf99889’. No real email coming in should ever have that value in the mail, so that will essentially match all your new mail.

Seems kinda silly, but it works! Here’s a screenshot:

gmail

Hope that helps!

 

We just got a new server on HostGator, and upon accessing some php files we had uploaded, we got this error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@domain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I looked at the server logs in /usr/local/apache/logs/error_log to see:

[Mon Mar 25 16:28:50 2013] [error] [client 76.195.176.118] SoftException in Application.cpp:256: File “/home/user1/public_html/folder1/index.php” is writeable by group

[Tue Mar 26 09:05:26 2013] [error] [client 76.195.176.118] SoftException in Application.cpp:601: Directory “/home/user1/public_html/folder1″ is writeable by group

Turns out, this error can be caused by suEXEC, a security feature that checks permissions of files before running them to make sure there are no vulnerabilities. You can turn it off in WHM under the Service Configuration area, “Configure PHP and suEXEC”

To fix this error:

Run these 2 commands. This will adjust the permissions of php files and directories if they had been set incorrectly.

find . -name ‘*.php’ | xargs chmod 644
find . -type d | xargs chmod 755

To prevent this error:

To stop this from ever happening in the future, you have to adjust the umask of the user. Umask sets the default permissions on any new files. Just type ‘umask 0022’ at the command line while you’re that user. HostGator originally has it set at 0002.

Good luck, let me know if that fixes your problem!

 

Just bought some tickets for the Dave Matthews Band concert coming up at Sleep Train Amphitheatre (formerly Cricket Wireless Amphitheater) in San Diego / Chula Vista, CA. I let Ticketmaster / LiveNation pick the best seats for me, and they chose Row 1W. Where is that?

After looking at all of the seating charts, I finally found one on a reseller site that shows where row 1W is – it’s before the first row in each section. Technically it’s: “ADA seating. These tickets allow for wheelchair access if needed. Chairs are provided for non-wheelchair customers.”

So it looks like they’re better than front row seats! Hopefully they’ll be roomier too!

Enjoy your event!

 

That google trusted store badge looks pretty awesome, and I’m sure it’s a way to convert more visitors into customers. I thought it was just a matter of providing some documentation about your business’s policies and promising to have good support, but no – there are minimum eligibility requirements. At the time of this post, you must meet the following:

  • Minimum Order Volume: 500 orders/month on a rolling 28-day basis
  • Trackable Orders: >50% of orders trackable via supported carriers (UPS, FedEx, USPS)
  • On-Time Shipping: >90% of orders shipped on time
  • Consistently excellent service and very high customer satisfaction with end-to-end experience – few customer escalations, fast issue resolution

If you meet that then getting the badge is just a matter of signing up at http://www.google.com/trustedstores/. Good luck!

© 2012 ShaneLabs Suffusion theme by Sayontan Sinha