Global Strategic Management scam from Hong Kong

February 27th, 2013 6 comments

Somehow, I have gotten on to the list of potential suckers to be scammed by fraudulent investment firms based in Hong Kong. I have now received offers from a few of these companies, the latest from Global Strategic Management. It usually starts with a friendly phone call from an offshore investment firm that can guarantee large (40%+) gains that are tax free. Their pitch is that since I am not an American citizen, and they are investing from Hong Kong in the US market, I would not have to pay taxes. He also claimed to have inside information about the companies they pitch to invest in.

This latest pitch from Global Strategic Management would like me to believe that Cirrus Logic (NASDAQ:CRUS) just finalized a new deal with Apple that will cause their share price to rise over the next 120 days. They also want me to believe that this would be a legal way to make a profit tax free. When asked why I would trust a random stranger that calls me up enough to invest with him $10,000, he pointed me to his ‘company’s’ website www.globalstrategicmanagement.com. After looking up info on their domain, I asked him why his server was sitting in Panama. He told me that the in today’s internet age it doesn’t matter where their servers are. I told him that a reputable company would want to make sure that their servers were in a secure data center with as close to 100% up-time as possible. Somewhere in Panama sounds like a bad choice. What proved to me that this company was a sham was looking up their website on the internet archive (he told me they have been around with the same web address since ’95) – not according to the internet archive (wayback machine)

Please, if you are tempted to invest in a HK firm, just don’t do it.

Categories: General Tags:

C# – This application has failed to start because the application configuration is incorrect

February 19th, 2010 3 comments

A weird thing happened to me yesterday. A C# windows application I had been working on for the last several days, just stopped working. Wednesday I was able to run the application but on Thursday I was just receiving this error message:

Error while trying to run project: Unable to start program ‘C:\projects\projectname\Debug\ITSUtil.exe’.

This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log.

So I checked the event logs and sure enough I found in the system log SideBySide events:

  1. Syntax error in manifest or policy file (Path to file)
  2. The application failed to launch because of an invalid manifest.
  3. Generate Activation Context failed for C:\projects\projectname\Debug\projectname.exe. Reference error message: The operation completed successfully.

So I looked at the App.config and was unable find any issues with the file. What finally worked was removing the namespace from the configuration element.  I changed:

<configuration xmlns="http://schemas.
                          microsoft.com/.NetConfiguration/v2.0">

to

<configuration>

I’m not what changed on my computer other than maybe some windows updates,  but this got it working….

Categories: General Tags:

Using the Sharepoint content database for Reporting

October 1st, 2009 No comments

I just wanted to post a quick follow up to my posting from last year. The method I described is meant to work on data with item level permissions. If you are not using permissions on your sharepoint site, you should check out SLAM!.

If your lists contain mixed items – some that inherit permissions from the list and some that have their own permissions you should change the view v_hlpr_listname to include records that don’t have corresponding records in the scope table (these are the records that don’t have item level permissions); Join these records with the lists’ scope record:

inner join Content_Database.dbo.perms on userdata.tp_DirName = perms.scopeurl

Here is what the view would look like (the additional part is from the “Union” and on).

ALTER VIEW [dbo].[v_hlpr_listname]
AS
SELECT DISTINCT SP_UserPrincipals.username, ud.tp_ID [ID]
FROM Content_Database.dbo.userdata ud WITH (nolock)
INNER JOIN Content_Database.dbo.perms WITH (nolock) ON ud.tp_DirName + '/' + ud.tp_Leafname = perms.scopeurl
INNER JOIN Content_Database.dbo.RoleAssignment WITH (nolock) ON Perms.siteID = RoleAssignment.siteID AND Perms.scopeID = RoleAssignment.scopeID
INNER JOIN aspnetdb.dbo.SP_UserPrincipals WITH (nolock) ON SP_UserPrincipals.PID = RoleAssignment.principalID
WHERE tp_ListID = 'ffffffff-ffff-ffff-ffff-ffffffffffff'
UNION
SELECT DISTINCT SP_UserPrincipals.username, ud.tp_ID [ID]
FROM Content_Database.dbo.userdata ud WITH (nolock)
INNER JOIN Content_Database.dbo.perms perms2 WITH (nolock) ON ud.tp_DirName = perms2.scopeurl
INNER JOIN Content_Database.dbo.RoleAssignment WITH (nolock) ON Perms2.siteID = RoleAssignment.siteID AND Perms2.scopeID = RoleAssignment.scopeID
INNER JOIN aspnetdb.dbo.SP_UserPrincipals WITH (nolock) ON SP_UserPrincipals.PID = RoleAssignment.principalID
LEFT JOIN Content_Database.dbo.perms perms1 WITH (nolock) ON ud.tp_DirName + '/' + ud.tp_Leafname = perms1.scopeurl
WHERE tp_ListID = 'ffffffff-ffff-ffff-ffff-ffffffffffff' AND perms1.scopeurl IS NULL

If anyone is interested I can modify the SharepointListsToSqlViewsBuilder Application to do this by default for all lists.

Mootools Autocompleter + Jayrock

September 1st, 2009 No comments

I am starting a web application where I am exposing lots of data from SQL Server to the web. I found Mootools and MochaUI as a very fast way to build a slick GUI, and needed an autocomplete plug-in. Sticking with mootools, I am using the Autocompleter, but needed to pass data from sql server to it. Jayrock seemed like a great way to expose my data in a service, but the request.JSON class can’t handle the interaction with jayrock. Here is my Autocompleter.Request.Jayrock class that fills the gap:

/**
 * Autocompleter.Request.Jayrock
 *
 *
 * @version     1.1.2.j1
 *
 * @license     MIT-style license
 * @author      Ezra Auerbach <ezra [at] auerbach.co.il>
 * @copyright   Author
 */

 
Autocompleter.Request.Jayrock = new Class({

    Extends: Autocompleter,

    options: {/*
                    indicator: null,
                    indicatorClass: null,
                    onRequest: $empty,
                    onComplete: $empty,*/

        ajaxOptions: {}
    },

    query: function() {
        var indicator = $(this.options.indicator);
        if (indicator) indicator.setStyle('display', '');
        var cls = this.options.indicatorClass;
        if (cls) this.element.addClass(cls);
        this.jrService(this.queryValue, function(response) { // call jayrock service asynchronously, or return run this function
            var indicator = $(this.options.indicator);
            if (indicator) indicator.setStyle('display', 'none');
            var cls = this.options.indicatorClass;
            if (cls) this.element.removeClass(cls);
            this.update(response.result); // pass the results back to the autocompleter
        } .bind(this));
    },

    initialize: function(el, jayrockService, options) {
        this.parent(el, options);
        this.jrService = jayrockService; // jayrock service
        if (this.options.choiceSelect) this.choiceSelect = this.options.choiceSelect.bind(this); // overwrite choiceSelect to handle data
    }
});

Example for usage:

            // Make sure you include your jayrock js files:
            <script type="text/javascript" src="scripts/json.js"></script>
            <script type="text/javascript" src="MyService.ashx?proxy"></script>
           
            // Your html should contain an input control for autocompletion - in this example it is called SearchInput                                

            // This script intializes the autocomplete and should run after the page is loaded:
                       
            // initialize class so that we can call the service
            var s = new MyService();

            // locate the input control
            var inputAutocomplete = $('SearchInput');
           
            // Our instance of the autocomplete
            //          we pass (1) input control, (2) the Jayrock service method, and (3) Autocompleter Options
            new Autocompleter.Request.Jayrock(inputAutocomplete, s.getHillelsByText, {
                'indicatorClass': 'autocompleter-loading',
               
                // Overwrite injectChoice function to specify what to do with the data returned from the service.
                //  For each result returned by the service, this function is called, and should create a new
                //  li element (by default) that contains the html of what is displayed, and the inputValue
                //  that gets inserted into the input box upon selection. Also you can set other variable for other use (IDs,...)
                injectChoice: function(token) {
                    var choice = new Element('li', { 'html': this.markQueryValue(token.fullName + ' (' + token.Alias + ')') }); // items in dropdown
                    choice.inputValue = token.fullName;     // text for input box when item is selected
                    choice.inputIDValue = token.id;         // the ID of the object for use in my web application
                    this.addChoiceEvents(choice).inject(this.choices); // add this element to the dropdown
                },
               
                // Overwrite choiceSelect function to specify custom behavior when item is selected.
                choiceSelect: function(choice) {  // Overwrite function for custom functionality when item is selected
                    if (choice) this.choiceOver(choice);
                    this.setSelection(true);
                    this.queryValue = false;
                    this.hideChoices();

                    // Custom functionality:  Load info sheet on record selected
                    $('PageTitle').set('text', choice.inputValue);
                    LoadedPageID = choice.inputIDValue;
                    MyApplication.LoadRecord(LoadedPageID);
                }
            });
Categories: ASP.NET, Javascript, MooTools Tags:

Subtitles on a video of a powerpoint presentation.

June 18th, 2009 2 comments

Powerpoint is one of those applications that is both loved and hated by IT professionals. It is a really great program, but it leads many users into thinking that it can do everything, and has very few limit.

So there I am at 10pm thinking that I have almost completed a project: The presentation of 100 sildes (some animated and some still) has been turned into video. The narration is in sync to what is being displayed. And I have a subtitle file (.srt) that has been carefully crafted to display subtitles when it is difficult to understand what is being said in the audio.

That is when I discover that even though the subtitles seem to be correct, they are not displaying at the right times. An hour later I discover that all the programs I’ve been using to display the subtitles (vobsub, ffmpeg, various media playes) are not updating the subtitle when the image in the video doesn’t change. It seemed that subtitles are only updated on keyframes! Since the video remains the same for up to 10 seconds at a time, only when the next slide was being displayed, did the subtitle update.

To solve this issue, I re-encoded the video file and forced key frames every 200ms. This bloated my video file, but it fixed my subtitle issues.

An easy way to reencode and force key frames is to use Virtual Dub. It has an option to force key frames in the video compression options. Another way is to use an old divx (v.4x) codec that has this option in the codec settings.

Remember: For still video, subtitles don’t update until image changes or next key frame!

Categories: General Tags:

Nicely page search results

June 18th, 2009 No comments

I have recently created a search web part that fetches records from a database and displays them in a table. I am fetching the results from a SQL Server database using C#, and displaying them in a web page with jquery & ajax. The only part that actually required some effort was paging the results. I found this site here that had a design for paging that I liked. What was missing was which page numbers to show for example when you are on page 25 of 50 pages. Here is what I ended up with:

pagingcontrol

pagingcontrol

I will always display the 1st page, the 5 page numbers around the current page which is usually the 2 pages before the current page, the current page, and the 2 pages after the current page, and the last page.

I am passing to the sever the current page to be displayed and the amount of records on a page. The server will first find out the total number of results, and then generate the top and bottom bars that you see above. The server is returning html that is dumped into a div in the end users browser. I have the page numbers running javascripts when clicked that uses ajax to load the next page of results (see below). Here is the code used to generate this:

int TotalResults=0, page=0, pagesize=20, lastpage=0, a=0,b=0,c=0;

// paginghtml holds html markup of the page numbers displayed in the top and bottom bars
string paginghtml = "<div class=\"pager-left\">";

// This function get the total number of matches for the search
TotalResults = GetTotalResults();

// the request parameters p & s hold the current Page to display and the Size of the page (number of results on a page)
if ((Request["p"] == null) || (Request["p"].ToString() == "")) page = 1;
else Int32.TryParse(Request["p"].ToString(), out page);
if ((Request["s"] == null) || (Request["s"].ToString() == "")) pagesize = 20;
else Int32.TryParse(Request["s"].ToString(), out pagesize);

// Calculate the last page of results
lastpage = ((TotalResults - 1) / pagesize) + 1;

// Make sure that current page is a valid page
if ((page > lastpage) || (page < 1)) page = 1;

// If there is at least 1 page, show page numbers
if (lastpage > 1)
{
  // we display the 5 pages arround the current page.  the first and last of these is a and b.
  a = Math.Max(1, page - 2);
  b = Math.Min(lastpage, page + 2);
  c = 4 - (b - a);
  a = Math.Max(1, a - c);
  b = Math.Min(lastpage, b + c);

  // display the first page numbers
  if (a > 3)
    paginghtml += "<a onclick=\"SearchResultsPage(1)\" href="\">1</a>&nbsp;&nbsp;...&nbsp;&nbsp;";
  else
    for (int i = 1; i < a; i++)
      if (i == page)  // don't display a link to the current page, instead display it bold.
        paginghtml += "<strong>" + i.ToString() + "</strong>  ";
      else paginghtml += "<a href=\"#\" onClick=\"SearchResultsPage(" + i.ToString() + ")\">" + i.ToString() + "</a>&nbsp;&nbsp;";

  // display the bulk of the page numbers (5 numbers around current page)
  for (int i = a; i <= b; i++)
    if (i == page)
      paginghtml += "<strong>" + i.ToString() + "</strong>&nbsp;&nbsp;";
    else
      paginghtml += "<a href=\"#\" onClick=\"SearchResultsPage(" + i.ToString() + ");return false;\">" + i.ToString() + "</a>&nbsp;&nbsp;";

  // display last page numbers
  if (b < (lastpage - 2))
    paginghtml += "...&nbsp;&nbsp;<a href=\"#\"onClick=\"SearchResultsPage(" + lastpage.ToString() + ");return false;\">" + lastpage.ToString() + "</a>&nbsp;&nbsp;";
  else
    for (int i = b + 1; i <= lastpage; i++)
      if (i == page)
        paginghtml += "<strong>" + i.ToString() + "</strong>&nbsp;&nbsp;";
      else paginghtml += "<a href=\"#\" onClick=\"SearchResultsPage(" + i.ToString() + ");return false;\">" + i.ToString() + "</a>&nbsp;&nbsp;";

  // wrap up the page numbers html markup:
  paginghtml += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "</div>";

  // display prev \ next page links
  if (page > 1) paginghtml += "<a href=\"#\"  onClick=\"SearchResultsPage(" + Convert.ToString(page - 1) + ");return false;\">&lt;-Prev</a>&nbsp;&nbsp;";
  if (page < lastpage) paginghtml += "<a href=\"#\"  onClick=\"SearchResultsPage(" + Convert.ToString(page + 1) + ");return false;\">Next-&gt;</a> ";

  // create html for Results per page drop down.
  string pagesizeselect = "<div class=\"pager-right\">Show <select id=\"SelectResultsPerPage\"><option value=\"'">" + pagesize.ToString() + "</option><option     value=\"5\">5</option><option value=\"10\">10</option><option value=\"20\">20</option><option value=\"50\">50</option></select> per page.</div>";

  // write out top bar
  Response.Write("<div class=\"pager-top\">" + paginghtml + pagesizeselect + "</div>");
}
 
 /////////////// . . .  later in the code

// calculate the records being displayed:
int startRecord = ((page - 1) * pagesize) + 1;
int lastRecord = startRecord + pagesize - 1;
if (lastRecord > TotalResults) lastRecord = TotalResults;

// create html for the record count on the bottom bar
string displayrecordcount = "";
if (TotalResults == 0)
   displayrecordcount = "<div class=\"pager-right\">No records found</div>";
else displayrecordcount = "<div class=\"pager-right\">" + startRecord.ToString() + " - " + lastRecord.ToString() + " of " + TotalResults.ToString() + " Total</div>";

// write out bottom bar
Response.Write("<div class=\"pager-bottom\">" + paginghtml + displayrecordcount + "</div>");

The css used by this paging control is based on CSS from fluidproject.org:

.pager-top, .pager-bottom {
    padding: 0.5em;
    background-color: #EEEEEE;
    text-align: center;
}

.pager-left {
    text-align: left;
    float: left;
    display: inline;
}

.pager-right {
    text-align: right;
    float: right;
    display: inline;
    width: 150px;
}

and finally the javascript used to display the results (jquery):

<script type="text/javascript">
   var SearchString, SearchPage, SearchResultsPerPage;
   SearchPage=1; SearchResultsPerPage=10;
   var SearchContacts = function()
    {  
        $("#SearchLoading").toggle();
        $.ajax({
              url: "/myreports/SearchResults.aspx",
              data: "q=" + SearchString + "&p=" + SearchPage + "&s=" + SearchResultsPerPage,
              cache: false,
              success: function(html){
                    $("#SearchResults").html(html);
                    $("#SearchLoading").toggle();
              }
        });
    }

   var SearchResultsPage = function(page)
   {
    SearchPage = page;
    SearchContacts();
   }

   var SearchResultsChange = function()
   {
    ResultsPerPage = $("#SelectResultsPerPage").val();
    SearchPage = parseInt((((SearchPage-1) * SearchResultsPerPage) / ResultsPerPage) + 1);
    SearchResultsPerPage = ResultsPerPage;
    SearchContacts();
   }

</script>

// in the $(document).ready(function(){}) add:
$(document).ready(function() {
$('#searchButton').click(function(){ SearchString=$("#Text1").val(); SearchPage=1; SearchResultsPerPage=10; SearchContacts(); return false; });
});

// to the html add the search button and container to display results.

<input id="searchButton" type="button" value="Search" />  <span id="SearchLoading" class="SearchLoading" style="display:none;"><img src="/_layouts/jquery/loader.gif" alt="" /></span><br /><div id="SearchResults"></div>

It works well. I have only found one small issue so far: In IE the Results per page and total record counts are not displaying in the same line, but wrap to the next line. I will be asking my CSS guru to take a look and will post back when I get this fixed.

Categories: ASP.NET Tags: , , , ,

Open a sharepoint webpart project in Visual Studio with out the Sharepoint Extensions installed

May 27th, 2009 2 comments

I have a bunch of web parts that were created in Visual Studio 2005 on a 32bit server that had the Sharepoint Extensions for Visual Studio installed. When I tried to open the solution on my 64bit Windows 2003 Server, I got the error message:

The project type is not supported by this installation.

To get Visual Studio to open the project, I closed the solution in visual studio. Opened the offending project (the .csproj) file in notepad and removed the line:

<ProjectTypeGuids>{9E5D3E2D-E4E2-418e-8D80-2F0DA9A94F9A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

After removing the ProjectTypeGuids, I was able to modify, compile and deploy my web part with out any difficulties.

Categories: Sharepoint Tags: ,

bigresource.com spam in google search results

May 27th, 2009 3 comments

They have been appearing more and more in my search results and are nothing more that a made for adsense junk keep. There is absolutely nothing of value on their site – they aggregate thousands of random posting together from other sites based on keywords so that it is likely that their pages will appear in results but there is no real content there – only stolen content organized in a most incoherent order that doesn’t at help you find what you are looking for.

If you are also fed up with Bigresource.com in your search results please go here and comment to google that you want this site removed from google!

Report spam results to google: http://www.google.com/contact/spamreport.html

Categories: General Tags:

Cheap web hosting

May 21st, 2009 No comments

I have been asked many times who I use for web hosting, and how much I pay.  I love my web hosting provider.  I am using 1and1 and have the unix developer package.  I host quite a few sites and web applications, but the biggest benefit is that I use it as my online backup drive. I will write about this at a later time, but I am backing up a whole bunch of computers, and it would cost me over twice as much a year to use Mozy, then what I pay for hosting. That said, I did get a price lock when the cost was about half of what it currently costs.

Check it out: 1and1

Categories: General Tags:

Unable to Browse reporting services by Hostname, only by IP Address

May 20th, 2009 2 comments

I was having this issue where I cannot access the report manager website by hostname, only by IP address. When I try to browse to Reporting services or the Report Manager it doesn’t work – I am asked for credentials, and they are not accepted. After 4 tries I get an error “HTTP Error 401.1 – Unauthorized: Access is denied due to invalid credentials. Internet Information Services (IIS)”.

But – If I browse to the IP of the server (172.16.2.120) then everything works as expected. I am asked for credentials, and after typing them in I am logged in and can browse the site.

So, How did I fix this issue?

I logged in to the Reporting Server. Opened a command prompt. Navigated to this folder:

C:\Inetpub\Adminscripts

and ran this command:

cscript adsutil.vbs set w3svc/NTAuthenticationProviders "NTLM"

Also, I found a detailed kb on this issue here as well: http://support.microsoft.com/kb/871179

Categories: General Tags: