Year: 2010
Number of Unanswered Questions With Comment: 31145
Sampled Question List: 100

Id: 5368956
title: Does the JBoss embeddable/modular server still exists?
tags: jboss, ejb-3.0, embeddable
view_count: 146
body:

While following along some examples about EJB 3.0 given in the book "Java Persistence with Hibernate" from 2007 I was told to

Go to http://jboss.com/products/ejb3, download the modular embeddable server

But all I can see there, is a plugin called "JBoss EJB3 Plugin 1.0.19" that contains some jar's. So I'm not sure whether the instructions from 2007 may not be outdated by now, since this plugin is obviously not a server

Basically I guess what I need is some sort of a lightweight embeddable Jboss container. Can you please point me into the right direction? Or should I just go for the standard JBoss AS 6.0 release?

The example itself is about a simply HelloWorld program that takes a string message and writes it out to the database using EJB 3.0, nothing fancy, I'm still a beginner.

thx

Never mind: for the sake of future reference: to find some of the answers visit

https://forum.hibernate.org/viewtopic.php?f=7&t=972608&start=0

comments:

1 : Thanks for the URL


---------------------------------------------------------------------------------------------------------------
Id: 3411770
title: Logged in user, retrieving data from two different tables which have same field names
tags: php, mysql, session
view_count: 398
body:

Im a PHP/MySQL beginner and I really need some help for the following code (I apologize for the length of it, please bear with me!).

I have 3 tables of data in my MSQL database with about 150 users in total.

user: Which has the user name, email, password etc

thismonth_results: has 25 fields of numerical data, all are populated.

previousmonth_results: this is a duplicate table of 'thismonth_results' with different figures, all fields are populated.

(Only the ?user_id? field(primary key) links all of these tables. I will replace thismonth and previousmonth with the actual name of the months when the time comes (this program will only run for one year) but for the sake of this exercise I?ll stick to thismonth/previousmonth.)

What I have setup below is a login code which verifies the user, then if successful, redirects to them to report.php and displays the figures (ie vec_actual, vec_achieved etc) from the ?thismonth_results? table of the database. This is working fine.

What I am trying to do, however, is set up another link within the user?s session which shows figures from the ?previousmonth_results? table instead.

I tried creating a page like this by duplicating and renaming the report.php to report-previous.php and inserting a new query based on the login one, with the 'previousmonth_results' replacing the 'thismonth_results' tables in the code but with no luck.

Any suggestions or changes of approach would be most welcome :)

Thanks in advance

Login code below:

<?php # login.php
 require_once ('./includes/config.inc.php');
 ob_start();
 session_start();
 if (!isset($page_title)) {
 $page_title = 'User Login';
  }
 if (isset($_POST['submitted'])) { // Check if the form has been submitted.
 require_once ('/mydatabase/mysql_connect.php');
  if (!empty($_POST['email'])) {
  $e = escape_data($_POST ['email']);
   } else {
  echo '<p><font color="#be0f34"size="+1"> You forgot to enter your email address!
  </font></p>';
  $e = FALSE;
   }

 if (!empty($_POST['pass'])) {
  $p = escape_data($_POST ['pass']);
  } else {
  $p = FALSE;
  echo '<p><font color="#be0f34"size="+1"> You forgot to enter your password!
  </font></p>';
   }
  if ($e && $p) { // If everything's OK.

   $query = "SELECT user.user_id, user.dealer_code, user.dealer_name, user.dp_firstname, user.dp_surname, thismonth_results.vec_actual, thismonth_results.vec_target, thismonth_results.vec_achieved, thismonth_results.vec_variance, thismonth_results.payout
    FROM user, thismonth_results WHERE (user.email='$e' AND user.pass=SHA('$p')) 
    AND user.user_id = thismonth_results.user_id";
   $result = mysql_query ($query) or trigger_error("Query: $query\n <br />MySQL Error: " . mysql_error());


if (@mysql_num_rows($result) == 1) { // A match was made.

  // Register the values & redirect.
  $row = mysql_fetch_array ($result,MYSQL_NUM);

  mysql_free_result($result);
  mysql_close();

  $_SESSION['payout'] = $row[31];   
  $_SESSION['vec_variance'] = $row[10];
  $_SESSION['vec_achieved'] = $row[9];
  $_SESSION['vec_target'] = $row[8];
  $_SESSION['vec_actual'] = $row[7];
  $_SESSION['dp_surname'] = $row[4];
  $_SESSION['dp_firstname'] = $row[3];
  $_SESSION['dealer_name'] = $row[2];
  $_SESSION['dealer_code'] = $row[1];
  $_SESSION['user_id'] = $row[0];

  $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
  if ((substr($url, -1) == '/') OR(substr($url, -1) == '\\') ) {
    $url = substr ($url, 0, -1); // Chop off the slash.
  }

  $url .= '/report.php';

  ob_end_clean(); // Delete the buffer.
  header("Location: $url");
  exit(); // Quit the script.

  } else { // No match was made.
    echo '<p><font color="#be0f34"size="+1">The password and usernam details are incorrect</font></p>';
  }

   } else {

  echo '<p><font color="#be0f34"size="+1">Please try again.</font></p>';
  }
 mysql_close();

  }
   ?>

         <p>To see your results and payout figures, please log in below:</p>

        <form action="login.php"method="post">
          <fieldset>
          <p><label for="email">Email Address:</label><input type="text" name="email" size="25" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p>
          <p><label for="pass">Password:</label> <input type="password" name="pass" size="25" maxlength="20" /></p>
           <p><div align="center"><input type="submit" name="submit" value="Login" /></div>
          <input type="hidden" name="submitted" value="TRUE" /></p><br />
          </fieldset>
                  </form>     

                  <?php // Flush the buffered output.
                ob_end_flush();?>

Below is the report page code.

           <?php # report.php
           require_once ('./includes/config.inc.php');
           ob_start();
           session_start();
             if (!isset($page_title)) {
             $page_title = 'Report';
               }
           if (!isset($_SESSION['dealer_code'])) {
           $url = 'http://' . $_SERVER['HTTP_HOST']
               . dirname($_SERVER['PHP_SELF']);
              if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
                   $url = substr ($url, 0, -1); // Chop off the slash.
              }
              $url .= '/login.php'; 
           ob_end_clean(); // Delete the buffer.
           header("Location: $url"); 
           exit(); // Quit the script.
           }
           ?>

           <h1>Dealer Report</h1>
           <?php // Welcome the user (by name if they are logged in).
           echo '<span class="tablehead">Dealer:';
           if (isset($_SESSION['dealer_code'])) {
              echo " {$_SESSION['dealer_name']} ";
           }
           echo '</span>';
           ?>
           <br /><br />
           <?php echo " {$_SESSION['dp_firstname']} " . " {$_SESSION['dp_surname']}<br> ";?>
           <?php echo " {$_SESSION['bdm_firstname']} " . " {$_SESSION['bdm_surname']}<br> ";?>
           <?php 
            $myPayout = $_SESSION['payout'];
            echo number_format( $myPayout ); 
            ?>
           <h1>June Figures</h1>    
           <?php echo " {$_SESSION['vec_target']} <br> ";  ?>
           <?php echo " {$_SESSION['vec_actual']} <br> ";  ?>
           <?php echo " {$_SESSION['vec_achieved']} <br> ";  ?>
           <?php echo " {$_SESSION['vec_variance']} <br> ";  ?>
           <?php // Flush the buffered output.
                ob_end_flush();?>
comments:

1 : do you get any errors or anything when you replace thismonth_results with previousmonth_results ?

2 : The error I got was 'undefined index'


---------------------------------------------------------------------------------------------------------------
Id: 6249002
title: UnsatisfiedLinkError in netbeans
tags: java, netbeans, path
view_count: 113
body:

I know, this is old question, but anyway.

I use System.loadLibrary("something"); in my code.

File named "something.dll" I placed in the folder libs on C drive. Path to it I set in the PATH. Then just for sure I put this file into Windows/system32 folder. At last, I put it into bin and lib files in jdk.

However, there's still this error. What should I do except for setting java.library.path at a compile time?

comments:

1 : when you start the program, check the value of: `java.library.path`. `System.out.println(System.getProperty("java.library.path "));` wht does it return?

2 : And try another thing (just for test) instead using `loadLibrary()` use `System.load()`

3 : it displays all files declared in path and system32 folder and "."

4 : with absolute path it also doesn't work

5 : Does you DLL depend on another DLL?

6 : no, it works fine on one machine, but doesn't work on another althought I set the same path

7 : with `loadLibrary()` you are loading the JNI wrapper. the library that the JNI wrapper uses has to be on the path too

8 : you don't hear me, there's only one dll library. loadLibrary works fine on one machine when I set a path to it in the PATH envvar, but with the same procedure it doesn't work on another machine and the question is why?

9 : Are they the same operating systems (i.e.32bit vs 64bit) and are they running the same JDK or JRE?

10 : yes, they are absolutely the same laptops with the same operating system. and yes, versions of jdk and jre are the same too. i have no idea


---------------------------------------------------------------------------------------------------------------
Id: 6499722
title: OpenGL-ES not rendering on iPod device
tags: graphics, opengl-es, rendering
view_count: 102
body:

So I'm working on a simple game like app. In it I have an opengl-es scene with some cube objects. On simulator everything works fine, but on device (in this case an ipod touch since that's the only test device I have right now) it only renders one frame and then appears to ignore every opengl call i make after that.

For the sake of not killing memory by allocating and deallocating when I start the app I create my gl view in the background and stop its rendering. When the user clicks a button the glview is brought to the front and its render timer is activated. I've verified that on device it goes through all my render code (just as it does on simulator), however it doesn't update at all on device. In the simulator as it updates the cubes move around, but this isn't graphically represented on the device. I can click on the cubes, and the game recognizes it, so their translation matrices are being updated for sure.

Now here's the kicker, it used to work. When I first started, every time the user would transition to the gl view, it would alloc a new view controller and run it, and it would update. However, from the second time onward the user transitioned to the view it wouldn't update, with the same symptoms it now shows. To counter this I transitioned the app to using only one gl view, and when the user transitions in I just move the boxes back to their starting positions. I thought this would remove the issue since I'm technically always using the first on I alloc'd. However it shows the symptoms all the time. It does render at least once, because I can see the boxes in their starting positions. Even if I change which texture set I'm using though, they're still in the original texture set (though in simulator this works flawlessly).

So, to all the guru's, are there any known issues that would cause openGL-es to stop rendering? What code would be relevant to show you?

comments:

1 : I've managed to get my hands on an iPad and it does not show any abnormal behavior. So far, the odd behavior is only on the iPod.

2 : Update: I've managed to track it down to memory issues. I've noticed that as my app gets close to the memory threshold, if I try to instantiate anything with opengl, it freezes, and any subsequent glveiws suffer the same problems, even though they create their own new graphics context. Anyone know if there's a way to kickstart opengl back up again?


---------------------------------------------------------------------------------------------------------------
Id: 5234774
title: Call validations from ini file
tags: zend-framework, config, zend-controller
view_count: 24
body:

Hii...

How do I call validations from ini file added in configs for a particular zend module. Thanx in advance.

comments:

1 : i add zend-framework tag to get bigger auditory for this question

2 : exact duplicate of http://stackoverflow.com/questions/5221268/add-validations-to-a-zend-form-using-ini-file


---------------------------------------------------------------------------------------------------------------
Id: 5367473
title: Android 3.0 Starter Pack - XML Verification Error
tags: android
view_count: 437
body:

I have recently downloaded the SDK starter pack 'android-sdk_r10-windows' for Android development. I have Windows Vista OS. But now when I am starting the SDK Manager to install the Platform tools i am getting the below erorrs -


XML verification failed for https://dl-ssl.google.com/android/repository/repository.xml. Line -?:-?, Error: org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .

XML verification failed for https://dl-ssl.google.com/android/repository/addons_list.xml.

Line -?:-?, Error: org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .

I also tried the Force settings in Settings -> Misc, but it too didn't help.

Can someone throw some pointers. I am a bit stuck as I have downloaded the Starter pack and not able to figure out what could be wrong.

Thanks in advance.

comments:

1 : no pointers from anyone ... no one else faced this issue with the Android 3.0 starter pack?

2 : finally i was able to resolve the issue :).


---------------------------------------------------------------------------------------------------------------
Id: 3526789
title: jQueryUI Tooltip + JSON problems
tags: jquery, jquery-ui, tooltip
view_count: 232
body:

Good Day,

I'm having problems implementing jQueryUI Tooltip.

Here's my code:

$("input.tooltip").tooltip({ 
    content: function(response) {
        $.getJSON('tooltipcontent.json', function(data) {
            response($.map(data, function(item) { return item.foo; } ))
        });
                    return 'tooltip content';
    }
});

What I'm going to do? I'm going to create json document with text for all input's tooltips. I'm stuck cause tooltip is...empty.

Any ideas?

Tom.

comments:

1 : If you alert `data` what do you get?

2 : Hi Nick! If I `alert(item.foo);` it displays what it should. Have no idea.

3 : @Tom - What does `$.each(data, function(item) { response(item.foo); } );` result in?

4 : @Nick - When I alert, it returns "undefined".

5 : @Nick - I edited my question, when I put`return 'tooltip content';` tooltip works. Weird.

6 : @Tom - Which version of jQuery UI are you using? 1.9m1, m2? Directly returning data follows a different code path than the ajax version, which expect to call `show(e, t, response)`, response being the content

7 : jQuery UI? 1.8.4. I just downloaded tooltip js and css files ;-)

8 : So to be clear, `$.each(data, function(item) { response(item.foo); } );` didn't show a tooltip? but doing `alert()` instead of `response()` there does alert the correct text?

9 : IF I'm not wrong...then yes. Sorry, it's quite late here and I'm sitting with this for over two hours...

10 : @Tom - Try it real quick...the `$.each(data, function(item) { response(item.foo); } );` *should* be working if the alert of `alert(item.foo)` is the tooltip you want.

11 : I see, maybe I was placing it in wrong place? Where should I?

12 : @Tom - Like this overall: `$.getJSON('tooltipcontent.json', function(data) { $.each(data, function(item) { response(item.foo); } ); });`


---------------------------------------------------------------------------------------------------------------
Id: 5940336
title: PDF parsing example Project
tags: ruby, language-agnostic, pdf-parsing
view_count: 323
body:

I'm looking for an example of parsing PDF in some language, it could be in any language

I tried to implement this with Ruby and docsplit gem, but it uses an external tool to extract the text, and there are problems with number references, and you have to parse the text file according to the regular expressions.

I want to parse some papers in PDF format, to extract its title, keywords, authors, authors' mails, institutions, etc.

I'm looking for some experienced Ruby developer with a better way to do this without parsing a textfile through regular expressions.

comments:

1 : http://stackoverflow.com/questions/773193/ruby-reading-pdf-files

2 : Now this is a BIG question :)


---------------------------------------------------------------------------------------------------------------
Id: 5858072
title: how to show user name and its status on the map by clicking
tags: android
view_count: 208
body:

I am trying to fetch data of the user on the particular social network. it displays the users who are registered user of that site. I want to show the User name and show its status by clicking on that user on the map. here showing the code as below:

MyMapViewActivity.java


import java.util.ArrayList;
import java.util.List;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class MyMapViewActivity extends MapActivity {
    FriendsBean fBean;
    double lat;
    double longi;
    MapView mapview;
    String strUrl;
    XmlParser parser;
    ArrayList<Object> result;
    List mapOverlays;
    GeoPoint gp;
    OverlayItem overlayitem;
    Drawable drawable;
    HelloItemizedOverlay itemizedoverlay;
    @Override
    @SuppressWarnings("unchecked")
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapviewactivity);
        mapview = (MapView) findViewById(R.id.mapView);
        mapview.setBuiltInZoomControls(true);
        mapOverlays = mapview.getOverlays();
        strUrl = "http://192.168.5.10/ijoomer_development/index.php?option=com_ijoomer&plg_name=jomsocial&pview=friend&ptask=all_friend_paging&userid="+ConstantData.user_id+"&pageno="+ 5 +"&limit=5&sessionid="+ ConstantData.session_id +"@&tmpl=component";
        parser = new XmlParser(strUrl, new FriendsBean());
        result = parser.ParseUrl("data","member");
        for(int i=0; i<result.size(); i++)
        {
        fBean = (FriendsBean)result.get(i); 
        drawable = this.getResources().getDrawable(R.drawable.friend);
        itemizedoverlay = new HelloItemizedOverlay(drawable);
        lat = Double.parseDouble(fBean.latitude) ;
        longi = Double.parseDouble(fBean.longitude);
        gp = new GeoPoint((int)(lat * 1E6), (int)(longi * 1E6));
        mapview.getController().setCenter(gp);
        mapview.getController().setZoom(17);
        drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
                drawable.getIntrinsicHeight()); 
        overlayitem = new OverlayItem(gp, fBean.name,fBean.status);
        itemizedoverlay.addOverlay(overlayitem);
        mapOverlays.add(itemizedoverlay);
        }

    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

    public boolean onKeyDown(int keyCode, KeyEvent event) 
    {
    MapController mc = mapview.getController(); 
    switch (keyCode) 
    {
    case KeyEvent.KEYCODE_3:
    mc.zoomIn();
    break;
    case KeyEvent.KEYCODE_1:
    mc.zoomOut();
    break;
    }
    return super.onKeyDown(keyCode, event);
    }

}

HelloItemizedOverlay.java

import java.util.ArrayList;
import java.util.List;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class HelloItemizedOverlay extends ItemizedOverlay {
    FriendsBean fBean;
    double lat;
    double longi;
    private List items = new ArrayList();
    private static Drawable marker = null;
    GeoPoint gp;

    //private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
    Context mContext;
    MyMapViewActivity mviewacti = new MyMapViewActivity(); 

    public HelloItemizedOverlay(Drawable defaultMarker) {
        super(marker);
        this.marker= marker;
        lat = Double.parseDouble(fBean.latitude) ;
        longi = Double.parseDouble(fBean.longitude);
        items.add(new OverlayItem(getPoint
                ((int)(lat * 1E6), (int)(longi * 1E6)),
                    fBean.name, fBean.status));

} private GeoPoint getPoint(double d, double e) { // TODO Auto-generated method stub return null; } public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(defaultMarker); mContext = context; }

    public void addOverlay(OverlayItem overlay) {
        mOverlays.add(overlay);
        populate();
    }

    @Override
    protected OverlayItem createItem(int i) {
        return mOverlays.get(i);
    }

    @Override
    protected boolean onTap(int index)
    {   Log.i("OnTap", ""+index);
        Toast.makeText(mContext, "you are here"+index , Toast.LENGTH_SHORT ).show();
        return true;
    }
    @Override
    public int size() {
        return mOverlays.size();
    }

}

comments:

1 : Next time, try to post **ONLY** the relevant part of your code, instead of dumbing its full source.

2 : Is there a question? You should ask a specific question: http://stackoverflow.com/faq


---------------------------------------------------------------------------------------------------------------
Id: 3439162
title: how to delete the video file which is in red5 server?
tags: asp.net
view_count: 194
body:

in my application i want to delete the video file which is in red5 server how can i delete, this is my code.

FileInfo fil = new FileInfo("C:\\Program Files\\Red5\\webapps\\oflaDem\\stream\\" + videofil);
           fil.Delete();

but it is showing error ....

Could not find a part of the path 'C:\Program Files\Red5\webapps\oflaDem\stream\audio1270546990281'.

comments:

1 : Are you sure that the file exists and you have enough rights on the folder ?

2 : Have you browsed the folder to make sure the file is actually there?

3 : ya it is working fine thank you for reponse @Zied and @Alexandr


---------------------------------------------------------------------------------------------------------------
Id: 6308549
title: VB Autologin to Java site
tags: vb.net
view_count: 71
body:

Hi i have a code works fine about autologin to a website like this

Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
  For Each curElement As HtmlElement In theElementCollection

   Dim controlName As String = curElement.GetAttribute("id").ToString

   If controlName = "usernameLogin" Then
    curElement.SetAttribute("Value", username)
   ElseIf controlName = "Passwordlogin" Then


curElement.SetAttribute("Value", password)

The code works fine unless password section because there is no value ="" in password section in the html source code like

  <label for="passwordLogin">Password:</label>
                    <div class="black-border">
   <input type="password" onKeyDown="hideLoginErrorBox();" class="validate[required,pwLength[8,20]]" id="passwordLogin" name="pass" maxlength="20" />

as you can see no value="" in password so i couldnt put the pass to neccesery field

username is works fine so what sould i do

Thanks

Best regards.....Mike

comments:

1 : Sure the problem is not that its id is passwordLogin but you look for loginPassword ?

2 : yes sir i wrote that wrong sorry i just fixed that must be passwordLogin but the problem is where is the value="" to put value for autologin there is no value or i dont know where to put


---------------------------------------------------------------------------------------------------------------
Id: 4170977
title: DNS A Record Name Madness: How to add an A Record in cpanel pointing to Zerigo DNS
tags: hosting, dns, heroku, cpanel, dreamhost
view_count: 489
body:

I am using Heroku and the custom domain add on with Zerigo. I've done this several times with Dreamhost. Changing the name servers was really easy but now I need to change it with cpannel and I am lost.

When I registered domains with Dreamhost all I had to do was to point them to Zerigo by adding those four name servers below. I didn't need to provide anything else.

alt text

And this is what Dreamhost automatically created or are the original settings that no longer apply. I'm really not sure.

alt text

So now I'm tyring to do the same thing with cpannel, but it requires the Zerigo name and address.

alt text

Again all of this is just confusing to me and conceptional I don't know what's going on. I understand A name connects it to the human name but why do I need to provide this with cpannel but didn't have to provide this with Dreamhost.

This is what Zerigo is complaining about and I understand because I haven't changed the name servers I'm just not sure which ones to use and how to match them with what cpannel requries.

alt text

comments:

1 : This belongs on http://webmasters.stackexchange.com

2 : yeah, I wasn't sure which one to put it on.

3 : IMO this is a support question that belongs with Heroku and Zerigo -- both commercial entities.


---------------------------------------------------------------------------------------------------------------
Id: 6055799
title: Twitter Authentication gives 'incorrect signature' using DotNetOpenauth
tags: twitter, oauth, dotnetopenauth
view_count: 322
body:

I'm using dotnetopenauth in combination with a WCF service to request access tokens. The following steps are no problem:

  1. Directing user to Twitter's 'Allow Access' page.
  2. Redirection from Twitter to my callback Url and storing the RequestToken and Secret.
  3. Exchanging RequestToken and Secrect for an AccessToken and Secret.

The problem occurs when I try to do a request (getting the user's favorites) on the users behalf. I get a 401 response, with the message 'Incorrect Signature'.

It's obvious the signature is the problem, but I don't know why it's an incorrect signature because it get's generated by the dotnetopenauth library. I even checked the basestring, and that looks fine. So Some parameters must be wrong or something.

Could it be the problem is the domain from where the request is done. I'm currently behind a proxy (but added the proxy's ip to the allowed domains list in my app) ?

Edit: Added LOGS:

The user get's redirected from the application to the Twitter Auth page, and then get's redirected to my app with the request token and verifier. Then I exchange those for anaccesToken and Secret. But when using thos to perform a request I get the error 'incorrect signature'.

2011-05-19 17:32:57,815 [8] INFO  DotNetOpenAuth [(null)] - DotNetOpenAuth, Version=3.4.7.11121, Culture=neutral, PublicKeyToken=2780ccd10d57b246 (official)
2011-05-19 17:32:57,849 [8] INFO  DotNetOpenAuth [(null)] - Reporting will use isolated storage with scope: User, Domain, Assembly
2011-05-19 17:32:57,900 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Preparing to send UnauthorizedTokenRequest (1.0.1) message.
2011-05-19 17:32:57,901 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.OAuthHttpMethodBindingElement applied to message.
2011-05-19 17:32:57,904 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement applied to message.
2011-05-19 17:32:57,905 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement applied to message.
2011-05-19 17:32:57,907 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Applying secrets to message to prepare for signing or signature verification.
2011-05-19 17:32:57,908 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Signing UnauthorizedTokenRequest message using HMAC-SHA1.
2011-05-19 17:32:57,923 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Constructed signature base string: GET&http%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%253A%252F%252Ftest%252FsocialApi.svc%252FOauth2%253FsessionToken%253D%26oauth_consumer_key%3DLP0drhz9ry2F5f4lt0HCwg%26oauth_nonce%3D0Rq1Uatx%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1305819177%26oauth_version%3D1.0
2011-05-19 17:32:57,923 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.SigningBindingElementChain applied to message.
2011-05-19 17:32:57,930 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Prepared outgoing UnauthorizedTokenRequest (1.0.1) message for http://api.twitter.com/oauth/request_token: 
    oauth_callback: http://test/socialApi.svc/Oauth2?sessionToken=
    oauth_consumer_key: LP0drhz9ry2F5f4lt0HCwg
    oauth_nonce: 0Rq1Uatx
    oauth_signature_method: HMAC-SHA1
    oauth_signature: AegT69ULyJBbh/sM4XtFO69J5as=
    oauth_version: 1.0
    oauth_timestamp: 1305819177

2011-05-19 17:32:57,933 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Sending UnauthorizedTokenRequest request.
2011-05-19 17:32:57,945 [8] DEBUG DotNetOpenAuth.Http [(null)] - HTTP GET http://api.twitter.com/oauth/request_token
2011-05-19 17:32:59,317 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Received UnauthorizedTokenResponse response.
2011-05-19 17:32:59,320 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Processing incoming UnauthorizedTokenResponse (1.0.1) message:
    oauth_token: 0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo
    oauth_token_secret: EmxJ9VeAPUuaofGToOOoO37nGlKqA8feYARBsUseI
    oauth_callback_confirmed: true

2011-05-19 17:32:59,323 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.SigningBindingElementChain did not apply to message.
2011-05-19 17:32:59,324 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did not apply to message.
2011-05-19 17:32:59,326 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement did not apply to message.
2011-05-19 17:32:59,326 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.OAuthHttpMethodBindingElement did not apply to message.
2011-05-19 17:32:59,326 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - After binding element processing, the received UnauthorizedTokenResponse (1.0.1) message is: 
    oauth_token: 0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo
    oauth_token_secret: EmxJ9VeAPUuaofGToOOoO37nGlKqA8feYARBsUseI
    oauth_callback_confirmed: true

2011-05-19 17:32:59,329 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Preparing to send UserAuthorizationRequest (1.0.1) message.
2011-05-19 17:32:59,329 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.OAuthHttpMethodBindingElement did not apply to message.
2011-05-19 17:32:59,329 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement did not apply to message.
2011-05-19 17:32:59,329 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did not apply to message.
2011-05-19 17:32:59,329 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.SigningBindingElementChain did not apply to message.
2011-05-19 17:32:59,329 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Prepared outgoing UserAuthorizationRequest (1.0.1) message for http://api.twitter.com/oauth/authorize: 
    oauth_token: 0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo

2011-05-19 17:32:59,329 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Sending message: UserAuthorizationRequest
2011-05-19 17:32:59,335 [8] DEBUG DotNetOpenAuth.Http [(null)] - Redirecting to http://api.twitter.com/oauth/authorize?oauth_token=0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo
2011-05-19 17:32:59,340 [8] DEBUG socialApi.socialApi [(null)] - TWITTERLOG: DotNetOpenAuth.OAuth.WebConsumer
[Footer]
[Header]
2011-05-19 17:33:01,567 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Scanning incoming request for messages: http://test/socialApi.svc/Oauth2?sessionToken=&oauth_token=0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo&oauth_verifier=tRYmE40kQYOwR9U0kmSMKn1fdIHKN1xVGAa43jbWp3M
2011-05-19 17:33:01,574 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Incoming request received: UserAuthorizationResponse
2011-05-19 17:33:01,574 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Processing incoming UserAuthorizationResponse (1.0.1) message:
    oauth_verifier: tRYmE40kQYOwR9U0kmSMKn1fdIHKN1xVGAa43jbWp3M
    oauth_token: 0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo
    sessionToken: 

2011-05-19 17:33:01,574 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.SigningBindingElementChain did not apply to message.
2011-05-19 17:33:01,574 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did not apply to message.
2011-05-19 17:33:01,574 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement did not apply to message.
2011-05-19 17:33:01,575 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.OAuthHttpMethodBindingElement did not apply to message.
2011-05-19 17:33:01,575 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - After binding element processing, the received UserAuthorizationResponse (1.0.1) message is: 
    oauth_verifier: tRYmE40kQYOwR9U0kmSMKn1fdIHKN1xVGAa43jbWp3M
    oauth_token: 0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo
    sessionToken: 

2011-05-19 17:33:01,576 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Preparing to send AuthorizedTokenRequest (1.0.1) message.
2011-05-19 17:33:01,576 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.OAuthHttpMethodBindingElement applied to message.
2011-05-19 17:33:01,576 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement applied to message.
2011-05-19 17:33:01,576 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement applied to message.
2011-05-19 17:33:01,576 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Applying secrets to message to prepare for signing or signature verification.
2011-05-19 17:33:01,576 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Signing AuthorizedTokenRequest message using HMAC-SHA1.
2011-05-19 17:33:01,578 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Constructed signature base string: GET&http%3A%2F%2Fapi.twitter.com%2Foauth%2Faccess_token&oauth_consumer_key%3DLP0drhz9ry2F5f4lt0HCwg%26oauth_nonce%3DShyS8gWa%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1305819181%26oauth_token%3D0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo%26oauth_verifier%3DtRYmE40kQYOwR9U0kmSMKn1fdIHKN1xVGAa43jbWp3M%26oauth_version%3D1.0
2011-05-19 17:33:01,578 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.SigningBindingElementChain applied to message.
2011-05-19 17:33:01,578 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Prepared outgoing AuthorizedTokenRequest (1.0.1) message for http://api.twitter.com/oauth/access_token: 
    oauth_verifier: tRYmE40kQYOwR9U0kmSMKn1fdIHKN1xVGAa43jbWp3M
    oauth_token: 0tTPF0N8Z0R3zFpnfHAfFAU6TFgrbD8ttYLjakbRo
    oauth_consumer_key: LP0drhz9ry2F5f4lt0HCwg
    oauth_nonce: ShyS8gWa
    oauth_signature_method: HMAC-SHA1
    oauth_signature: g4OTXcaVAi8D3x4MHtGzDAbHE+U=
    oauth_version: 1.0
    oauth_timestamp: 1305819181

2011-05-19 17:33:01,578 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Sending AuthorizedTokenRequest request.
2011-05-19 17:33:01,579 [8] DEBUG DotNetOpenAuth.Http [(null)] - HTTP GET http://api.twitter.com/oauth/access_token
2011-05-19 17:33:01,935 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Received AuthorizedTokenResponse response.
2011-05-19 17:33:01,935 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Processing incoming AuthorizedTokenResponse (1.0.1) message:
    oauth_token: 300285844-uc1Yfu8a6rxjivWWIWyPVdq8UQILlYohwC3ChihE
    oauth_token_secret: 3fHEPHp5faATgk82WuS80RJba3HsFUrFoQ0VGyxC1I
    user_id: 300285844
    screen_name: TesterTest3

2011-05-19 17:33:01,935 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.SigningBindingElementChain did not apply to message.
2011-05-19 17:33:01,935 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement did not apply to message.
2011-05-19 17:33:01,935 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement did not apply to message.
2011-05-19 17:33:01,935 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.OAuthHttpMethodBindingElement did not apply to message.
2011-05-19 17:33:01,935 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - After binding element processing, the received AuthorizedTokenResponse (1.0.1) message is: 
    oauth_token: 300285844-uc1Yfu8a6rxjivWWIWyPVdq8UQILlYohwC3ChihE
    oauth_token_secret: 3fHEPHp5faATgk82WuS80RJba3HsFUrFoQ0VGyxC1I
    user_id: 300285844
    screen_name: TesterTest3

2011-05-19 17:33:01,937 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Preparing to send AccessProtectedResourceRequest (1.0.1) message.
2011-05-19 17:33:01,937 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.OAuthHttpMethodBindingElement applied to message.
2011-05-19 17:33:01,937 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardReplayProtectionBindingElement applied to message.
2011-05-19 17:33:01,937 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.Messaging.Bindings.StandardExpirationBindingElement applied to message.
2011-05-19 17:33:01,937 [8] DEBUG DotNetOpenAuth.Messaging.Channel [(null)] - Applying secrets to message to prepare for signing or signature verification.
2011-05-19 17:33:01,937 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Signing AccessProtectedResourceRequest message using HMAC-SHA1.
2011-05-19 17:33:01,939 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Constructed signature base string: GET&http%3A%2F%2Fapi.twitter.com%2Fstatuses%2Ffriends_timeline.xml&oauth_consumer_key%3DLP0drhz9ry2F5f4lt0HCwg%26oauth_nonce%3DAOP0gDJR%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1305819181%26oauth_token%3D300285844-uc1Yfu8a6rxjivWWIWyPVdq8UQILlYohwC3ChihE%26oauth_version%3D1.0
2011-05-19 17:33:01,939 [8] DEBUG DotNetOpenAuth.Messaging.Bindings [(null)] - Binding element DotNetOpenAuth.OAuth.ChannelElements.SigningBindingElementChain applied to message.
2011-05-19 17:33:01,939 [8] INFO  DotNetOpenAuth.Messaging.Channel [(null)] - Prepared outgoing AccessProtectedResourceRequest (1.0.1) message for http://api.twitter.com/statuses/friends_timeline.xml: 
    oauth_token: 300285844-uc1Yfu8a6rxjivWWIWyPVdq8UQILlYohwC3ChihE
    oauth_consumer_key: LP0drhz9ry2F5f4lt0HCwg
    oauth_nonce: AOP0gDJR
    oauth_signature_method: HMAC-SHA1
    oauth_signature: kaYZtw1L2lC6Y/NcayRFyN9cdf0=
    oauth_version: 1.0
    oauth_timestamp: 1305819181

2011-05-19 17:33:01,941 [8] DEBUG DotNetOpenAuth.Http [(null)] - HTTP GET http://api.twitter.com/statuses/friends_timeline.xml?oauth_token=300285844-uc1Yfu8a6rxjivWWIWyPVdq8UQILlYohwC3ChihE&oauth_consumer_key=LP0drhz9ry2F5f4lt0HCwg&oauth_nonce=AOP0gDJR&oauth_signature_method=HMAC-SHA1&oauth_signature=kaYZtw1L2lC6Y/NcayRFyN9cdf0=&oauth_version=1.0&oauth_timestamp=1305819181
2011-05-19 17:33:02,279 [8] ERROR DotNetOpenAuth.Http [(null)] - WebException from http://api.twitter.com/statuses/friends_timeline.xml?oauth_token=300285844-uc1Yfu8a6rxjivWWIWyPVdq8UQILlYohwC3ChihE&oauth_consumer_key=LP0drhz9ry2F5f4lt0HCwg&oauth_nonce=AOP0gDJR&oauth_signature_method=HMAC-SHA1&oauth_signature=kaYZtw1L2lC6Y/NcayRFyN9cdf0=&oauth_version=1.0&oauth_timestamp=1305819181: 
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <request>/statuses/friends_timeline.xml?oauth_token=300285844-uc1Yfu8a6rxjivWWIWyPVdq8UQILlYohwC3ChihE&amp;oauth_consumer_key=LP0drhz9ry2F5f4lt0HCwg&amp;oauth_nonce=AOP0gDJR&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_signature=kaYZtw1L2lC6Y%2FNcayRFyN9cdf0%3D&amp;oauth_version=1.0&amp;oauth_timestamp=1305819181</request>
  <error>Incorrect signature</error>
</hash>
comments:

1 : Can you include the logs (http://tinyurl.com/dnoalogs) from your app that shows the request going out, including the base signature string?

2 : I added the full log (including keys etc. I changed them in my app for security reasons. And the Twitter account is a testing account. But the problem lies not in the domain, I published the application on a own domain and still have the same issues (incorrect signature). Sorry for posting such a huge coding block...


---------------------------------------------------------------------------------------------------------------
Id: 5694888
title: Oracle BPM 11g Organization Unit
tags: java, oracle11g, bpm
view_count: 232
body:

I've been searching for a way to retrieve the Organization Units contained in Oracle BPM 11g in order to get the defined hierarchy.

I've heard of the fuego.fdi package but JDeveloper doesn't look like recognizing it. Checked the IdentityService, but It looks like it can only get users from weblogic and not the hiearchy defined by the organization units.

can anyone point me to the right direction, an example would be great, but just the right API classes would be fine.

Thanks

comments:

1 : i could be wrong but thought that fuego was 10.3

2 : That's what I think, so I've discarted fuego for now


---------------------------------------------------------------------------------------------------------------
Id: 4678068
title: Problem with pagination. Codes included
tags: php, mysql, pagination
view_count: 115
body:

hey guys, the codes work except for one problem. Somehow when i set the number of results to show per page , it'll appear one less. For example, if i set it to 10, only 9 records are shown. I tried looking through but i can't find the error. I'll appreciate if you can help me with this , thanks a lot!

Files uploaded here : http://mcfly1111.blogspot.com/2011/01/pagination_13.html

the exact reason why i didnt paste the codes because it's very messy. Thus, the blog. What do you guys mean by proper indentation?

comments:

1 : I posted the solution on your blog, enjoy...

2 : Could you either put that code on that website into a block that maintains the indentation, or put it directly here with correct indentation?

3 : That's too much code to read through, especially if it's not formatted. At the very least post it here, mark it as code and indent it properly, otherwise you probably won't get any answers. Best, debug it yourself.

4 : Indention means indenting nested parts of the code for better readability. http://en.wikipedia.org/wiki/Indent_style If your source code is not indented, you're doing it wrong. When posting code here, use the `{}` button in the toolbar to mark it as code and it won't be messy.


---------------------------------------------------------------------------------------------------------------
Id: 3955840
title: Android, build music app?
tags: android, android-music-player
view_count: 1885
body:

I want to build MusicPlayer, using source code of standart android music player(projects / platform/packages/apps/Music). I also renamed the package (for no conflict with emulator app)

When I build the project and run it, I have following error: Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED


<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.com.zune_player"
        android:versionCode="1"
        android:versionName="1.0">

    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application android:icon="@drawable/app_music"
        android:label="@string/musicbrowserlabel"
        android:taskAffinity="android.task.music"
        android:allowTaskReparenting="true">
        <activity android:name="com.com.zune_player.MusicBrowserActivity"
            android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.MUSIC_PLAYER" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver android:name="com.com.zune_player.MediaButtonIntentReceiver">
            <intent-filter>
                <action android:name="android.intent.action.MEDIA_BUTTON" />
                <action android:name="android.media.AUDIO_BECOMING_NOISY" />
            </intent-filter>
        </receiver>
        <!-- This is the "current music playing" panel, which has special
             launch behavior.  We clear its task affinity, so it will not
             be associated with the main media task and if launched
             from a notification will not bring the rest of the media app
             to the foreground.  We make it singleTask so that when others
             launch it (such as media) we will launch in to our own task.
             We set clearTaskOnLaunch because the user
             can go to a playlist from this activity, so if they later return
             to it we want it back in its initial state.  We exclude from
             recents since this is accessible through a notification when
             appropriate. -->
        <activity android:name="com.com.zune_player.MediaPlaybackActivity"
                android:theme="@android:style/Theme.NoTitleBar"
                android:label="@string/mediaplaybacklabel"
                android:taskAffinity=""
                android:launchMode="singleTask"
                android:clearTaskOnLaunch="true"
                android:excludeFromRecents="true" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="content"/>
                <data android:scheme="file"/>
                <data android:mimeType="audio/*"/>
                <data android:mimeType="application/ogg"/>
                <data android:mimeType="application/x-ogg"/>
                <data android:mimeType="application/itunes"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.android.music.PLAYBACK_VIEWER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity android:name="com.com.zune_player.StreamStarter"
                android:theme="@android:style/Theme.Dialog" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" />
                <data android:mimeType="audio/mp3"/>
                <data android:mimeType="audio/x-mp3"/>
                <data android:mimeType="audio/mpeg"/>
                <data android:mimeType="audio/mp4"/>
                <data android:mimeType="audio/mp4a-latm"/>
                <data android:mimeType="application/ogg"/>
                <data android:mimeType="application/x-ogg"/>
                <data android:mimeType="audio/ogg"/>
            </intent-filter>
        </activity>
        <activity android:name="com.com.zune_player.ArtistAlbumBrowserActivity">
            <intent-filter>
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/artistalbum"/>
            </intent-filter>
        </activity>
        <activity android:name="com.com.zune_player.AlbumBrowserActivity">
            <intent-filter>
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/album"/>
            </intent-filter>
        </activity>
        <activity android:name="com.com.zune_player.TrackBrowserActivity">
            <intent-filter>
                <action android:name="android.intent.action.EDIT" />
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/track"/>
            </intent-filter>
        </activity>
        <activity android:name="com.com.zune_player.QueryBrowserActivity"
                android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <action android:name="android.intent.action.MEDIA_SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable"
            />
        </activity>
        <activity android:name="com.com.zune_player.PlaylistBrowserActivity"
                android:label="@string/musicbrowserlabel">
            <intent-filter>
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/playlist"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/playlist"/>
            </intent-filter>
        </activity>
        <activity-alias android:name="com.android.music.PlaylistShortcutActivity"
            android:targetActivity="com.android.music.PlaylistBrowserActivity"
            android:label="@string/musicshortcutlabel"
            android:icon="@drawable/ic_launcher_shortcut_music_playlist">

            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity-alias>
        <activity android:name="com.com.zune_player.VideoBrowserActivity"
            android:taskAffinity="android.task.video"
            android:label="@string/videobrowserlabel"
            android:icon="@drawable/app_video">
            <intent-filter>
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/video"/>
            </intent-filter>
<!--
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
-->
        </activity>
        <activity android:name="com.com.zune_player.MediaPickerActivity"
                android:label="@string/mediapickerlabel">
<!--
            <intent-filter>
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="media/*"/>
                <data android:mimeType="audio/*"/>
                <data android:mimeType="application/ogg"/>
                <data android:mimeType="application/x-ogg"/>
                <data android:mimeType="video/*"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.GET_CONTENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="media/*"/>
                <data android:mimeType="audio/*"/>
                <data android:mimeType="application/ogg"/>
                <data android:mimeType="application/x-ogg"/>
                <data android:mimeType="video/*"/>
            </intent-filter>
-->
        </activity>
        <activity android:name="com.com.zune_player.MusicPicker"
                android:label="@string/music_picker_title">
            <!-- First way to invoke us: someone asks to get content of
                 any of the audio types we support. -->
            <intent-filter>
                <action android:name="android.intent.action.GET_CONTENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="audio/*"/>
                <data android:mimeType="application/ogg"/>
                <data android:mimeType="application/x-ogg"/>
            </intent-filter>
            <!-- Second way to invoke us: someone asks to pick an item from
                 some media Uri. -->
            <intent-filter>
                <action android:name="android.intent.action.PICK" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="vnd.android.cursor.dir/audio"/>
            </intent-filter>
        </activity>
        <activity android:name="com.com.zune_player.CreatePlaylist"
            android:theme="@android:style/Theme.Dialog" />
        <activity android:name="com.com.zune_player.RenamePlaylist"
            android:theme="@android:style/Theme.Dialog" />
        <activity android:name="com.com.zune_player.WeekSelector"
            android:theme="@android:style/Theme.Dialog" />
        <activity android:name="com.com.zune_player.DeleteItems"
            android:theme="@android:style/Theme.Dialog" />
        <activity android:name="com.com.zune_player.ScanningProgress"
            android:theme="@android:style/Theme.Dialog" />
        <service android:name="com.com.zune_player.MediaPlaybackService"
            android:exported="true" />

        <receiver android:name="com.com.zune_player.MediaAppWidgetProvider">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_info" />
        </receiver>
    </application>
</manifest>
comments:

1 : How about posting the code of your manifest?


---------------------------------------------------------------------------------------------------------------
Id: 5138495
title: Error using an entity bean
tags: java, java-ee, ejb
view_count: 225
body:

I am getting the following exception when trying to commit data using an entity bean I just created. Any idea what could be wrong here. At first look it seems like some JNDI mapping error but I am still figuring out how to go about debugging/fixing this.

[2/27/11 22:13:02:323 EST] 00000098 storeSam E
com.store.commerce.samples.commands.sampleCreationCmdImplperformExecute() NamingException 
Occured while executing the query
                                 javax.naming.NameNotFoundException:
Context:
WC_TST_cell/nodes/WC_TST_node/servers/server1,
name: ejb/com/store/commerce/samples/SamplesHome: First component
in name samples/SamplesHome not found.
[Root exception is
org.omg.CosNaming.NamingContextPackage.NotFound:
IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
        at com.ibm.ws.naming.jndicos.CNContextImpl.processNotFoundException(CNContextImpl.java:4754)
        at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1911)
        at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1866)
        at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1556)
        at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1358)
        at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
        at javax.naming.InitialContext.lookup(InitialContext.java:363)
        at com.ibm.ivj.ejb.runtime.AbstractAccessBean.lookupAndCacheHome(AbstractAccessBean.java:224)
        at com.ibm.ivj.ejb.runtime.AbstractAccessBean.getGlobalHome(AbstractAccessBean.java:216)
        at com.ibm.ivj.ejb.runtime.AbstractAccessBean.getHome(AbstractAccessBean.java:249)
        at com.store.commerce.samples.SamplesAccessBean.ejbHome(SamplesAccessBean.java:284)
        at com.store.commerce.samples.SamplesAccessBean.instantiateEJB(SamplesAccessBean.java:313)
        at com.ibm.ivj.ejb.runtime.AbstractEntityAccessBean._instantiate(AbstractEntityAccessBean.java:170)
        at com.ibm.ivj.ejb.runtime.AbstractEntityAccessBean.commitCopyHelper(AbstractEntityAccessBean.java:190)
        at com.store.commerce.samples.SamplesAccessBean.commitCopyHelper(SamplesAccessBean.java:368)
        at com.store.commerce.samples.commands.sampleCreationCmdImpl.performExecute(sampleCreationCmdImpl.java:286)
        at com.ibm.commerce.command.ECCommandTarget.executeCommand(ECCommandTarget.java:157)

EDIT 1::

I had the EJB jar generated again and put into the EAR and restarted. However the new beans do not show up in the Websphere Solutions Console EJB JNDI Names section!

comments:

1 : This looks a lot like a JNDI error.

2 : @Srinivas I am not sure which code should i be putting in.

3 : Which implementation of EJB are you using 2.1 or 3 ?


---------------------------------------------------------------------------------------------------------------
Id: 6690035
title: How to convert to .swf in iphone programmatically using Objective C
tags: objective-c, iphone-sdk-4.0, adobe, swf, dashboard
view_count: 190
body:

I would like to convert the ipad dashboard application data to .swf file within the ipad application programatically using Objective C.

Any suggestions regarding the libraries related to conversion to swf files are highly appreciable.

If possible ,could any one suggest the file formats possible to convert to .swf files?

Thanks in advance for all stack overflow legends......

comments:

1 : what do you mean for "ipad dashboard application data"?

2 : lets assume we have data in database or some excel sheets,using them we will generate charts and graphs in ipad dashboard application,now we need a way to convert the data to .swf files,so we need the formats of intermediate files(e.g jpeg) we need to generate which can be converted to .swf files programmatically using objective C


---------------------------------------------------------------------------------------------------------------
Id: 6408130
title: How to get results ofActive Directory Sercher for user exists in multiple domains in C#
tags: c#
view_count: 28
body:

I have parent Domain with two sub domains DomainA and Domain B and i have user in both Domains but after searching it in C# code through Directory Searcher with in parent domain it is giving the results of Domain A only why?

comments:

1 : When you say the user is in both domains, do you actually mean 2 **separate** user objects, with the same CN in each domain?

2 : yes.two seperate user objects in both domains,but in result iam able to get only one result.

3 : So what is `Filter` set to? And `SearchRoot`? Impossible to answer this question with the information provided. Show us teh codez.


---------------------------------------------------------------------------------------------------------------
Id: 4922952
title: xsd command generate unnecessary files
tags: xsd, xsd.exe
view_count: 82
body:

i have a weird bug when trying to generate an h file from xsd file.

in my make file i'm using the following lines:

<Target Name="Generate_XSD_Schema" Condition=" '$(BuildType)' != 'Clean' "
  Inputs="$(SourcesPath)\file.xsd;"
   Outputs="$(SourcesPath)Gen\file.h">
   <Exec Command="xsd $(SourcesPath)file.xsd /c /l:CPP /o:$(SourcesPath)Gen"  ContinueOnError="false" />
</Target>

as u can see my file.xsd is placed in a given a "main" directory, and the output should be placed in a directory named Gen (that is placed in the "main" directory).

now, everything works fine (the h file is generated a excpected) , BUT 3 addition files pop-up in the "main" directory while building my project:

file.dll.manifest , file.dll and file.h (which is empty).

i am using the same code in other placed and i don't get those files.

anyone have any idea why this happens?

comments:

1 : Do you need a \ after `$(SourcesPath)` in the Exec?

2 : no, the $(SourcesPath) includes the "\".


---------------------------------------------------------------------------------------------------------------
Id: 5325993
title: vbscript - move files older than 180days based on modified date keeping the original directory structure
tags: vbscript
view_count: 863
body:

I have this script and ibelow i wrote what i would like...

Dim objFSO, ofolder, objStream

Set objShell = CreateObject("WScript.Shell")

Set objFSO = CreateObject("scripting.filesystemobject")

Set objNet = CreateObject("WScript.NetWork")

Set FSO = CreateObject("Scripting.FileSystemObject")

set outfile = fso.createtextfile("Move-Result.txt",true)

SPath = "c:\temp\"

ShowSubfolders FSO.GetFolder(spath)

Sub ShowSubFolders(Folder)

For Each Subfolder in Folder.SubFolders

CheckFolder(subfolder)

ShowSubFolders Subfolder

Next

End Sub

'CheckFolder(objFSO.getFolder(SPath))

Sub CheckFolder(objCurrentFolder)

Dim strTempL, strTempR, strSearchL, strSearchR, objNewFolder, objFile

Const OverwriteExisting = TRUE

currDate = Date

dtmDate = Date - 180

strTargetDate = ConvDate(dtmDate)

For Each objFile In objCurrentFolder.Files

FileName = objFile

'WScript.Echo FileName

strDate = ConvDate(objFile.DateCreated)

'strDate = ConvDate(objFile.DateLastModified)

If strDate < strTargetDate Then

objFSO.MoveFile FileName, "e:\test\"

outfile.writeline filename

End If

Next

End Sub

Function ConvDate (sDate) 'Converts MM/DD/YYYY HH:MM:SS to string YYYYMMDD

strModifyDay = day(sDate)

If len(strModifyDay) < 2 Then

strModifyDay = "0" & strModifyDay

End If

strModifyMonth = Month(sDate)

If len(strModifyMonth) < 2 Then

strModifyMonth = "0" & strModifyMonth

End If

strModifyYear = Year(sDate)

ConvDate = strModifyYear & strModifyMonth & strModifyDay

End Function

the thing is that i want help to the following:

  1. To check the files in the folders and subfolders of the location c:\temp and based on the MODIFIED DATE to move them to the location e:\test

  2. To keep the same exact directory structure in the new location e:\test

  3. To have the ability to place somewere . to select all files from c:\temp or to put *.xls and to find and move only the .xls files that havents been used for 180 days with the same directory structure to e:\test.

Since i want to deploy this script with GPO i would like to replace the e:\test to an external HDD with the variable of the username. I intent to do this per user.

Any help will be appreciated.

comments:

1 : http://stackoverflow.com/questions/5312178/vb-script-move-files-older-than-180-days-from-modified-date-to-another-director


---------------------------------------------------------------------------------------------------------------
Id: 3855704
title: vimrc error and config python on windows xp
tags: python, ide, vimrc
view_count: 230
body:

I am using XP SP3 and have installed vim 7.3. I was following a how-to I found here in a previous thread on configuring vim for a python editor.

http://www.sontek.net/post/Python-with-a-modular-IDE-%28Vim%29.aspx

I am getting an error when starting gvim that it cannot find python27.dll. This is correct I don't have python 2.7 installed I have python2.6 from activestate and wxpython.

This is the code that causes the error.

python << EOF
import os
import sys
import vim
for p in sys.path:
    if os.path.isdir(p):
        vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
EOF

I have checked in my sys path and found that python26 is there but I cannot see python27.

Second error is ctags. I have installed ctags, started vim and used the :helptags . command and then attempted to link the tags up. I must not be doing it correctly because I have no tags.

C:\Program Files\ctags>ctags -R -f ~/.vim/tags/python.ctags C:/python2.6/
ctags: cannot open tag file : No such file or directory
comments:

1 : If gvim is complaining about `python27.dll`, it means it's actually built against Python 2.7. It won't work with Python 2.6.

2 : So how do I get gvim to work with python 2.6

3 : Answer http://vim.wikia.com/wiki/Build_Python-enabled_Vim_on_Windows_with_MinGW


---------------------------------------------------------------------------------------------------------------
Id: 6830557
title: dynamic imagebutton wrap_content doesn't wrap_content
tags: android, imagebutton
view_count: 263
body:

I've created an android imagebutton with code and add an image source to it. The layoutparams of the imagebutton are wrap_content

`LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
public ImageButton createActionBarItem(int id, int img, String tag){
ImageButton btnImage = new ImageButton(context);
btnImage.setLayoutParams(layoutParams);
btnImage.setImageResource(img);
btnImage.setId(id);
btnImage.setTag(tag);
return btnImage;
}`

The problem I experience is that the imagebackground (even the default background) is smaller than the imageResource Any idea to make the imageButtonBackground stretch so that the drawable fits in?

comments:

1 : where do you store your bitmap ? maybe your device is hdpi and you've put bitmap only into mdpi, or ldpi directory - in this case image will be downscaled

2 : it's only in my hdpi directory and my device is mdpi, don't think that should be the problem because i can clearly see the image go outside of the border of the background I fixed the problem (or at least used a workaround): I know place my imagedrawable in the background of the button and place that in a relativelayout which I give the original background


---------------------------------------------------------------------------------------------------------------
Id: 6394450
title: RGB in image processing in iphone app
tags: iphone, cocoa-touch, image-processing
view_count: 325
body:

I am doing an image processing in mp app. I got the pixel color from image and apply this on image by touching.. My code get the pixel color but it changes the whole image in blue color and apply that blue in image processing. I am stuck in code. But don't know what is going wrong in my code.May you please help me.

My code is:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{
UITouch *touch = [touches anyObject];
CGPoint coordinateTouch = [touch locationInView:[self view]];//where image was tapped

if (value == YES) {
    self.lastColor = [self getPixelColorAtLocation:coordinateTouch]; 
    value =NO;
}

NSLog(@"color %@",lastColor);
//[pickedColorDelegate pickedColor:(UIColor*)self.lastColor];



ListPoint point;
point.x = coordinateTouch.x;
point.y = coordinateTouch.y;

button = [UIButton buttonWithType:UIButtonTypeCustom];
button.backgroundColor = [UIColor whiteColor];
button.frame = CGRectMake(coordinateTouch.x-5, coordinateTouch.y-5, 2, 2);
//[descImageView addSubview:button];

[bgImage addSubview:button];

// Make image blurred on ImageView
if(bgImage.image)
{

    CGImageRef imgRef = [[bgImage image] CGImage];
    CFDataRef dataRef = CGDataProviderCopyData(CGImageGetDataProvider(imgRef)); 
    const unsigned char *sourceBytesPtr = CFDataGetBytePtr(dataRef);
    int len = CFDataGetLength(dataRef);
    NSLog(@"length = %d, width = %d, height = %d, bytes per row = %d, bit per pixels = %d", 
          len, CGImageGetWidth(imgRef), CGImageGetHeight(imgRef), CGImageGetBytesPerRow(imgRef), CGImageGetBitsPerPixel(imgRef));

    int width = CGImageGetWidth(imgRef);
    int height = CGImageGetHeight(imgRef);
    int widthstep = CGImageGetBytesPerRow(imgRef);
    unsigned char *pixelData = (unsigned char *)malloc(len);
    double wFrame = bgImage.frame.size.width;
    double hFrame = bgImage.frame.size.height;

    Image_Correction(sourceBytesPtr, pixelData, widthstep, width, height, wFrame, hFrame, point);

    NSLog(@"finish");


    NSData *data = [NSData dataWithBytes:pixelData length:len];

    NSLog(@"1");
    CGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)data);

    NSLog(@"2");
    CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();

    NSLog(@"3");
    CGImageRef imageRef = CGImageCreate(width, height, 8, CGImageGetBitsPerPixel(imgRef), CGImageGetBytesPerRow(imgRef),
                                        colorSpace2,kCGImageAlphaNoneSkipFirst|kCGBitmapByteOrder32Host,
                                        provider, NULL, false, kCGRenderingIntentDefault);

    NSLog(@"Start processing image");
    UIImage *ret = [UIImage imageWithCGImage:imageRef scale:1.0 orientation:UIImageOrientationUp];
    CGImageRelease(imageRef);
    CGDataProviderRelease(provider);
    CGColorSpaceRelease(colorSpace2);
    CFRelease(dataRef);
    free(pixelData);
    NSLog(@"4");
    bgImage.image = ret;
    [button removeFromSuperview];
}   
}




- (UIColor*) getPixelColorAtLocation:(CGPoint)point {


UIColor* color = nil;
CGImageRef inImage = self.image.CGImage;
// Create off screen bitmap context to draw the image into. Format ARGB is 4 bytes for each pixel: Alpa, Red, Green, Blue
CGContextRef cgctx = [self createARGBBitmapContextFromImage:inImage];
if (cgctx == NULL) { return nil; /* error */ }

size_t w = CGImageGetWidth(inImage);
size_t h = CGImageGetHeight(inImage);
CGRect rect = {{0,0},{w,h}}; 

// Draw the image to the bitmap context. Once we draw, the memory 
// allocated for the context for rendering will then contain the 
// raw image data in the specified color space.
CGContextDrawImage(cgctx, rect, inImage); 

// Now we can get a pointer to the image data associated with the bitmap
// context.
unsigned char* data = CGBitmapContextGetData (cgctx);
if (data != NULL) {
    //offset locates the pixel in the data from x,y. 
    //4 for 4 bytes of data per pixel, w is width of one row of data.
    int offset = 4*((w*round(point.y))+round(point.x));
     alpha =  data[offset]; 
     red = data[offset+1]; 
     green = data[offset+2]; 
     blue = data[offset+3]; 
    NSLog(@"offset: %i colors: RGB A %i %i %i  %i",offset,red,green,blue,alpha);
    color = [UIColor colorWithRed:(red/255.0f) green:(green/255.0f) blue:(blue/255.0f) alpha:(alpha/255.0f)];
}

// When finished, release the context
CGContextRelease(cgctx); 
// Free image data memory for the context
if (data) { free(data); }

return color;
}





- (CGContextRef) createARGBBitmapContextFromImage:(CGImageRef) inImage {

CGContextRef    context = NULL;
CGColorSpaceRef colorSpace;
void *          bitmapData;
int             bitmapByteCount;
int             bitmapBytesPerRow;

// Get image width, height. We'll use the entire image.
size_t pixelsWide = CGImageGetWidth(inImage);
size_t pixelsHigh = CGImageGetHeight(inImage);

// Declare the number of bytes per row. Each pixel in the bitmap in this
// example is represented by 4 bytes; 8 bits each of red, green, blue, and
// alpha.
bitmapBytesPerRow   = (pixelsWide * 4);
bitmapByteCount     = (bitmapBytesPerRow * pixelsHigh);

// Use the generic RGB color space.
colorSpace = CGColorSpaceCreateDeviceRGB();

if (colorSpace == NULL)
{
    fprintf(stderr, "Error allocating color space\n");
    return NULL;
}

// Allocate memory for image data. This is the destination in memory
// where any drawing to the bitmap context will be rendered.
bitmapData = malloc( bitmapByteCount );
if (bitmapData == NULL) 
{
    fprintf (stderr, "Memory not allocated!");
    CGColorSpaceRelease( colorSpace );
    return NULL;
}

// Create the bitmap context. We want pre-multiplied ARGB, 8-bits 
// per component. Regardless of what the source image format is 
// (CMYK, Grayscale, and so on) it will be converted over to the format
// specified here by CGBitmapContextCreate.
context = CGBitmapContextCreate (bitmapData,
                                 pixelsWide,
                                 pixelsHigh,
                                 8,      // bits per component
                                 bitmapBytesPerRow,
                                 colorSpace,
                                 kCGImageAlphaPremultipliedFirst);
if (context == NULL)
{
    free (bitmapData);
    fprintf (stderr, "Context not created!");
}

// Make sure and release colorspace before returning
CGColorSpaceRelease( colorSpace );

return context;
}



int Image_Correction(const unsigned char *pImage, unsigned char *rImage, int widthstep, int nW, int nH, double wFrame, double hFrame, ListPoint point)              

{
double ratiox = nW/wFrame;
double ratioy = nH/hFrame;
double newW, newH, ratio;
if(ratioy > ratiox)
{
    newH = hFrame;
    newW = nW/ratioy;
    ratio = ratioy;
}
else 
{
    newH = nH/ratiox;
    newW = wFrame;
    ratio = ratiox;
}
NSLog(@"new H, W = %f, %f", newW, newH);
NSLog(@"ratiox = %f; ratioy = %f", ratiox, ratioy);

ListPoint real_point;
real_point.x = (point.x - wFrame/2 + newW/2) *ratio;
real_point.y = (point.y - hFrame/2 + newH/2)*ratio;

for(int h = 0; h < nH; h++)
{
    for(int k = 0; k < nW; k++)
    {
        rImage[h*widthstep + k*4 + 0] = pImage[h*widthstep + k*4 + 0];
        rImage[h*widthstep + k*4 + 1] = pImage[h*widthstep + k*4 + 1];
        rImage[h*widthstep + k*4 + 2] = pImage[h*widthstep + k*4 + 2];
        rImage[h*widthstep + k*4 + 3] = pImage[h*widthstep + k*4 + 3];
    }
}

// Modify this parameter to change Blurred area
int iBlurredArea = 6;
for(int h = -ratio*iBlurredArea; h <= ratio*iBlurredArea; h++)
    for(int k = -ratio*iBlurredArea; k <= ratio*iBlurredArea; k++)
    {
        int tempx = real_point.x + k;
        int tempy = real_point.y + h;
        if (((tempy - 3) > 0)&&((tempy+3) >0)&&((tempx - 3) > 0)&&((tempx + 3) >0)) 
        {
            double sumR = 0;
            double sumG = 0;
            double sumB = 0;
            double sumA = 0; 
            double count = 0;
            for(int m = -3; m < 4; m++)
                for (int n = -3; n < 4; n++) 
                {                       
                    sumR = red;//sumR + pImage[(tempy + m)*widthstep + (tempx + n)*4 + 0];
                    sumG = green;//sumG + pImage[(tempy + m)*widthstep + (tempx + n)*4 + 1];
                    sumB = blue;//sumB + pImage[(tempy + m)*widthstep + (tempx + n)*4 + 2];
                    sumA = alpha;//sumA + pImage[(tempy + m)*widthstep + (tempx + n)*4 + 3];
                    count++;
                }



            rImage[tempy*widthstep + tempx*4 + 0] = red;//sumR/count;
            rImage[tempy*widthstep + tempx*4 + 1] = green;//sumG/count;
            rImage[tempy*widthstep + tempx*4 + 2] = blue;//sumB/count;
            rImage[tempy*widthstep + tempx*4 + 3] = alpha;//sumA/count;
        }
    }
return 1;
}

Thx for seeing this code.. i think i am doing something wrong. Thx in advance.

comments:

1 : You'll get few responses to such a massive wall of code. If you want to increase your chances of getting an answer, you need to reduce this to a minimal example that demonstrates the problem.

2 : what are you trying to do, and what is the problem?

3 : I want to do that.. but may be something will be miss from code.. then ?

4 : problem is during image processing the whole image turns to blue and never come back in original color...


---------------------------------------------------------------------------------------------------------------
Id: 6869115
title: JRockit Mission Control performing unsolicited garbage collection.
tags: garbage-collection, jconsole, jrockit, mission-control
view_count: 193
body:

I am trying to monitor the meory usage of my application deployed in WebLogic server running on JRockit JVM for Linux.

I am using JConsole and Mission Control to monitor application's memory usage.

After running a load test for 1 hour, I noticed that the heap memory used by JVM is not garbage collected at the end of the test.

However if I use JRockit Mission Control to monitor the same JVM or start Mission Control at the end of the test, the memory is being garbage collected automatically! Mission Control is performing unsolicited GC which is weird and unwarranted.

Now my questions are:

[1] How different is monitoring JRockit JVM using Mission Control compared to monitoring same JVM using JConsole?

[2] Why is Mission Control performing unsolicited GC?

Yours, Chaitanya

comments:

1 : What are your start-up parameters?


---------------------------------------------------------------------------------------------------------------
Id: 5403297
title: karaoke (mpeg) component for delphi 7
tags: delphi
view_count: 101
body:

Possible Duplicate:
karaoke (mpeg) component for delphi 7

thank gamecat,

I mean a component that can play mpeg files or do you want a special karaoke component that filters the voices from the music?

comments:

1 : Possible duplicate of [karaoke (mpeg) component for delphi 7](http://stackoverflow.com/questions/5402237/karaoke-mpeg-component-for-delphi-7)

2 : Welcome to Stackoverflow. You can update your previous question. You should not create a new question for every update


---------------------------------------------------------------------------------------------------------------
Id: 6281999
title: Is there any update on UIAutomation in iOS5?
tags: iphone, ios5, ios-ui-automation, xcode-instruments
view_count: 679
body:

Is there any interesting update in UIAutomation on iOS5 ? Like so many iOS unit testers, I am waiting for Automating test script selection and stopping the script after test run. Any updates on this ?

comments:

1 : iOS 5 is under NDA.

2 : Yes, there are changes, but they are covered by Apple's NDA.


---------------------------------------------------------------------------------------------------------------
Id: 5800194
title: Not getting Lat/Long on Emulator as well as on device
tags: android
view_count: 219
body:

i am done code for getting current lat/long as follow but i always get null from lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); method.

i have tried by 2 ways.

the code is below.

first way,

LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

if(location != null)
{
    lat = location.getLatitude();
    lon = location.getLongitude();
}

and second way,

LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

Log.d("GPS_PROVIDER","GPS_PROVIDER = " + lm.isProviderEnabled(LocationManager.GPS_PROVIDER));
Log.d("NW_PROVIDER","NW_PROVIDER = " + lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER));

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new LocationListenerAdapter()
{
   @Override
   public void onLocationChanged(Location location) 
  {
          if(location != null)
      {
        lat = location.getLatitude();
        lon = location.getLongitude();
      }
  }
});

LocationListenerAdapter class is implements the method of LocationListener interface and i keep all method blank i.e no code written into that methods.

i also use gpx and kml file for emulator to change lat/long but i didn't get yet. can any one provide best answer.

Thanks in advance.

comments:

1 : Have you inserted appropriate api key in your xml file?.. Have you Added appropriate permissions ?

2 : I added all the permission but i think there is no any api key for that because i m not using in map.

3 : Have you added the GPS Support in your Hardware of AVD?

4 : Checkout my working code : http://stackoverflow.com/questions/5579071/problem-in-getting-the-current-location-in-android

5 : @Siddiqui, i have added that,

6 : @Bipin Vayalu : have you tried the code i posted ?


---------------------------------------------------------------------------------------------------------------
Id: 4137687
title: Apache cache while uploading file via FTP
tags: php, apache, ftp
view_count: 91
body:

I've got a problem with a basic webcam I set up recently. The local computer uploads a snapshot every few seconds via FTP onto some remote server which clients can access via HTTP. A simple HTML frame reloads the picture every few seconds with a basic meta-tag.

So far, so easy, and basically it's working. However, when the client starts downloading the picture right in the moment where the next one is currently being uploaded via FTP, it gets tricky: Apparently, in this case the apache server provides some cached picture - not too bad, since nobody wants some half-uploaded JPEG debris. However, this cache usually is some hours old, so right in between some pictures which show the scenery at night you suddenly get a well-lit noon interlude.

Here is where I'm looking for some workaround. How can I get my apache to refresh this apparent image cache more frequently, i.e. that it always provides the last snapshot that has been uploaded completely?

Workarounds are fine, too. I thought of writing some PHP wrapper that does the caching issue itself, but here once again I failed in accomplishing my goal: How would my PHP script know if the file is currently in the process of being uploaded? Filesize is not helping since it varies. I even thought of using exec, but is there some linux command which reveals if the file is currently opened in write access?

As you might see, I'm pretty much open to any solution to get it going; I'm striving for elegance, of course, but right now any hack would do just fine.

Unfortunately, the software uploading the picture cannot be altered or replaced.

Thanks alot for any ideas!

comments:

1 : append some random query string into your tag ?

2 : This question has been asked lots of times, search for caching solutions.

3 : Possible duplicate of [How to correctly cache images](http://stackoverflow.com/questions/2984814/).


---------------------------------------------------------------------------------------------------------------
Id: 6288577
title: Using Web Application from Win 2008 with XAMPP
tags: xampp
view_count: 128
body:

I installed my server with Window Server 2008.

And I created DNS Service. Then I configured my router's DNS IP with My Server's IP. ie. Server IP is 192.168.1.13 Router IP is 192.168.1.1 Router DNS IP is 192.168.1.13

I created 3 User Account in Server 2008 and used this account for folder sharing in server. All is OK.

I installed XAMPP at Window Server 2008 in Drive (D) and change port to 85. I tested on server http://localhost:85/MyWebApplication and all is OK.

I used this Application from another Client that is connected to these router.

URL : http://192.168.1.13:85/MyWebApplication

The connection is error. Why? Please give answer me. Thank you.

comments:

1 : are u able to ping the server from the client machine?? Not only firewalls...antivirus software may also block the requests.

2 : yeah, thanks, I ping the server. Reply is OK.


---------------------------------------------------------------------------------------------------------------
Id: 4001337
title: Converting .gif to .png format in Cocoa (OSX) without using representationUsingType:properties:
tags: cocoa, osx, image-conversion, cocotron
view_count: 223
body:

I need to write a method that takes a .gif image file as input and converts it to a 32x32 .png file. The only way I found to do this in Cocoa would be using the representationUsingType:properties: method of NsBitmapImageRep but unfortunatley I cannot use this method because it is not supported by cocotron (an open source API that implements the Cocoa API for Windows) and I need to use this method in a cross platform app. Can anyone suggest another way to do this conversion with Cocotron.

comments:

1 : Abdulah your revision was not helpful, I am just looking for another way to implement this in Cocoa that does not require the method I listed above which is why the title refers to Cocoa. The community on this forum that uses Cocoa is vast and the community that uses cocotron may be less then 10 people so this question would almost certainly have never been answered with your revision.

2 : I doubt that there's another Cocoa solutions. There are other non-Cocoa solutions, such as ImageIO and QuickTime. Using QuickTime would be somewhat cross-platform, but I doubt you'll be able to stay within Cocotron.


---------------------------------------------------------------------------------------------------------------
Id: 5433422
title: Retrieve GPS Location and send it to Web Server
tags: blackberry, gps, httpconnection
view_count: 427
body:

Possible Duplicate:
Blackberry send a HTTPPost request

How can I retrieve GPS coordinates and sent them to my web server. For my project I can retrive GPS location in a thread, but I can not send it to my server.

class SiganlerDabScreen extends MainScreen 
{
    private LabelField _coordLabel;
    private static String response;
    private static double _latitude;
    private static double _longitude;
    private int _modeUsed;
    private String _mode;
    BlackBerryCriteria myCriteria;



    public SiganlerDabScreen() 
    {
        super(DEFAULT_CLOSE | DEFAULT_MENU);
        setTitle(new LabelField("GPS", Field.USE_ALL_WIDTH | DrawStyle.HCENTER));


        this._coordLabel = new LabelField();
        add(this._coordLabel);

        System.out.print("myResp :"+response);
        this._coordLabel.setText("");
        Thread locThread = new Thread() 
        {
            public void run() 
            {
                try
                {
                    BlackBerryCriteria myCriteria = new BlackBerryCriteria();
                    myCriteria.enableGeolocationWithGPS(BlackBerryCriteria.FASTEST_FIX_PREFERRED);

                    try
                    {
                        BlackBerryLocationProvider myProvider = (BlackBerryLocationProvider)LocationProvider.getInstance(myCriteria);

                        try
                        {
                            BlackBerryLocation myLocation =(BlackBerryLocation)myProvider.getLocation(-1);
                            _longitude = myLocation.getQualifiedCoordinates().getLongitude();
                            _latitude = myLocation.getQualifiedCoordinates().getLatitude();
                            _modeUsed = myLocation.getGPSMode();
                            switch (_modeUsed)
                            {
                                case LocationInfo.GEOLOCATION_MODE:
                                case LocationInfo.GEOLOCATION_MODE_CELL:
                                case LocationInfo.GEOLOCATION_MODE_WLAN:
                                    _mode = "Geolocation";
                                    break;
                                default:
                                    _mode = "GPS";
                            }    
                            String url="http://www.tunisia2010.org/getone_bb.php?latitude="+_latitude+"&longitude="+_longitude+"&pass=98238622";
                            try {

                                HttpConnection s = (HttpConnection)Connector.open(url);
                                InputStream input = s.openInputStream();

                                byte[] data = new byte[256];
                                int len = 0;
                                StringBuffer raw = new StringBuffer();

                                while( -1 != (len = input.read(data))) {
                                    raw.append(new String(data, 0, len));
                                }
                                String response = raw.toString();
                                System.out.print("myResponse :"+response);
                                input.close();
                                s.close();
                            } catch(Exception e) { }
                            showResults(_latitude,_longitude);
                        }
                        catch (InterruptedException e)
                        {
                            showException(e);
                        }
                        catch (LocationException e)
                        {
                            showException(e);
                        }
                    }
                    catch (LocationException e)
                    {
                        showException(e);
                    }
                } 
                catch (UnsupportedOperationException e) 
                {
                   showException(e);
                }

            }
        };
        locThread.start();

    }



    private void showResults(final double lat, final double lng)
    {


        Application.getApplication().invokeLater(new Runnable()
        {
            public void run()
            {

                SiganlerDabScreen.this._coordLabel.setText(lat+","+lng+","+response);
                System.out.print("myResp :"+response);
            }
        });
    }





    private void showException(final Exception e) 
    {
        Application.getApplication().invokeLater(new Runnable()
        {
            public void run()
            {
                Dialog.alert(e.getMessage());
            }
        });
    }

}
comments:

1 : What fails when sending data to the server?

2 : it returns a white screen, like nothing is treated

3 : i think that my problem is how to invoke Location thread and Connection Thread simultanously

4 : It's better to have two separate threads for location and network connectivity. So that either your network activity or your location determination does not stuck and clash with each other. I have had this approach and it's working fine for me.

5 : Try this class, it solve all your communication problems, it is made for BIS,BES, WIFI etc, http://www.versatilemonkey.com/HttpConnectionFactory.java


---------------------------------------------------------------------------------------------------------------
Id: 5097856
title: How to set a breakpoint in code from referenced .dll?
tags: visual-studio-2010, breakpoint
view_count: 184
body:

I am trying to set a breakpoint on a method from library System.Web.Mvc:

Microsoft.Web.Mvc.Html.HtmlHelperExtensions.EditorFor

The symbols are loaded. But how can I set a breakpoint if I can't open source code? I've tried "Debug > New Breakpoing > Break at Function" with

Microsoft.Web.Mvc.Html.HtmlHelperExtensions.EditorFor

but no luck.

comments:

1 : You're not in release mode?

2 : I am in debug mode.

3 : do you want to set the breakpoint in the code for the method itself, or the code that calls the method?

4 : I want to set breakpoint in method itself.


---------------------------------------------------------------------------------------------------------------
Id: 5003626
title: Problem with M2Crypto's AES
tags: python, m2crypto
view_count: 837
body:

Can someone please point out mistakes in this code:

        __author__="gaurav"
        __date__ ="$15 Feb, 2011 5:10:59 PM$"
        import M2Crypto
        from base64 import b64encode, b64decode
        ENC=1
        DEC=0
        def AES_build_cipher(key, iv, op=ENC):
            """"""""
            return M2Crypto.EVP.Cipher(alg='aes_128_cbc', key=key, iv=iv, op=op)

        def AES_encryptor(key,msg, iv=None):
            """"""
            #Decode the key and iv
            key = b64decode(key)
            if iv is None:
                iv = '\0' * 16
            else:
                iv = b64decode(iv)

           # Return the encryption function
            def encrypt(data):
                cipher = AES_build_cipher(key, iv, ENC)
                v = cipher.update(data)
                v = v + cipher.final()
                del cipher
                v = b64encode(v)
                return v
            print "AES encryption successful\n"
            return encrypt(msg)
        def AES_decryptor(key,msg, iv=None):
            """"""
            #Decode the key and iv
            key = b64decode(key)
            if iv is None:
                iv = '\0' * 16
            else:
                iv = b64decode(iv)

           # Return the decryption function
            def decrypt(data):
                data = b64decode(data)
                cipher = AES_build_cipher(key, iv, DEC)
                v = cipher.update(data)
                v = v + cipher.final()
                del cipher
                return v
            print "AES dencryption successful\n"
            return decrypt(msg)
        if __name__ == "__main__":
            msg=AES_encryptor(b64encode("123452345"),msg=b64encode("qwrtttrtyutyyyyy"))
            print AES_decryptor(b64encode("123452345"),msg=msg)

Error:

        AES encryption successful

        AES dencryption successful

        Traceback (most recent call last):
          File "/home/gaurav/NetBeansProjects/temp/src/temp.py", line 54, in <module>
            print AES_decryptor(b64encode("123452345"),msg)
          File "/home/gaurav/NetBeansProjects/temp/src/temp.py", line 51, in AES_decryptor
            return decrypt(iv)
          File "/home/gaurav/NetBeansProjects/temp/src/temp.py", line 47, in decrypt
            v = v + cipher.final()
          File "/usr/local/lib/python2.6/dist-packages/M2Crypto-0.21.1-py2.6-linux-i686.egg/M2Crypto/EVP.py", line 128, in final
            return m2.cipher_final(self.ctx)
        M2Crypto.EVP.EVPError: wrong final block length
comments:

1 : Something is wrong in your setup. I run your code, it did work without any errors.


---------------------------------------------------------------------------------------------------------------
Id: 6581168
title: QT QML Camera error: "Camera resources were lost."
tags: qt, qml, qt-quick
view_count: 196
body:

I've a QML Camera Element and a QML Video element in my application,

when i've add video camera and when i star the app, a error appear on debug log :

Camera error: "Camera resources were lost."

if i comment Video Element, no probleme Camera work again

This is the code of Video element :

Video {
    id: video
    width: parent.width;
    height: parent.height;
    source: "../blow.mp4"
    z:500
    visible: false


    signal endOfMedia()

    onStatusChanged: {
        if(video.status == Video.EndOfMedia)
        {
            video.stop();
            video.visible = false
        }
    }
}

This is the code of Camera element :

Camera {
    id: camera
    x: 0
    y: 0
    width: parent.width - 10
    height: parent.height -10
    captureResolution : parent.height+"x"+parent.width

    onImageSaved : {
       qmlSignalSendPhoto( path )
    }

}
comments:

1 : Which platform are you running on?

2 : Found the error in S60CameraControl, so it's Symbian. CCameraEngine::HandleEvent receives KUidECamEventCameraNoLongerReserved and translates it to KErrHardwareNotAvailable. Though I do not know why the Video item would be in conflict with ECam.

3 : yes it's symbian^3, i've try on 2 phones and i've the same probleme (C7 + E7).i've try to restart phone, and probleme still exist...do you have a idea to get Camera enabled again ? thanks for your help.

4 : Unfortunately I don't have a Symbian phone to test on.. One alternative is to take your question to the Qt Mobility mailing list or the Qt Developer Network since the Trolls monitor them and they are very helpful.

5 : ok, i will do it, but i dismiss video to use a (big) AnimatedImage. it solve my probleme...


---------------------------------------------------------------------------------------------------------------
Id: 3732889
title: convert into string using twisted python
tags: python
view_count: 107
body:

How can i convert this input into a string?

GET /learn/tutorials/351079-weekend-project-secure-your-system-with-port-knocking?name=MyName&married=not+single&male=yes HTTP/1.1
Host: merch1.localhost
User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

I need the output to be:

GET /learn/tutorials/351079-weekend-project-secure-your-system-with-port-knocking?name=MyName&married=not+single&male=yes HTTP/1.1 Host: merch1.localhost User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11 Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive

comments:

1 : The only transformation that I see in there is removing newlines from the headers. Is that what you are trying to accomplish? Also, I notice an `HTTP/1.1` in the output that is not anywhere in the input....

2 : @Phoenix: I see the `HTTP/1.1` at the end of the first line; looks to me like he's simply _replacing_ each newline with a space character, i.e. `s.replace('\r\n', ' ')`.

3 : Where are you receiving this input? What have you tried?

4 : possible duplicate of [i need to convert the input from telnet to a list in twisted](http://stackoverflow.com/questions/3732345/i-need-to-convert-the-input-from-telnet-to-a-list-in-twisted)


---------------------------------------------------------------------------------------------------------------
Id: 5029909
title: python how to send mail under proxy
tags: python, smtplib
view_count: 443
body:

I write a program to send mails with stmplib module, it runs ok at home,but failed in my company which is under an IE proxy setting.

I have searched the web, but I didn't get the method to support proxy with stmplib.

How can I make my mail program work through the IE proxy like some other programs?

comments:

1 : What is the relation between an the Internet Explorer and sending mail? What is an IE proxy meant to be? Are you talking about an HTTP proxy? Mail is sent via SMTP, not HTTP. If your company blocks SMTP, they probably have some mail relay you could use.

2 : thks,the proxy of my company has been updated to support stmp client when i 'm trying to tackle the problem,^-^


---------------------------------------------------------------------------------------------------------------
Id: 6765362
title: pyHook + Tkinter = crash?
tags: python, windows, tkinter, pyhook
view_count: 195
body:

Consider the following example:

from Tkinter import *
import pyHook

class Main:
    def __init__(self):
        self.root = Tk()
        self.root.protocol("WM_DELETE_WINDOW", self.onClose)
        self.root.title("Timer - 000")

        self.timerView = Text(self.root, 
                    background="#000", 
                    foreground="#0C0", 
                    font=("Arial", 200), 
                    height=1, 
                    width=3)
        self.timerView.pack(fill=BOTH, expand=1)

        self.timer = 0
        self.tick()

        self.createMouseHooks()

        self.root.mainloop()

    def onClose(self):
        self.root.destroy()

    def createMouseHooks(self):
        self.mouseHook = pyHook.HookManager()
        self.mouseHook.SubscribeMouseAllButtons(self.mouseClick)
        self.mouseHook.HookMouse()

    def mouseClick(self, event):
        self.timer = 300

        return True

    def tick(self):
        self.timerView.delete(1.0, END)
        self.timerView.insert(END, self.threeDigits(self.timer))

        self.root.title("Timer - " + str(self.threeDigits(self.timer)))

        self.timer = self.timer - 1 if self.timer > 0 else 0
        self.root.after(1000, self.tick)

    def threeDigits(self, number):
        number = str(number)
        while len(number) < 3:
            number = "0" + number

        return number

if __name__ == "__main__":
    Main()

This will display a window and asynchronously update a text widget every second. It's simply a timer that will count down, and reset to 300 whenever the user clicks a mouse button.

This does work, but there's a weird bug. When the program is running, and you move the window, the mouse and program will freeze for 3-4 seconds, and then the program stops responding.

If you remove the hook or the asynchronous update, the bug won't happen.

What could be the cause of this problem?

EDIT:

I've been testing in Windows 7 with Python 2.6.

comments:

1 : Wild guess: The hook procedure and Tkinter's event handling do not get along well. Any reason to not simply use Tkinters bind to handle mouse events http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm?

2 : Then you would have to bind the mouse to a specific widget, right? I want to detect mouse clicks in all applications, I only use Tkinter to display the information.

3 : I played around a bit and got it be more responsive by calling root.update() first thing in tick(), in order to pump the window events, but it still crashed eventually. I think you may need to run pyHook in a separate thread/process that uses pythoncom.PumpMessages.


---------------------------------------------------------------------------------------------------------------
Id: 6469225
title: Save bitmap with original size
tags: vb.net, image, gdi, resize
view_count: 193
body:

I am trying to add image to the graphics path resizing it to fit the users area and adding text and while trying to save the image I am ending up with a smaller image.

But I need it save with the original size and quality.

Here is my code:

Public Class Form1
Dim rAngle As Integer
Dim sAngle As Integer
Dim pic_font As Font
Dim bm As Bitmap = New Bitmap(100, 100)
Dim tbm As Bitmap
Dim strText As String = "Diver Dude"
Dim szText As New SizeF
Dim ptText As New Point(125, 125)
Dim ptsAngle() As PointF
Dim ptOrigin As PointF
Dim ptsText() As PointF
Dim ptsRotateText() As PointF
Dim ptsTextPen As Pen = New Pen(Color.LightSteelBlue, 1)
Dim MovingOffset As PointF
Dim MouseMoving As Boolean
Dim MouseRotating As Boolean
Dim MouseOver As Boolean
Private curImage As Image
Private imgHeight As Single
Private imgWidth As Single


Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()
    'Add any initialization after the InitializeComponent() call
    Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
    Me.SetStyle(ControlStyles.DoubleBuffer, True)

End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    ptsTextPen.DashStyle = DashStyle.Dot
    'bm = My.Resources.DivePic
    bm = Image.FromFile(Application.StartupPath & "\DivePic.bmp")
    Dim FSize() As Single = {4, 6, 8, 10, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 46, 50, 56, 60, 72, 80}
    Dim FS As Single
    For Each FS In FSize
        cboFontSize.Items.Add(FS)
    Next
    cboFontSize.SelectedIndex = cboFontSize.FindString("40")

    pic_font = New Font("Arial Black", CSng(cboFontSize.Text), FontStyle.Regular, GraphicsUnit.Pixel)
    'szText = Me.CreateGraphics.MeasureString(strText, pic_font)
    'SetptsText()
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
    'Check if the pointer is over the Text
    If IsMouseOverRotate(e.X - 10, e.Y - 10) Then
        MouseRotating = True
        ptOrigin = New PointF(ptText.X + (szText.Width / 2), ptText.Y + (szText.Height / 2))
        sAngle = getAngle(ptOrigin, e.Location) - rAngle

    ElseIf IsMouseOverText(e.X - 10, e.Y - 10) Then
        MouseMoving = True
        'Determine the upper left corner point from where the mouse was clicked
        MovingOffset.X = e.X - ptText.X
        MovingOffset.Y = e.Y - ptText.Y
    Else
        MouseMoving = False
        MouseRotating = False
    End If

End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove

    If e.Button = Windows.Forms.MouseButtons.Left Then
        If MouseMoving Then
            ptText.X = CInt(e.X - MovingOffset.X)
            ptText.Y = CInt(e.Y - MovingOffset.Y)
            Me.Invalidate()
        ElseIf MouseRotating Then
            rAngle = getAngle(ptOrigin, e.Location) - sAngle
            Me.Invalidate()
            'lblRotate.Text = getAngle(ptOrigin, ptsAngle(0))
            'lblRotate.Refresh()

        End If
    Else
        If IsMouseOverRotate(e.X - 10, e.Y - 10) Then
            'Check if the pointer is over the Text
            Me.Cursor = Cursors.Hand
            If Not MouseOver Then
                MouseOver = True
                Me.Invalidate()
            End If
        ElseIf IsMouseOverText(e.X - 10, e.Y - 10) Then
            Me.Cursor = Cursors.SizeAll
            If Not MouseOver Then
                MouseOver = True
                Me.Invalidate()
            End If
        Else
            Me.Cursor = Cursors.Default
            If MouseOver Then
                MouseOver = False
                Me.Invalidate()
            End If
        End If
    End If
End Sub

Private Function getAngle(ByVal Origin As PointF, ByVal XYPoint As PointF) As Integer

    Dim xLength As Single = XYPoint.X - Origin.X
    Dim yLength As Single = XYPoint.Y - Origin.Y
    Dim TheAngle As Single

    'On the Origin
    If xLength = 0 And yLength = 0 Then Return 0
    'On one of the Axis
    If xLength = 0 And yLength < 0 Then Return 0
    If yLength = 0 And xLength > 0 Then Return 90
    If xLength = 0 And yLength > 0 Then Return 180
    If yLength = 0 And xLength < 0 Then Return 270

    TheAngle = Math.Atan(xLength / yLength)
    TheAngle = TheAngle * (180 / Math.PI)

    'Adjust for the Quadrant
    If yLength > 0 Then
        'Quadrant 1 or 2
        TheAngle = 180 - TheAngle
    ElseIf xLength > 0 Then
        'Quadrant 0
        TheAngle = Math.Abs(TheAngle)
    ElseIf xLength < 0 Then
        'Quadrant 3
        TheAngle = 360 - TheAngle
    End If
    Return CInt(TheAngle)
End Function

Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
    MouseMoving = False
    MouseRotating = False
    Me.Invalidate()
End Sub

Public Function IsMouseOverText(ByVal X As Integer, ByVal Y As Integer) As Boolean
    'Make a Graphics Path from the rotated ptsText.
    Using gp As New GraphicsPath()
        gp.AddPolygon(ptsText)

        Return gp.IsVisible(X, Y)

    End Using
End Function

Public Function IsMouseOverRotate(ByVal X As Integer, ByVal Y As Integer) As Boolean
    'Make a Graphics Path from the rotated ptsText.
    Using gp As New GraphicsPath()
        gp.AddPolygon(ptsRotateText)

        Return gp.IsVisible(X, Y)

    End Using
End Function
Private Sub Form1_Paint(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.PaintEventArgs) _
    Handles Me.Paint
    tbm = CType(bm.Clone, Bitmap)
    If bm Is Nothing Then Exit Sub
    Dim g As Graphics = Graphics.FromImage(tbm)
    'Dim g As Graphics = PictureBox1.CreateGraphics()
    PictureBox1.Image = tbm
    Dim mx As Matrix = New Matrix
    Dim gpathText As New GraphicsPath
    Dim br As SolidBrush = New SolidBrush(Color.FromArgb(tbarTrans.Value, _
                                         KryptonColorButton1.SelectedColor))

    'Set the Points for the Rectangle around the Text        
    SetptsText()

    'Smooth the Text
    g.SmoothingMode = SmoothingMode.AntiAlias

    'Make the GraphicsPath for the Text
    Dim emsize As Single = Me.CreateGraphics.DpiY * pic_font.SizeInPoints / 72
    gpathText.AddString(strText, pic_font.FontFamily, CInt(pic_font.Style), _
        emsize, New RectangleF(ptText.X, ptText.Y, szText.Width, szText.Height), _
        StringFormat.GenericDefault)

    'Draw a copy of the image to the Graphics Object canvas
    g.DrawImage(CType(bm.Clone, Bitmap), 0, 0)


    'Rotate the Matrix at the center point
    mx.RotateAt(rAngle, _
        New Point(ptText.X + (szText.Width / 2), ptText.Y + (szText.Height / 2)))

    'Rotate the points for the text bounds
    mx.TransformPoints(ptsText)
    mx.TransformPoints(ptsRotateText)
    mx.TransformPoints(ptsAngle)

    'Transform the Graphics Object with the Matrix
    g.Transform = mx

    'Draw the Rotated Text
    'g.FillPath(br, gpathText)



    If chkAddOutline.Checked Then
        Using pn As Pen = New Pen(Color.FromArgb(tbarTrans.Value, KryptonColorButton2.SelectedColor), 1)
            g.DrawPath(pn, gpathText)
        End Using
    Else
        g.FillPath(br, gpathText)
    End If

    If CheckBox2.Checked = True Then
        Dim p As New Pen(Color.FromArgb(tbarTrans.Value, KryptonColorButton2.SelectedColor), 1)
        'draw te hollow outlined text
        g.DrawPath(p, gpathText)
        'clear the path
        gpathText.Reset()
    Else
        g.FillPath(br, gpathText)
    End If




    'Draw the box if the mouse is over the Text
    If MouseOver Then
        g.ResetTransform()
        g.DrawPolygon(ptsTextPen, ptsText)
        g.FillPolygon(New SolidBrush(Color.FromArgb(100, Color.White)), ptsRotateText)
    End If
    'Draw the whole thing to the form
    e.Graphics.DrawImage(tbm, 10, 10)

    PictureBox2.Image = tbm
    PictureBox1.Hide()
    PictureBox2.Show()


    'tbm.Dispose()
    g.Dispose()
    mx.Dispose()
    br.Dispose()
    gpathText.Dispose()


End Sub

Private Sub TrackBar_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) _
  Handles tbarTrans.Scroll
    lblOpacity.Text = tbarTrans.Value
    Me.Invalidate()
End Sub

Sub SetptsText()
    'Create a point array of the Text Rectangle
    ptsText = New PointF() { _
        ptText, _
        New Point(CInt(ptText.X + szText.Width), ptText.Y), _
        New Point(CInt(ptText.X + szText.Width), CInt(ptText.Y + szText.Height)), _
        New Point(ptText.X, CInt(ptText.Y + szText.Height)) _
        }

    ptsRotateText = New PointF() { _
        New Point(CInt(ptText.X + szText.Width - 10), ptText.Y), _
        New Point(CInt(ptText.X + szText.Width), ptText.Y), _
        New Point(CInt(ptText.X + szText.Width), CInt(ptText.Y + 10)), _
        New Point(CInt(ptText.X + szText.Width - 10), CInt(ptText.Y + 10)) _
        }
    ptsAngle = New PointF() {New PointF(CInt(ptText.X + szText.Width), CInt(ptText.Y + (szText.Height / 2)))}
End Sub

Private Sub chkAddOutline_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAddOutline.CheckedChanged
    Me.Invalidate()
End Sub

Private Sub cboFontSize_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFontSize.SelectedIndexChanged
    pic_font = New Font("Arial Black", CSng(cboFontSize.Text), FontStyle.Regular, GraphicsUnit.Pixel)
    szText = Me.CreateGraphics.MeasureString(strText, pic_font)
    SetptsText()
    Me.Invalidate()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
        PictureBox2.Image.Save(SaveFileDialog1.FileName)
    End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
        pic_font = FontDialog1.Font
        szText = Me.CreateGraphics.MeasureString(strText, pic_font)
        SetptsText()
        Me.Invalidate()
    End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
        Dim img As Drawing.Image = Drawing.Image.FromFile(OpenFileDialog1.FileName)
        PictureBox1.Image = img
        bm = img
    End If
End Sub

End Class

comments:

1 : Just a hunch, but... Dim bm As Bitmap = New Bitmap(100, 100) Does the image on screen happen to be 100x100?

2 : I have done that but when i am trying to add through open file dialog it adds but it occupies the half of the form but I need it to be shown it on the picturebox as a fit image and at the same time I need to add text as the above.

3 : This is the example I am trying to modify http://www.codeproject.com/KB/graphics/TextRotateandMove.aspx

4 : As you said I have done before and while saving that image I am getting the smaller image compared than the original size


---------------------------------------------------------------------------------------------------------------
Id: 3496701
title: VB6 sending email through Outlook 2003 no longer works in Windows 7?
tags: vb6, windows-7, outlook-2003
view_count: 833
body:

This VB6 code worked fine in Windows XP with Outlook 2003.

Function SendMail(EM_TO, Em_CC, EM_BCC, EM_Subject, EM_Body, _
        EM_Attachment As String, Display As Boolean)
    Dim objOA As Outlook.Application
    Dim objMI As Outlook.MailItem
    Dim obgAtt As Outlook.Attachments
    Set objOA = New Outlook.Application
    Set objMI = objOA.CreateItem(olMailItem)
    If EM_TO <> vbNullString Then objMI.To = EM_TO
    If Em_CC <> vbNullString Then objMI.CC = Em_CC
    If EM_BCC <> vbNullString Then objMI.BCC = EM_BCC
    If EM_Subject <> vbNullString Then objMI.Subject = EM_Subject
    If EM_Body <> vbNullString Then objMI.Body = EM_Body
    If EM_Attachment <> vbNullString Then 
        objMI.Attachments.Add EM_Attachment, 1, , EM_Attachment
    End If

    If Display Then
        objMI.Display
    Else
        objMI.Send
    End If
    Set objOA = Nothing
    Set objMI = Nothing
End Function

I'm still using Outlook 2003, but the operating system is Windows 7 x64.

There are two problems:

  1. If Outlook is already open, it raises an error on Set objOA = New Outlook.Application. I tried using GetObject but it didn't seem to find the running instance.
  2. If Outlook is closed to start, it raises an error -1940651759 on objMI.Attachments.Add ("Unable to perform the operation. The information store could not be opened.")
  3. If I comment out the attachment line, it raises an error on the objMI.Display line (-1767636719 "The information store could not be opened.")

I'm guessing this is security-related. Perhaps it's due to the ost or pst file being in a more protected environment. Has anyone had to deal with this? Is there a different way that might work in Windows 7?

EDIT:

I discovered something else interesting. If I actually change Outlook to run as an administrator, or to tell it to run in Windows XP compatibility mode, then I get the same "The information store could not be opened" error when I start Outlook manually. It's interesting because the VB6 application (and development environment) are both running as administrator. I think it's related.

comments:

1 : There's a good chance it is failing due to the 64 bit environment. The only way to know for sure is to try it on a 32 bit Windows 7 machine.

2 : Would it be possible to send mail using MAPI?

3 : @Kaniu: This is only for cases where I want to pop open a message with a document attached, and let the user decide what to do from there. However, it's a decent question. I wonder if I can do that from MAPI...


---------------------------------------------------------------------------------------------------------------
Id: 6490720
title: Calendar control in asp.net c#
tags: c#, asp.net
view_count: 125
body:

Possible Duplicate:
Calendar control in asp.net c#

I have one image button , one text box and one calender extend in my web application. I want when i click the image button it will displays the calender and when i select any date from calender it will display in the text box. I have the following code.

<asp:TextBox ID="txtDateFrom" CssClass="text-small" runat="server" 
             BorderWidth="1px" ToolTip="Click to choose date"></asp:TextBox> 

<asp:ImageButton ID="DateFrom" runat="server" ImageUrl="~/calendar.jpeg" 
                 onclick="DateFrom_Click" style="width: 22px; height: 17px" />

<asp:Label ID="lblTo" runat="server" Text="To" ForeColor="Black"></asp:Label> 

<asp:CalendarExtender ID="txtDateFrom_CalendarExtender" runat="server" TargetControlID="DateFrom" Format="yyyy-MM-dd" TodaysDateFormat="yyyy d, MMMM">
</asp:CalendarExtender> 

When i executed this it will produce some errors . Can anyone plz help me regarding this..?

Thanx in advance...

comments:

1 : Please ask only once!

2 : You shouldn't post duplicate questions. Instead, if you didn't get good answers, update/enhance the original question.

3 : "some errors" is not very helpful. Please update the original question with more details.


---------------------------------------------------------------------------------------------------------------
Id: 4624246
title: (iphone) fast UIImage composition(merge)?
tags: iphone, merge, uiimage, combine
view_count: 431
body:

i'm using the code below to merge two UIImages,
wonder if there are faster way.

- (UIImage*) combineImage: (UIImage*) aImage
{
    UIGraphicsBeginImageContext(self.size);
    [self drawInRect: CGRectMake(0, 0, self.size.width, self.size.height)];  
    [aImage drawInRect: CGRectMake(0, 0, self.size.width, self.size.height)];


    UIImage* combinedImage = UIGraphicsGetImageFromCurrentImageContext(); //                                                                                                                                                                                                  
    UIGraphicsEndImageContext();
    return combinedImage;
}
comments:

1 : It could just be the size of the image you are dealing with? If the UIImage is from your own bundle, try making it smaller using ImageOptim.

2 : I guess that it will be faster if you'll use Quartz functions instead of wrappers... something like CGContextDrawImage etc... but the biggest decency comes from the size of your images.

3 : the result will alaways be aImage, cause it overlays the image compleatly... so what marge?

4 : What do you mean by merging? What do you want to do?


---------------------------------------------------------------------------------------------------------------
Id: 3377449
title: JavaScript avatar with items question
tags: php, javascript, items, inventory
view_count: 122
body:

I'm trying to create a javascript avatar. E.G with Head Items, body items etc... I have a PHP script that queries the database and retrieves the current items the avatar/user is wearing, it's response is in a serialised array. The item/avatar images are in E.G: http://blahblahblahBlah.com/graphic/itemtype/id.png

How would I create an "inventory system"? Basically, there is a main layer, which is a PNG. It is the background. Then, there is the character, which is a PNG. On top of that, there are items ON the character. We need a way to create an "inventory" system, as mentioned earlier, using JavaScript. We already have the PHP and MySQL handled.

Thanks.

comments:

1 : Hmmm, too many questions there and all seem difficult to answer from what you've provided as context.

2 : possible duplicate of [JavaScript Avatar ](http://stackoverflow.com/questions/3377211/javascript-avatar)

3 : user clicks an item and it goes on the avatar. simple enough?


---------------------------------------------------------------------------------------------------------------
Id: 6162814
title: Tkinter automatical refresh
tags: python, refresh, tkinter, clock, tk
view_count: 179
body:

Possible Duplicate:
Tkinter: How to make Tkinter to refresh and delete last lines?

Tried to get answer to my question but none of them helped..

Problem is: Clock hands in Tkinter flashes because i use w.delete, but if i dont use it then clock hands duplicate.. Please help :)

import Tkinter as tk; import time
from math import cos,sin,pi
import sys
root=tk.Tk(); root.title("Clock")
w = tk.Canvas(root, width=320, height=320, bg="#456", relief= "sunken", border=10)

w.pack()

size=300
def funA():

    s=time.localtime()[5]
    m=time.localtime()[4]
    h=time.localtime()[3]

    degrees = 6*s
    angle = degrees*pi*2/360
    ox = 165
    oy = 165
    x = ox + size*sin(angle)*0.45
    y = oy - size*cos(angle)*0.45
    t = w.create_line(ox,oy,x,y, fill = "#ffc")

    degrees1 = 6*m
    angle1 = degrees1*pi*2/360
    ox1 = 165
    oy1 = 165
    x1 = ox1 + size*sin(angle1)*0.4
    y1 = oy1 - size*cos(angle1)*0.4
    t1 = w.create_line(ox1,oy1,x1,y1, fill = "Red", width=6)


    degrees2 = 30*h
    angle2 = degrees2*pi*2/360
    ox2 = 165
    oy2 = 165
    x2 = ox2 + size*sin(angle2)*0.2
    y2 = oy2 - size*cos(angle2)*0.2
    t2 = w.create_line(ox2,oy2,x2,y2, fill = "Black", width=8)
    w.update()
    root.after(200,funA)
    w.delete(t1)

root.after(1500, funA)  
uzr1 = tk.Label(root, text="12", bg="#456" )
uzr1.place(x=160, y=13)
uzr2 = tk.Label(root, text="6", bg="#456" )
uzr2.place(x=160, y=303)
uzr3 = tk.Label(root, text="3", bg="#456" )
uzr3.place(x=310, y=160)
uzr4 = tk.Label(root, text="9", bg="#456" )
uzr4.place(x=11, y=160)

def Quit():
    root.after(700,root.destroy())


e = tk.Button(root,text="Quit", command=Quit)
e.pack()
root.mainloop()

If i write in funA w.delete(t) then Clock second-hand is flashing, if not then its duplicating.. So it is with all clock hands..

comments:

1 : well, this not quite the same.. this code probably is missing only some simple text what i don't know.. I have tried everything..

2 : So edit your previous question.

3 : then how to delete this question ?

4 : Don't sweat it. This is marked as a duplicate and there no problematic answers that need merging across or anything.


---------------------------------------------------------------------------------------------------------------
Id: 6371322
title: How to cluster documents?
tags: cluster-analysis, document
view_count: 59
body:

I've multiple text files and I want to create clusters based on them. What's the most basic tool to do that? Any example for the tool will be very helpful.

comments:

1 : What do you mean by clusters? Is it a visual representation somewhere on the desktop? Some sort of package like a zip file? Which OS? Platform?

2 : I need a tool to which I provide a set of files and it groups files based on the text in them. Any Platform, any tool, any programming language or utility

3 : Use folder in Windows XP

4 : As Weka can be used for "document classification", I need a tool for clustering. If it's possible in Weka, any tutorial will be helpful.


---------------------------------------------------------------------------------------------------------------
Id: 6880959
title: Mismatched Data Coming Back From Server
tags: flex, serialization, air, remoteobject
view_count: 35
body:

Good Evening Everyone -

Kind of a strange question I guess...I have a flex app that is sending out a RemoteObject service call. It gets to the server, retrieves the data, but when it is trying to compile it back to a custom data type (User) to send back is getting all mixed up. All of the info is there, it is just all over the place - it DOES do it predictably though (i.e. - Let's say the firstName field always comes back in the phoneNumber area) - I have the AS ValueObject class, the PHP class and the mySQL query all structured the same (i.e. 1.)FirstName, 2.)LastName, 3.)PhoneNumber, etc...)

Just didn't know if anyone had anything like this happen before. ALSO...All the other custom data types are coming back as they should and I used the same way of storing, retrieving, querying, etc for them all.

Thanks in advance for any help. Sincerely, CS

:::EDIT:::

Hi Everyone - Thank you for the suggestions and offers to help. But the answer lies within (as usual in my case) programmer error. I had forgot to declare one of the variables in the ActionScript code and thus - everything was getting placed wildly throughout. But thank you again to everyone who offered to lend a hand once again! -CS

comments:

1 : Is your structure reliant purely on order or is there some sort of semantic mark-up within your serialisation (eg XML, JSON, etc)? Or does your deserialisation methods rely on order instead of identifiers?

2 : Sounds like something is wrong w/ either your server side processing code or how you have the two objects aliased to each other for the automatic server-side to client side conversion. However, without seeing any code it's tough to guess what the issue may be.

3 : Can we see some code pls?


---------------------------------------------------------------------------------------------------------------
Id: 6770708
title: How to send data from php server to java client with sockets
tags: java, php, sockets
view_count: 466
body:

I have this code in java client:

Socket s = new Socket("someip",1235);
BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
bw.write("Hello Java\n");
System.out.println("Write succesful");

String line = "";
while ((line = br.readLine()) != null){
       System.out.println(line);
}

bw.close();
br.close();
s.close();

and this code in the php server

$host = "someip";
$port = 1235;

$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
$result = socket_listen($socket, SOMAXCONN) or die("Could not set up socket listener\n");
$spawn = socket_accept($socket) or die("Could not accept incoming connection\n");
$input = socket_read($spawn, 10000, PHP_NORMAL_READ) or die("Could not read input\n");
echo $input;
$output = "Hello PHP";
socket_write($spawn,$output."\n", strlen($output) + 1) or die("Could not write output\n");

socket_close($spawn);
socket_close($socket);

When i put comments in these commands:

socket_write($spawn,$output."\n", strlen($output) + 1) or die("Could not write output\n");

and

while ((line = br.readLine()) != null){
           System.out.println(line);
    }

i have as a result an echo message "Hello Java" on my php server side. I can send data from java client to server. when i uncomment the above commands i have as a result the php server side (a browser) to load without ending. The same in the client side who is waiting for the data to come.

The host is the same for both sides (my pc) and the ip is the IPv4 from ipconfig. I have spend many hours in this and i would appreciate any help available...

comments:

1 : I couldn't really understand your question very well. Are you running php code on a sever or are you running php code in a client browser?

2 : i run both php and java code in my pc, php as the server side and java as the client side


---------------------------------------------------------------------------------------------------------------
Id: 6034202
title: Using NSPredicate to search all NSDictionary attributes within an NSArray
tags: ios, nsarray, nsdictionary, nspredicate
view_count: 585
body:

Possible Duplicate:
NSPredicate to match “any entry in an NSDatabase with value that contains a string”

Let's say I have an NSArray of NSDictionary items, each have about 100 attributes. How would I use NSPredicate to search all of these attributes in the NSArray for a given term? I've used NSPredicate multiple times in the past, but I'm generally only searching one or two attributes. This is more of a global search across all attributes in the array.

comments:

1 : I'm not really sure what you're trying to ask. Perhaps this question is what you're looking for? http://stackoverflow.com/q/5569632/115730

2 : That was exactly what I was looking for. Thanks!


---------------------------------------------------------------------------------------------------------------
Id: 6157947
title: Django, db update, south and sqliteman: a confirmation. Not really a question. Is it better?
tags: database, django, columns, django-south
view_count: 138
body:

I have seen that actually, after asking in stackoverflow.com, there might be a lot of equivalent questions.. But I got the box where to write already and my google searches are not any better. (I was testing blekko.com for a while.. as a search engine.. give it a try)

Back to the question:

If I have: models.py

class someclass(models.Model):
    title = models.CharField(max_length=200)

And I run all the stuff till the site is working...

Now I do (models.py):

class someclass(models.Model):
    title = models.CharField(max_length=200)
    sub_title = models.CharField(max_length=200)

And I use sqliteman or phpmyadmin to add a column named 'sub_title' which will get some default value, namely NULL. (regardless of some django constrains, like not NULL)

Would I brake something within django?

I guess I would always have the possibility to dump the db and read it back. Not sure yet how to do it in django in a clean way but there should be a way. Is there such a way?

My question stops here.

But as additional hint, I did check south which didn't work for me 'right out of the box', in particular for an existing project. Before to get into some other problems, I realized that I only need columns updates while developing the site.

I present to my customer (this is at present a free/free no money situation) the stages of development... and I do not want to reset the DB at every version.

comments:

1 : I'm guessing this would break Django unless you updated the models to reflect this.

2 : You could try using South (http://south.aeracode.org/) which solves exactly this problem. However, I do wonder why this question has a "south" tag on it.

3 : @Rafe Kettler if the column was nullable and null by default it woudn't break django, you wouldn't be able to use the column at all from django, but it won't break anything. Well I guess it depends on what you mean by break. It won't stop it from working and cause a server error if that is what you mean.

4 : @Rafe, of course the model will be hand made updated. @Martin this was on the top. Why using south? Actually the question was another: I couldn't get south on an existing project. Technically I can reproduce the project. Which one would be the advantage of south?

5 : Indeed the DB has nothing to do with django (of course) so being permissive on the DB side cannot break any django feature. I guess that the point is if it is really simple that a class variable can be right away declared and used independently from the DB...


---------------------------------------------------------------------------------------------------------------
Id: 6061305
title: Using R for Covariate Adjusted Logistic Regression
tags: r
view_count: 284
body:

I would like to run a 'Covariable Adjusted Logistic Regression' test, and I would like to do this in R. So I am having some difficulties with this.

I am uncertain if I am correct in my understanding of Covariable Adjusted Logistic Regression. I have to translate code from a software suite and I've been having a very hard finding articles to help me understand what it exactly is. This type of thing is commonly done in clinical trials but I am not a biostatitician and have been having trouble contextualizing what I am reading.

Does anyone know if there is an R package out there that could help me with this? I can understand reading code much better than those clinical trial papers. The software suite code is unavailable to me, but I do have final values to compare against.

It would be very helpful. I tried the R forum, but was told that I should take more statistics courses instead of trying to program... so not really useful advice.

comments:

1 : At the risk of providing more "not really useful advice," finding a statistician to consult with in-person will probably be more valuable than getting advice online. There's sure to be a lot of details involved in your particular situation which will be vastly easier to address and discuss in person. Doing a logistic regression with covariates is not difficult and you'll probably get some answers below, but without consulting someone it's really hard to be sure you're asking the right questions of your data.

2 : You might have more luck getting your question answered at CrossValidated (stats.stackexchange.com) I will flag this for migration.

3 : Your advice is at least much friendlier put. Thank you, perhaps what I want to do is less common place then I originally thought.

4 : @Ana : That is simply logistic regression with covariates added. There are plenty of books on introductory statistics that can explain you that. See eg Agresti : http://www.amazon.com/Categorical-Analysis-Wiley-Probability-Statistics/dp/0471360937 Looking at the code of the `glm()` function won't help you much.

5 : If you can give a little bit more detail about the software suite you are currently using and an example of the application (or references to accessible papers that use the technique), someone might be able to suggest whether the problem you are tackling is indeed straightforward (as @JorisMeys suggests) or tricky and requiring further consultation ...

6 : @Ben : I didn't say that the problem OP is tackling is straightforward. I said that the method OP talks about is straightforward. The rest is outside the scope of SO and should be asked on Crossvalidated.com

7 : Its a trickey problem. So I am pretty comfortable with glm() and multivariable logistic regression. Its the "adjusted" part that I am having trouble with. I think what the adjusted analysis does is model interaction effects between the different variables and will adjust the p-values based on these interactions (this is what the software seems to do). What I am trying to do is select a set of genes, but "adjust their p-values" based on additional clinical variables. I don't have the statistical support around me to figure out how to do this, but I am trying find it : )

8 : @Ana : definitely http://www.crossvalidated.com But you'll have to link to some publications where the method is explained/used, because right now it sounds like voodoo to me.


---------------------------------------------------------------------------------------------------------------
Id: 6733345
title: Search and store in Hashtable
tags: c#, asp.net
view_count: 82
body:

I have a Text in editor in that some text has anchor tag now I want to find all the the hyperlink tag in HashTable with name as value and src as key, like my text in editor is:

"Proin ac vijendra singh mi non nunc euismod adipiscing. Sed quis purus elit. ASP.NET nec ipsum tellus. My test page posuere egestas diam sit amet vehicula. Fusce vitae nibh." Now I want to store all these three link in hash table. Please suggest me how to store that in hashtable.

comments:

1 : So what is the problem actually ?

2 : how to store that in hashtable???

3 : So....parse out anchor links from the text and store their `href` in to a hashtable? Sounds like you need an HTML parser to me.

4 : I got an answer on following link: http://stackoverflow.com/questions/6745679/find-hyperlinked-text-and-url/6745805#6745805


---------------------------------------------------------------------------------------------------------------
Id: 3651446
title: Accessing contents of VB6 Data Grid from AutiIt script
tags: winapi, vb6, autoit
view_count: 165
body:

I'm using an AutoIt script to access data from a application developed in Visual Basic 6.

Data in all controls can be accessed using Control*() functions. However, Data Grid and Data List controls (their class names: DataGridWndClass and DataListWndClass) don't respond to ControlListView() function.

What is the way to access their contents?

Thanks.

comments:

1 : Did you try using `ControlCommand ( "title", "text", controlID, "command" [, "option"] )` sending specific commands? MSDN should help you to figure out the correct commands.


---------------------------------------------------------------------------------------------------------------
Id: 4139122
title: Springframework JAXB Marshalling Exception in IE not in Firefox
tags: internet-explorer, spring, jaxb
view_count: 298
body:

Hi I get this marhshalling exception when I call a service using IE but it works fine with Firefox.

DEBUG - AbstractHandlerExceptionResolver.resolveException(108) | Resolving exception from handler [org.dfci.cccb.services.SearchServiceImpl@a832ce5]: org.springframework.http.converter.HttpMessageNotWritableException: Could not marshal [org.dfci.cccb.domain.QueryResult@6ecff10d]: null; nested exception is javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.internal.SAXException2: class org.dfci.cccb.domain.hivseqdb.Sequence nor any of its super class is known to this context. javax.xml.bind.JAXBException: class org.dfci.cccb.domain.hivseqdb.Sequence nor any of its super class is known to this context.]

I have a marshalling bean configured like so:

<bean id="SequenceMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="classesToBeBound">
        <list>
            <value>org.dfci.cccb.domain.hivseqdb.Sequence</value>
        </list>
    </property>
</bean>

The only thing I can think of is that IE is sending addtional accept encoding fields that is interfering with the Marhshalling.

comments:

1 : Does this happen with all versions of IE? You might try using Fiddler to capture the request and compare them in IE vs Firefox to see if IE is actually sending something different to the server. http://www.fiddler2.com/fiddler2/


---------------------------------------------------------------------------------------------------------------
Id: 4043405
title: ajax chat that somebody has used and actually works !
tags: ajax, chat, livechat
view_count: 132
body:

I've been looking for an ajax chat module (similar to facebook chat) to intergrate into our dating site, but I cannot find any decent options. Most seem to have been abandoned at various stages of development (Envolve.com, stickapps.com). I am looking for something that has no flash and doesn't require popups to be disabled.

Does anybody use a similar module in a live site and they can vouch for it ? I have no problem paying for a commerical product.

comments:

1 : "ajax chat that somebody has used and actually works!" http://chat.stackoverflow.com/

2 : @Yi Jiang I'm looking for one-on-one chat, not chatrooms.

3 : checkout Jaxl IM (http://jaxl.im) which is pretty much what you are looking for...


---------------------------------------------------------------------------------------------------------------
Id: 5740732
title: hit enter key Link Button not working firefox
tags: linkbutton
view_count: 385
body:

When i enter the username and password for the login control, where i took the linkbutton, after entering username and password i press the enter key then if login is successful then it will logged me into the system.

this is working with IE but not with Firefox. pls help

comments:

1 : Can you update your post to include the code in question? Without it, it might be difficult to help you.

2 : i got the solution using the page prerender method.. protected void Page_PreRender(object sender, EventArgs e) LinkButton lnklogin = (LinkButton)lgn.FindControl("lnkLogin");


---------------------------------------------------------------------------------------------------------------
Id: 4770261
title: Using LightOpenID in Google Gadget
tags: php, authentication, single-sign-on, google-gadget, lightopenid
view_count: 976
body:

I'm creating a google gadget. I'm trying to use LightOpenID library inside of the gadget to help with the single sign-on authenication. It works good if I access the php page using the browser, but if I try it in the gadget, clicking on "Login with Google" button will make the gadget canvas show a blank.

I think it has something to do with Google gadget not supporting header('Location'.$openid->authUrl()), but I'm not too sure. I hope you guys can help me find a way to get around this.

I'm using lightopenid 0.4.

Thanks in advance, guys!

Here's my gadget XML code:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
   <ModulePrefs
      title="test"
   >
      <OAuth>
         <Service name="google">
            <Access url="https://www.google.com/accounts/OAuthGetAccessToken" method="GET" />
            <Request url="https://www.google.com/accounts/OAuthGetRequestToken?scope=http://www.google.com/m8/feeds/" method="GET" />
            <Authorization url="https://www.google.com/accounts/OAuthAuthorizeToken?oauth_callback=http://oauth.gmodules.com/gadgets/oauthcallback" />
         </Service>
      </OAuth>
   </ModulePrefs>
   <Content type="url" href="http://www.deafnetvrs.com/2.0/source/gadgets/onevrs/example.php"/>
</Module>

And here's my PHP file using LightOpenID:

<?php
# Logging in with Google accounts requires setting special identity, so this example shows how to do it.
require 'lightopenid/openid.php';

try {
   $openid = new LightOpenID;
   if(!$openid->mode) {
//      //if(isset($_GET['login'])) {
      if(empty($_GET['login'])){
         $openid->identity = 'https://www.google.com/accounts/o8/id';
         $openid->required = array('contact/email', 'namePerson/first', 'namePerson/last');
         $_GET['login'] = true;
         header('Location: ' . $openid->authUrl());
      }
   }
?>
<html>
<body>
<style type="text/css">
#testDiv {
   background-color: #FFFFFF;
}
</style>
<div id="testDiv">
<?php
   if($openid->mode == 'cancel') {
        echo 'User has canceled authentication!';
         $_GET['login'] = false;
   } else {
      $_GET['login'] = true;
//   if($openid){
      echo("openid ok<br/>");
      $retVal = $openid->validate();
      if($retVal){
         $userAttributes = $openid->getAttributes();
         $firstName = $userAttributes['namePerson/first'];
         $lastName = $userAttributes['namePerson/last'];
         $userEmail = $userAttributes['contact/email'];
         echo 'Your name: '.$firstName.' '.$lastName.'<br />';
         echo("Your email address is: ".$userEmail."<br/>");
         echo("Is logged in? ".$_GET['login']."<br/>");
         //echo '<pre>';
         //print_r($openid);
         //print_r($openid->getAttributes());
         //echo '</pre>';
      } else {
         echo('Failed to login.');
      }
   }
} catch(ErrorException $e) {
   echo $e->getMessage();
}
?>
</div>
</body>
</html>
comments:

1 : Sometimes blank page is shown if you are already logged in through a google account / google apps account. I suggest that you logout out from all google accounts and then try again.

2 : Try checking whether $openid->authUrl() returns the correct url. If it does, but redirection via the Location header doesn't work, simply find another way to redirect. However, since the provider may also use the Location header, you probably won't gain too much. Maybe you should try doing it in a popup window (if you can open one) -- that way you wouldn't be limited by being inside the google gadget.

3 : Okay, thank you. That worked. You should have posted it as an answer instead of a comment!

4 : Is there a way to do it without a popup window? I think it has to do it all the time. I can ruin the experience that way. I'm not well versed in web development yet.

5 : Perhaps an iframe would work?

6 : I couldn't get iframe to work, either. I decided to just stick with the popup window and have it to store the user's info in the cookie. Thank you very much for helping!


---------------------------------------------------------------------------------------------------------------
Id: 6210902
title: Examination software
tags: c#, c++, c, exam
view_count: 138
body:

I'm working on an examination software similar to the http://www.exam-software.com/screenshots.htm

I would like to find some open-source clones of such software but I could not.

Have you ever seen any open-source applications related to my task?

Thanks!

P.s. C/C++, C# is required.

comments:

1 : Why the Cs? Why not A+++++++++++++++?

2 : If you developing the software yourself then you looking for open source version?

3 : Ahh, yet another [shopping question](http://blog.stackoverflow.com/2010/11/qa-is-hard-lets-go-shopping/)!


---------------------------------------------------------------------------------------------------------------
Id: 5307695
title: How to create dynamic page in asp.net?
tags: c#, asp.net, asp.net-mvc, c#-4.0
view_count: 332
body:

create dynamic page in asp.net how is it possible how to make it. Give me some example and also demo file..

comments:

1 : Sounds very much like a homework... how do you want us to give you the demo file? Can we e-mail it to you?

2 : <%= System.DateTime.Now %> lol


---------------------------------------------------------------------------------------------------------------
Id: 4519517
title: Silverlight installation fails !!! errorID=1635
tags: silverlight
view_count: 245
body:

Every time I try to install silverlight (product version : 5.5.0031.0), I get an error, errorID=1635. It redirects me to the following link after clicking "More Information" link : http://www.microsoft.com/getsilverlight/resources/help.aspx?errorID=1635

Anybody experiencing the same? I have fresh installation of windows xp/IE8/vs2008/vs2010. Am I missing any hotfix or so here? Any idea?

Any help would be highly appreciated.

Thanks.

comments:

1 : you'll have better luck asking on Superuser. This site is more about programming questions.

2 : There is no even beta version of Silverlight 5 yet. How can you install 5.5.0031.0 ??? Are you sure you have written right version in your question?

3 : @griotspeak : I thought stackoverflow has "silverlight" tag included.. right ? BTW thanks for superuser ! seems to be a way to go :-)

4 : @Samvel : I get this from silverlight executable properties (alt+enter).. And its the "product version" which says 5.5.0031.0 o.O


---------------------------------------------------------------------------------------------------------------
Id: 4218489
title: Digitally sign a pdf in php
tags: php, pdf
view_count: 261
body:

I am looking for a script, which signs a pdf that is created on a webserver digitally. Can anybody recommend any script?

Many Thanks in Advance!

comments:

1 : This requires a bit more than just a script on a server. There are web services that do this. What country are you in?

2 : possible duplicate of http://stackoverflow.com/questions/2289827/how-can-i-digitally-sign-pdfs-created-dynamically-in-php

3 : I am located in germany. I already found one script, but I want to check alternatives before. I found this one:

4 : http://www.setasign.de/products/pdf-php-solutions/setapdf-signer/sign-pdf.php


---------------------------------------------------------------------------------------------------------------
Id: 5844499
title: Making IE9 Extension button pulse
tags: c#, .net, internet-explorer, internet-explorer-9
view_count: 206
body:

I am wanting to make an IE9 extension where I add an icon to the toolbar.

When I detect a given element on the page (lets say flash content) I want the icon to become enabled and have its color pulse (or some other slight animation that draws the users attention).

Developing Internet Explorer Extensions?

I'm currently using the above as a reference, given that how would I do this?

comments:

1 : A simple browser toolbar button control cannot do this. It's not possible to do this unless you have a toolbar (and even with a toolbar, the performance implications are generally pretty bleak). .

2 : Thanks for the feedback! Is it simile enough to have it as a toolbar button control and have it has one icon when the element isn't on the page (i.e. grayed out) and enabled when it is (i.e. the colored version of the icon)? Also from a performance perspective what is the best way to detect elements on a page (i.e. if there is any video)?


---------------------------------------------------------------------------------------------------------------
Id: 6108876
title: Accesability issue with incorect inline styles?
tags: html, css, accessibility
view_count: 48
body:

Im importing an XML feed which has some inline styles. However the styles are written incorrectly and dont actually do anything:

<font size="5"> text here </font>

I know that in an ideal world the xml feed wouldn't container inline styles or I would have a way to strip them out but thats not possible. Is their any accessibility or other issues with this code that doen't seem to do anything?

Thanks

comments:

1 : possible duplicate of [Inline styles bad for accessibility?](http://stackoverflow.com/questions/6108671/inline-styles-bad-for-accessibility)


---------------------------------------------------------------------------------------------------------------
Id: 4052153
title: "u.scrollTo is not a function" error when using serialScroll & localScroll jQuery plugins
tags: jquery, jquery-plugins
view_count: 287
body:

Firstly, I'm a real novice with debugging JavaScript/jQuery so please pardon any naivety on my part.

I'm trying to replicate a similar end product as is outlined within the following tutorial: http://jqueryfordesigners.com/coda-slider-effect/

The problem I am getting is when I attempt to reference $.localScroll(scrollOptions); but when this is loaded on the page FireBug reports u.scrollTo is not a function.

I should note this is a local file (so I don't think permissions is an issue). From what I can see my HTML mark-up, CSS & javaScript are all coded okay. The plugins are being reference correctly. Any suggestions would be greatly appreciated!

Below is the coding:

JS:

$(document).ready(function () {
var $panels = $('#slider .scrollContainer > div');
var $container = $('#slider .scrollContainer');
var horizontal = true;
if (horizontal) {
$panels.css({
'float' : 'left',
'position' : 'relative'
});

$container.css('width', $panels[0].offsetWidth * $panels.length);
}

var $scroll = $('#slider .scroll').css('overflow', 'hidden');

$scroll
.before('<img class="scrollButton left" src="images/button_arrow-previous.png" >')
.after('<img class="scrollButton right" src="images/button_arrow-next.png" >');


function selectNav() {
$(this)
.parents('ul:first')
.find('a')
.removeClass('selected')
.end()
.end()
.addClass('selected');
}

$('#slider .navigation').find('a').click(selectNav);

function trigger(data) {
var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
selectNav.call(el);
}

if (window.location.hash) {
trigger({ id : window.location.hash.substr(1) });
} else {
$('ul.navigation a:first').click();
}


var offset = parseInt((horizontal ?
$container.css('paddingTop') :
$container.css('paddingLeft'))
|| 0) * -1;

var scrollOptions = {
target: $scroll,
items: $panels,
navigation: '.navigation a',
prev: 'img.left', 
next: 'img.right',
axis: 'xy',
onAfter: trigger,
offset: offset,
duration: 500,
easing: 'swing'
};

$('#slider').serialScroll(scrollOptions);

$.localScroll(scrollOptions);

scrollOptions.duration = 1;
$.localScroll.hash(scrollOptions);
});

HTML:

<div id="slider" class="grid_11 suffix_1">
<ul class="navigation grid_1 alpha">
 <li><a href="#slide-1">1</a></li>
 <li><a href="#slide-2">2</a></li>
 <li><a href="#slide-3">3</a></li>
</ul>
<div class="scroll grid_10 omega">
 <div class="scrollContainer">
  <div class="panel" id="slide-1">
   <h2>ONE Lorem ipsum dolor sit amet consectetur adipisicing</h2>
   <h3>incididunt ut labore et dolore magna aliqua ad minim veniam</h3>
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce consequat velit sed erat tincidunt tempor. Etiam fermentum, mauris ut pharetra dignissim, lorem ante fringilla magna, ut mollis nunc purus sit amet libero. Phasellus at urna nec purus aliquam porttitor quis ac diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam a diam elit. Vivamus scelerisque pellentesque lorem, vel venenatis sapien viverra nec. Proin in mauris neque. Sed sit amet nisl nunc, sed mollis nisl. Quisque tristique, velit eu varius rhoncus, tellus nunc eleifend lorem, ut porttitor ligula urna et libero. Sed tincidunt neque sodales mauris viverra tincidunt. Donec lorem sem, malesuada vel vulputate vel, ullamcorper sed diam.</p>
   <p>Nulla neque leo, posuere ut fringilla vel, lobortis tincidunt elit. Aliquam a dui sit amet nisi rutrum interdum et a metus. Mauris sem dui, pulvinar non placerat vel, sollicitudin sit amet purus. Praesent volutpat auctor leo. Praesent eget porttitor ante. Morbi vulputate tellus vitae turpis tempus vel adipiscing nunc malesuada.</p>
   <p>Praesent volutpat auctor leo. Praesent eget porttitor ante. Morbi vulputate tellus vitae turpis tempus vel adipiscing nunc malesuada.</p>
  </div>
  <div class="panel" id="slide-2">
   <h2>TWO Lorem ipsum dolor sit amet consectetur adipisicing</h2>
   <h3>incididunt ut labore et dolore magna aliqua ad minim veniam</h3>
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce consequat velit sed erat tincidunt tempor. Etiam fermentum, mauris ut pharetra dignissim, lorem ante fringilla magna, ut mollis nunc purus sit amet libero. Phasellus at urna nec purus aliquam porttitor quis ac diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam a diam elit. Vivamus scelerisque pellentesque lorem, vel venenatis sapien viverra nec. Proin in mauris neque. Sed sit amet nisl nunc, sed mollis nisl. Quisque tristique, velit eu varius rhoncus, tellus nunc eleifend lorem, ut porttitor ligula urna et libero. Sed tincidunt neque sodales mauris viverra tincidunt. Donec lorem sem, malesuada vel vulputate vel, ullamcorper sed diam.</p>
   <p>Nulla neque leo, posuere ut fringilla vel, lobortis tincidunt elit. Aliquam a dui sit amet nisi rutrum interdum et a metus. Mauris sem dui, pulvinar non placerat vel, sollicitudin sit amet purus. Praesent volutpat auctor leo. Praesent eget porttitor ante. Morbi vulputate tellus vitae turpis tempus vel adipiscing nunc malesuada.</p>
   <p>Praesent volutpat auctor leo. Praesent eget porttitor ante. Morbi vulputate tellus vitae turpis tempus vel adipiscing nunc malesuada.</p>
  </div>
  <div class="panel" id="slide-3">
   <h2>THREE Lorem ipsum dolor sit amet consectetur adipisicing</h2>
   <h3>incididunt ut labore et dolore magna aliqua ad minim veniam</h3>
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce consequat velit sed erat tincidunt tempor. Etiam fermentum, mauris ut pharetra dignissim, lorem ante fringilla magna, ut mollis nunc purus sit amet libero. Phasellus at urna nec purus aliquam porttitor quis ac diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam a diam elit. Vivamus scelerisque pellentesque lorem, vel venenatis sapien viverra nec. Proin in mauris neque. Sed sit amet nisl nunc, sed mollis nisl. Quisque tristique, velit eu varius rhoncus, tellus nunc eleifend lorem, ut porttitor ligula urna et libero. Sed tincidunt neque sodales mauris viverra tincidunt. Donec lorem sem, malesuada vel vulputate vel, ullamcorper sed diam.</p>
   <p>Nulla neque leo, posuere ut fringilla vel, lobortis tincidunt elit. Aliquam a dui sit amet nisi rutrum interdum et a metus. Mauris sem dui, pulvinar non placerat vel, sollicitudin sit amet purus. Praesent volutpat auctor leo. Praesent eget porttitor ante. Morbi vulputate tellus vitae turpis tempus vel adipiscing nunc malesuada.</p>
   <p>Praesent volutpat auctor leo. Praesent eget porttitor ante. Morbi vulputate tellus vitae turpis tempus vel adipiscing nunc malesuada.</p>
  </div>
 </div>
</div>

File references:

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.main-nav.js"></script>
<script type="text/javascript" src="js/jquery.main-form.js"></script>
<script type="text/javascript" src="js/jquery.scrollTo-1.4.2-min" ></script>
<script type="text/javascript" src="js/jquery.serialScroll-1.2.2-min.js" ></script>
<script type="text/javascript" src="js/jjquery.localscroll-1.2.7-min.js" ></script>

I can provide more information if it helps!

comments:

1 : Note that 'jquery' is misspelled here. (line 6, file references.)

2 : Which file is that JS in?

3 : The js I've quoted is located within the HTML page at the moment (just whilst I was getting it developed). It's inserted just below the JS file references.


---------------------------------------------------------------------------------------------------------------
Id: 6096398
title: byte array to string
tags: android, string, bytearray
view_count: 827
body:

I want to convert byte array to string in android. what I have done is:

ImageView imgv=new ImageView(context);
imgv.setImageResource(R.drawable.splash_ephoto_android);
Bitmap b2=((BitmapDrawable)imgv.getDrawable()).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
b2.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray1 = stream.toByteArray();
String strTemp= Base64.encodeToString(byteArray1,0,byteArray1.length,Base64.DEFAULT);

but here strTemp showing in incomplete string, it is showing three dots at end and its not a complete conversion.

I have read many threads regarding the same. Am I missing something? Please help.

comments:

1 : here strTemp showing in incomplete string - where is "here"? In Eclipse debugger?

2 : What do you mean by 3 dots at the end? Are you sure that your debugger is displaying the full string? Most debuggers cut long strings for display purposes.

3 : Yes in debugger view its showing incomplete string. And if I append anything to this string it do not append. so I thought the conversion is not proper.

4 : @Pooja: No, it's just the debugger view, not the actual value.

5 : then why debugger not showing rest of the string?

6 : @Pooja: debugger will not show full string.. it has some specific limit, after which it will display 3 dots.. but its not incomplete string. Are you getting issue in this?


---------------------------------------------------------------------------------------------------------------
Id: 5644118
title: Android is there a way to set default timeout for an Activity and detect when this has been reached?
tags: android
view_count: 165
body:

Need to detect when my activity has not seen any clicks for more than say 20 seconds. Is there a default timeout on this that can be set and when it expires can the event be caught. I guess this is really asking if onPause has a setting that effects it? Or could it just get called whenever Android thinks it needs to be paused. I need to save power after 20 seconds so I really need a way to detect this. Thanks

comments:

1 : what is it you are trying to acheive? and have you looked at the life cycle flow diagram in the sdk? http://developer.android.com/guide/topics/fundamentals/activities.html

2 : yeah thats the lifecycle of a single activity. What does that have to do with overall inactivity for an app? since it might pause for various reasons.

3 : onPause() The system calls this method as the first indication that the user is leaving your activity (though it does not always mean the activity is being destroyed). This is usually where you should commit any changes that should be persisted beyond the current user session (because the user might not come back).

4 : a lot of help help that is with the question.


---------------------------------------------------------------------------------------------------------------
Id: 4631709
title: Disable Internet w/o root access for OSX
tags: osx, internet, disable
view_count: 197
body:

I was hoping someone had a clever solution to a problem I'm facing. I need to find a way to disable the internet on a mac OSX system without root access. Besides the obvious pulling out the ethernet cable, I'm at a loss for options. I know that I can change the etc/hosts file, but this prompts for the root password. Any clever way to do this without prompting for the root password would be much appreciated.

comments:

1 : What is your goal in disabling the internet access? Are you trying to disable it for testing an application?

2 : the goal is to create an app for procrastinators that cannot control themselves from surfing when they should be working. I didn't think there would be a marketspace for this until many of my mac-owning friends asked me if such an app existed. The idea is that they could disable it for some fixed length of time. The root access stipulation is a result of the apple's restrictions on prompting for the root password by apps.

3 : Network access is really only a few things: network adapter (wired or wireless), name resolution (DNS and hosts files), and routing tables (most importantly, default route). All 3 are system-level things and would require root to change, I would expect. I wonder if parental controls are userland and have an API...

4 : Thank you Joe for the very clear overview.

5 : If you find a way to do this, then please file a report about it at http://bugreport.apple.com.


---------------------------------------------------------------------------------------------------------------
Id: 5262535
title: youtube comment box c#
tags: c#, youtube, html-parsing, youtube-api, screen-scraper
view_count: 170
body:

how would i go about submitting a comment through my application onto a random video. I am making a program similar to stumbleupon where a random video is viewed, once the video has been watched, it gives the user the opportunity to post a comment.

comments:

1 : Did you take a look whether the [YouTube API](http://code.google.com/apis/youtube/overview.html) can help you?

2 : i dont really know what much of it means? like where i should be looking.

3 : [Here](http://code.google.com/apis/youtube/2.0/reference.html#Comments_Feeds) I guess - but looks like it's read-only. How would you authenticate the users to comment, though? Post all comments as a single user for your site? Or did you mean storing / managing the comments locally and not submitting them to YouTube's video page?


---------------------------------------------------------------------------------------------------------------
Id: 6725346
title: Problem with LayoutInflator to set TextView Android
tags: android, layout, textview, android-inflate
view_count: 269
body:

Hey folks Im using two layouts, one embedded through an 'include' in the main layout file. I wish to set the TextView in the embedded one within the activity for the main xml. Here's what I've come up with so far......

Main xml: date_list_layout.xml

<RelativeLayout android:id="@+id/RelativeLayout01"
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent"
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:background="@drawable/bgoption">

<include layout="@layout/cur"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />

</RelativeLayout>

Embedded xml: cur.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

  <TextView android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:id="@+id/currency"  
  android:textSize="14px"
  android:paddingLeft="10dp"
  android:textColor="#d17375"
  ></TextView>

</LinearLayout>

Then my Activity code sets the content to the main xml but tries to inflate the embedded one to set the text as follows......

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.date_list_layout);

View v  = LayoutInflater.from(getBaseContext()).inflate(R.layout.cur,
            null);

    TextView currency = (TextView) v.findViewById(R.id.currency);
    currency.setText("test");

}

I'm not getting any errors but the TextView remains empty. Any ideas what I'm doing wrong

Thanks A

comments:

1 : Try to use the view directly as TextView currency = (TextView) findViewById(R.id.currency);(remove "View" reference v),it may help you,you can get the included layout information directly

2 : Yep it does indeed, thanks for that.

3 : As @riser pointed out: once you have `include`d cur.xml you no longer need to inflate manually. It is automatically inserted into the structure, so you can safely remove the additional `LayoutInflater` call.


---------------------------------------------------------------------------------------------------------------
Id: 5269316
title: New fan page issue
tags: php, facebook
view_count: 35
body:

Facebook has changed the fan page format. Instead of tabs they now have links on the left hand side of the page.

There appears to have an issue(atleast for me) in IE6 and IE7 when user clicks on the comment links the post it self disappears instead of showing the comment text area and the submit button.

Anyone for this.

Thanks

comments:

1 : Does this have anything to do with programming?

2 : I'm curious as to why this question got an up vote...


---------------------------------------------------------------------------------------------------------------
Id: 5855557
title: WCF service problem with Windows XP client
tags: wcf
view_count: 129
body:

I have a program for Windows Application with the Bank uses a WCF service. Several Windows 7 client using this service are working well, one of the Windows XP client, and when the service is connected and started working, service to any of the other client does not respond; until Windows XP client relationship is discontinued. Thanks and respect.

comments:

1 : that service, what exactly do?


---------------------------------------------------------------------------------------------------------------
Id: 5476648
title: jQuery FullCalendar w/ jQueryUI theme, changing Calendar CELL not DIV for each date
tags: jquery-ui, fullcalendar
view_count: 488
body:

I have been looking around and I guess I just don't get this part. Here is what I am trying to do, if anyone has seen an article that tells me what to do please let me know, thanks!

1) I would like it so each time the calendar opens the days that are not 'other months' will be green by default, the other months will stay grey

2) I have created a DB that will store the events and their dates. All events are full day events. I would like it so when the calendar is rendered the calendar will change from green to red. NOT THE EVENT, but the Calendar in the background. The events will have their own colors.

-- Or maybe I just need to make the event colors red and somehow make the event take over the full background of the day cell, if that's possible okay..

I just can't figure out how to get this done automatically. I am using a jQueryUI theme and in order to change the color of the cell I need to remove the background image and change the bg color, but when I click on the next month it's not correct..

any help would be appreciated, I was going to read all the docs today and see where I was wrong, but website down..

comments:

1 : Forgive me, after looking much further I found this;

2 : [link]http://code.google.com/p/fullcalendar/issues/detail?id=74[/link]


---------------------------------------------------------------------------------------------------------------
Id: 3760155
title: What are the different ways of combining C++ and C#?
tags: c#, visual-c++, unmanaged, managed
view_count: 122
body:

Possible Duplicate:
Writing a DLL in C/C++ for .Net interoperability

I am writing a school project in C++, where I would like to have a GUI written in C# with WPF.

This leads me to my question:

What are the different ways of combining unmanaged C++ and C# and what are the advantages of each?

Preferably I would like to have standard C++ code in a separate project, which I will then wrap (if needed), so I can build the C++ with a shell interface on Linux.

I am using VS2010 Ultimate.

Note: Writing the code in C# is not relevant. There are some details in the algorithm which make STL more suited than the equivalent classes on .NET. I would also like unmanaged code, so I can test the performance without GC pauses.

comments:

1 : Possible duplicate of [Writing a DLL in C/C++ for .Net interoperability](http://stackoverflow.com/questions/3726829)

2 : The answer I gave in the linked question doesn't really emphasize portability or use from a native C++ application. You can make that easier with a macro, the usual way of doing it is: In your header file, all the function declarations look like `JORGENAPI(returntype) PublicFunc(params);` In your project, the definition is `#define JORGENAPI(returntype) extern "C" returntype __stdcall __declspec(dllexport)` In consumer projects `#define JORGENAPI(returntype) extern "C" returntype __stdcall __declspec(dllimport)` and then you can define the macro differently for linux.

3 : I don't think the linked question even begins to cover the same ground as this question - it should definitely be re-opened.

4 : @Ben, Kragen: Point taken, voting to reopen.

5 : @Kragen: Can you give an example of what is covered by this question and not the other one? It's possible that some of the answers to the other one could use some more elaboration or comments, but I do think that the other question is broad enough to cover this.

6 : I've merged my comment here into my other answer to make it better cover the topic of building C++ libraries that can be called from C# (as well as other languages).

7 : Some of the answers for the other questions are definitely relevant, but I am not trying to create a DLL, nor am I trying not to. I just want to make my C++ work with C# as seamlessly as possible, but with a clean interface between GUI and backend.


---------------------------------------------------------------------------------------------------------------
Id: 5620728
title: Submitting form on ASPX page with snoopy php class - problem with view state
tags: asp.net, snoopy
view_count: 400
body:

I am using snoopy to submit a form on a .aspx page of another website. I have grabbed all the headers/cookies and values from that form and passing it to the form with Snoopy. It is going to that however i am getting error of "viewstate" that is "Viewstate is invalid". I have copied the view state field from the form's source code and pass it as well. However, still it is giving same error.

Can anyone let me know how can i submit a form on that .aspx form. Below is the code i am using :

$snoopy->referer="http://www.URL.com/default.aspx";
$snoopy->agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
$snoopy->rawheaders['Content-Type']="application/x-www-form-urlencoded"; 
$snoopy->rawheaders['Cache-Control']="private";
$snoopy->cookies['ASP.NET_SessionId']="adeqeteqerqrqqeq";


$submit_vars['__EVENTTARGET']="";
$submit_vars['__EVENTARGUMENT']=""; 
$submit_vars['__LASTFOCUS']="";
$submit_vars['__VIEWSTATE']=urldecode("/qqeaddgqradeapoioq==");
$submit_vars['__EVENTVALIDATION']=urldecode("/addafadfaerttq/aa/yqea");
$submit_vars['ctl00$ContentPlaceHolder1$lstc']="1";
$submit_vars['ctl00$ContentPlaceHolder1$lstm']="11";
$submit_vars['ctl00$ContentPlaceHolder1$lstce']="16";
$submit_vars['ctl00$ContentPlaceHolder1$lstt']="18289";
$submit_vars['ctl00$ContentPlaceHolder1$btnSad']="Submit";

$submit_url = "http://www.URL.com/Default.aspx";

$snoopy->submit($submit_url,$submit_vars);

Thanks

comments:

1 : Sounds like you try to make a hack, automation of many submits.

2 : well, i am trying to get the search results. The owner of the website does not have any objection, neither he mentioned anything in TOS so it is legal to get the search results.


---------------------------------------------------------------------------------------------------------------
Id: 6814946
title: How to update the position of a Popup on Window.LocationChanged Event
tags: wpf, xaml, popup
view_count: 284
body:

Possible Duplicate:
How to move a WPF Popup?

<Window LocationChanged="Window_LocationChanged">
    <Grid>
    <Grid.RowDefinitions>
        <!-- ... -->
    </Grid.ColumnDefinitions>
        <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding .}" x:Name="PageCP"/>
        <!-- ... -->
        <Popup Placement="Center" PlacementTarget="{Binding ElementName=PageCP}" PopupAnimation="Fade" x:Name="popup" IsOpen="False" MinWidth="200">
            <!-- ... -->
        </Popup>
    </Grid>
</Window>

This is my Setup and I open the Popup if needed. But when the Popup is opened and I move the Window around, the Popup stays at the position at which it was openend. Is there a neat way to update the position to the PlacementTarget or do I need to update/calculate this manually?

comments:

1 : hmm, didn't found that one? Thank you


---------------------------------------------------------------------------------------------------------------
Id: 6745187
title: android:How can i chage the View of Tabs like as Background cour etc..like Cusotme Tab bar in android?
tags: android
view_count: 44
body:

Please give me any link or any tutorials so I can learn from that.

comments:

1 : have a look at the following link http://stackoverflow.com/questions/6532170/newbie-how-to-change-tab-font-size/6532553#6532553

2 : This Link will very useful for you for Custom Tab in android [Custom Tab](http://pareshnmayani.wordpress.com/2011/07/03/android-%E2%80%93-change-tab-bar-background-image/) another is [custom Tab](http://www.paxmodept.com/telesto/blogitem.htm?id=810) and [Custom Tab](http://www.gregbugaj.com/?p=6) I Hope it will useful to you


---------------------------------------------------------------------------------------------------------------
Id: 4582990
title: how to select row in spinner for known rowid?
tags: android, spinner
view_count: 321
body:

When i open Activity for EditRecord i want to select spinner row for adequate value in edited record I find code like below, but its ok for few records in spinner, but when spinner.cursor contains many records i think its not right idea. Is any other method to select spinner row for known rowid ?

Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter(new SimpleCursorAdapter(...));
for (int i = 0; i < spinner.getCount(); i++) {
   Cursor value = (Cursor) spinner.getItemAtPosition(i);
   long id = value.getLong(value.getColumnIndex("_id");
   if (id == rowid) {
      spinner.setSelection(i);
   }
}
comments:

1 : I didnt get what you are tring to do from above code you are enumerating all spinner values and then setting them as selection I dont think this is what you wanted

2 : I want to select row in spinner control for given recordId. In codae avoe i go for each record for locate what position has given rowid. Next i select this record. This code do what i want, but its not efficient, i looking for better solution: see subject


---------------------------------------------------------------------------------------------------------------
Id: 3540719
title: Flex AdvancedDataGrid tree node dosn't display the whole string value when the number of lines in the string is higher than the row height?
tags: flex, advanceddatagrid
view_count: 363
body:

I'm using AdvancedDataGrid to display data in a tree, variableRowHeight = true.

The problem is that if the value of the node is too high from the row height (according to the resolution) then only part of the node value is displayed and the scroll of the tree jumps directly to the next line without being able to scroll/view the whole value of the previous node. any idea how to handle this irritating bug!

Update:

here I'm posting a simple example application source that demostrates the problem:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;

            [Bindable]
            private var dpHierarchy:ArrayCollection= new ArrayCollection([
                {name:"Grandpa", total:70, children:[
                    {name:"kernel32.dll, 0x76dee0e0\n" +
                    "mscorwks.dll, 0x000007fef981f0bd\n" +
                    "mscorwks.dll, 0x000007fef9dd2ed0\n" +
                    "App_Web_vc6wsfpc.dll, 0x06000050\n" +
                    "SYSTEM.WEB.REGULAREXPRESSIONS.DLL, 0x060000a2\n" +
                    "SYSTEM.WEB.DLL, 0x060059e0\n" +
                    "SYSTEM.WEB.DLL, 0x06002db7\n" +
                    "SYSTEM.WEB.DLL, 0x06002db8\n" +
                    "SYSTEM.WEB.DLL, 0x0600309f\n" +
                    "SYSTEM.WEB.DLL, 0x06003098\n" +
                    "SYSTEM.WEB.DLL, 0x06003097\n" +
                    "SYSTEM.WEB.DLL, 0x06003092\n" +
                    "App_Web_vc6wsfpc.dll, 0x0600006a\n" +
                    "SYSTEM.WEB.DLL, 0x06000728\n" +
                    "SYSTEM.WEB.DLL, 0x06000725\n" +
                    "SYSTEM.WEB.DLL, 0x06000729\n" +
                    "SYSTEM.WEB.DLL, 0x0600072a\n" +
                    "App_Web_vc6wsfpc.dll, 0x06000013\n" +
                    "SYSTEM.WEB.DLL, 0x060040a7\n" +
                    "SYSTEM.WEB.DLL, 0x060040aa\n" +
                    "SYSTEM.WEB.DLL, 0x06003048\n" +
                    "SYSTEM.WEB.DLL, 0x0600309f\n" +
                    "SYSTEM.WEB.DLL, 0x06003098\n" +
                    "SYSTEM.WEB.DLL, 0x06003097\n" +
                    "SYSTEM.WEB.DLL, 0x06003092\n" +
                    "App_Web_vc6wsfpc.dll, 0x0600004d\n" +
                    "SYSTEM.WEB.DLL, 0x06000226\n" +
                    "SYSTEM.WEB.DLL, 0x060001d6\n" +
                    "SYSTEM.WEB.DLL, 0x06000242\n" +
                    "SYSTEM.WEB.DLL, 0x060001e8\n" +
                    "SYSTEM.WEB.DLL, 0x0600069d\n" +
                    "SYSTEM.WEB.DLL, 0x060021f1\n" +
                    "SYSTEM.WEB.DLL, 0x060021f0\n" +
                    "SYSTEM.WEB.DLL, 0x06000000\n" +
                    "SYSTEM.WEB.DLL, 0x000007fef4bb6c34\n" +
                    "mscorwks.dll, 0x000007fef998b07a\n" +
                    "WEBENGINE.DLL, 0x000007fef0134f27\n" +
                    "WEBENGINE.DLL, 0x000007fef0135fb9\n" +
                    "WEBENGINE.DLL, 0x000007fef013182e\n" + 
                    "WEBENGINE.DLL, 0x000007fef0131e94", total:130},                    
                    {name:"Joe Smith", total:229}, 
                    {name:"Alice Treu", total:230}
                ]}
            ]);         
        ]]> 
    </mx:Script>

    <mx:AdvancedDataGrid id="myADG" 
                         width="100%" height="100%" 
                         variableRowHeight="true">
        <mx:dataProvider>
            <mx:HierarchicalData source="{dpHierarchy}"/>
        </mx:dataProvider>
        <mx:columns>
            <mx:AdvancedDataGridColumn dataField="name" headerText="Name"/>
            <mx:AdvancedDataGridColumn dataField="total" headerText="Total"/>
        </mx:columns>   
    </mx:AdvancedDataGrid>  
</mx:Application>

just copy this code and run it in Flex IDE, try to change the browser's height and you'll see that you cannot view the whole value of the node with the long string value!, the scroll jumps to view the next nodes.

Any idea?!


here I'm posting a simple example application source that demostrates the problem:

<mx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;

        [Bindable]
        private var dpHierarchy:ArrayCollection= new ArrayCollection([
            {name:"Grandpa", total:70, children:[
                {name:"kernel32.dll, 0x76dee0e0\n" +
                "mscorwks.dll, 0x000007fef981f0bd\n" +
                "mscorwks.dll, 0x000007fef9dd2ed0\n" +
                "App_Web_vc6wsfpc.dll, 0x06000050\n" +
                "SYSTEM.WEB.REGULAREXPRESSIONS.DLL, 0x060000a2\n" +
                "SYSTEM.WEB.DLL, 0x060059e0\n" +
                "SYSTEM.WEB.DLL, 0x06002db7\n" +
                "SYSTEM.WEB.DLL, 0x06002db8\n" +
                "SYSTEM.WEB.DLL, 0x0600309f\n" +
                "SYSTEM.WEB.DLL, 0x06003098\n" +
                "SYSTEM.WEB.DLL, 0x06003097\n" +
                "SYSTEM.WEB.DLL, 0x06003092\n" +
                "App_Web_vc6wsfpc.dll, 0x0600006a\n" +
                "SYSTEM.WEB.DLL, 0x06000728\n" +
                "SYSTEM.WEB.DLL, 0x06000725\n" +
                "SYSTEM.WEB.DLL, 0x06000729\n" +
                "SYSTEM.WEB.DLL, 0x0600072a\n" +
                "App_Web_vc6wsfpc.dll, 0x06000013\n" +
                "SYSTEM.WEB.DLL, 0x060040a7\n" +
                "SYSTEM.WEB.DLL, 0x060040aa\n" +
                "SYSTEM.WEB.DLL, 0x06003048\n" +
                "SYSTEM.WEB.DLL, 0x0600309f\n" +
                "SYSTEM.WEB.DLL, 0x06003098\n" +
                "SYSTEM.WEB.DLL, 0x06003097\n" +
                "SYSTEM.WEB.DLL, 0x06003092\n" +
                "App_Web_vc6wsfpc.dll, 0x0600004d\n" +
                "SYSTEM.WEB.DLL, 0x06000226\n" +
                "SYSTEM.WEB.DLL, 0x060001d6\n" +
                "SYSTEM.WEB.DLL, 0x06000242\n" +
                "SYSTEM.WEB.DLL, 0x060001e8\n" +
                "SYSTEM.WEB.DLL, 0x0600069d\n" +
                "SYSTEM.WEB.DLL, 0x060021f1\n" +
                "SYSTEM.WEB.DLL, 0x060021f0\n" +
                "SYSTEM.WEB.DLL, 0x06000000\n" +
                "SYSTEM.WEB.DLL, 0x000007fef4bb6c34\n" +
                "mscorwks.dll, 0x000007fef998b07a\n" +
                "WEBENGINE.DLL, 0x000007fef0134f27\n" +
                "WEBENGINE.DLL, 0x000007fef0135fb9\n" +
                "WEBENGINE.DLL, 0x000007fef013182e\n" + 
                "WEBENGINE.DLL, 0x000007fef0131e94", total:130},                    
                {name:"Joe Smith", total:229}, 
                {name:"Alice Treu", total:230}
            ]}
        ]);         
    ]]> 
</mx:Script>

<mx:AdvancedDataGrid id="myADG" 
                     width="100%" height="100%" 
                     variableRowHeight="true">
    <mx:dataProvider>
        <mx:HierarchicalData source="{dpHierarchy}"/>
    </mx:dataProvider>
    <mx:columns>
        <mx:AdvancedDataGridColumn dataField="name" headerText="Name"/>
        <mx:AdvancedDataGridColumn dataField="total" headerText="Total"/>
    </mx:columns>   
</mx:AdvancedDataGrid>  

just copy this code and run it in Flex IDE, try to change the browser's height and you'll see that you cannot view the whole value of the node with the long string value!, the scroll jumps to view the next nodes.

Any idea?!

comments:

1 : Show some code; preferably a runnable sample demonstrating the problem. My first guess is that your itemRenderer is not measuring itself correctly.

2 : I'm not using itemRenderer for this column (the colomn of the tree where I see the node value). I have a string that contains about 50 rows that should be a value of one node, but the node in the advanceddatagrid tree shows only 40 rows of the string.


---------------------------------------------------------------------------------------------------------------
Id: 4670978
title: resizing comma disappears
tags: button, resize
view_count: 26
body:

I am writing a virtual keyboard, and the comma (and period) is rather small, so I would like to make it bigger. The buttons which house the keys are currently 19 by 18 pixels and I can't resize them much. What I have and works (to a point) is

The fontsize works when I go smaller, but when I put in a value greater than 12, the comma straight up entirely disappears. If you would know how to fix this bug, or an alternative method of making a large comma in the content of a button, I would be very thankful.

comments:

1 : You haven't specified a platform/toolkit/language, which makes this impossible to answer.

2 : sorry, xaml/cs.


---------------------------------------------------------------------------------------------------------------
Id: 6860355
title: Consecutive Ajax Calls Return Data Inconsistently
tags: jquery, ajax
view_count: 132
body:

I have a task to enhance an existing C# SharePoint application which displays schedules for personnel.

I don't have the freedome to use a jQuery plugin calendar. I need to stick with the current code but try to apply jQuery to it to speed up the performance. The current aplication rterirves all the schedules at once and then paints them onto the table. The issue is that the data call can be too large and the page takes forever to load. My task is to retrieve the data for individuals one by one and paint them one by one.

Currently, I am using the jQuery 1.5 deferred object's 'when' to populate required parameters first, and 'then' with the userids get the users schedule data asynchronosly. Each call returns a dataset containing two datatables... one with user info, and the other containing user's scheduled events. The trouble is that the data comes back inconsistently. When stepping through the code, I see that the user info returned does not always match the event data that should be tied to the user.

As I mentioned before, I am using deferred object, have tried it without the object, have uncsuccsessfully tried to add a delay between each data call, and am just getting plain confused.

Not sure if anyone can help me, but if you have suggestions, I'd surely appreciate hearing them. Thanks in advance for any ideas.

 //  When page loads
    $(document).ready(function () {
        // The following block uses the jQuery.Deferred() object, introduced in jQuery 1.5
        // See http://api.jquery.com/category/deferred-object/
        // the object allows us to chain callbacks, **in the order specified**
        // Get date range            
        debugger;
    //GetStartDate(), GetEndDate() populates date range
    //PopulateParams() does that for remaining parameters
        $.when(GetStartDate(), GetEndDate())
        .then(function () {
            PopulateParams();
            GetUserSchedule();
        })
        .fail(function () {
            failureAlertMsg();

        })
    });



    // Returns schedule for each person listed in between selected start and end dates
    function GetUserSchedule() {
         for (var i = 0; i < arrRequests.length; i++) {
            // Ajax call to web method, passing in string
            $.ajax({
                type: "POST",
                url: "/_layouts/epas/scheduler/default.aspx/GenerateUserSchedules",
                data: arrRequests[i],   // example data: {"UserId":"6115","startDate":"\"7/1/2011\"","endDate":"\"7/31/2011\"","ddlGroupSelectedItem":"Z8OK","ddlGroupSelectedValue":"Z8OK#","ddlOrgSelectedValue":"2"}
                contentType: "application/json",
                dataType: "json",
                success: SuccessFunction,
                error: function (d) { alert('Failed' + d.responseText + '\nPlease refresh page to try again or contact administrator'); }
            })
        }
    }

    // On successful completion of call to web method, paint schedules into HTML table for each user
    function SuccessFunction(data) {            
        if (data != null && data.d != null && data.d.Temp != null) {

        // Calls a bunch of functions to paint schedule onto HTML table
        // Data contains two tables: one contains user info and the other contains rows of info for each event for user
        // at times, the user info is not the correct user or the events are not correct for user
    }   

}

comments:

1 : Please add some sample code to your question.

2 : @Brandon Boone Ok, I added some code to show how I am trying to accomplish my goal

3 : See my discovery/answer here: http://stackoverflow.com/questions/6899441/is-there-a-way-to-ensure-that-the-first-ajax-call-completes-before-the-subsequent

4 : See my discovery/answer here: http://stackoverflow.com/questions/6899441/is-there-a-way-to-ensure-that-the-first-ajax-call-completes-before-the-subsequent


---------------------------------------------------------------------------------------------------------------
Id: 4919857
title: How One App Sees Location Without Asking
tags: geolocation
view_count: 91
body:

How One App Sees Location Without Asking without the use of ip2location?

comments:

1 : Like when you want to spy on someone?

2 : Not of course like Iphone geolocation did.


---------------------------------------------------------------------------------------------------------------
Id: 5651027
title: Doctrine deducting last s from table_class name (making offers to offer)
tags: php, mysql, orm, doctrine
view_count: 23
body:

When Doctrine connection doing flush, it is reducing the table-class name from Restaurant_special_offers to Restaurant_special_offer.

My ORM Table definition is bellow -

class Restaurant_special_offers extends Doctrine_Record {

    public function setTableDefinition() {
        $this->hasColumn('id', 'integer', 11);
        $this->hasColumn('restaurant_id', 'integer', 11);


    }

    public function setUp() {
        $this->setTableName('restaurant_special_offers');
        $this->hasOne('Special_offers', array(
            'local' => 'offer_id',
            'foreign' => 'id'
        ));   
    }

}

And DQL is -

Doctrine_Query::create()
                            ->select()
                            ->from('Restaurant_special_offers as rof')
                            ->leftJoin('rof.Special_offers as sof')                            
                            ->where('rof.id=?', $id);

Before to do flush Doctrine do parse and at that time it reducing the table name Restaurant_special_offers to Restaurant_special_offer.

Why it happened, Could you please help me about this.

comments:

1 : One more argument for using singular in Doctrine class names.

2 : You should read this : http://stackoverflow.com/questions/4100489/table-naming-convention-with-doctrine-orm


---------------------------------------------------------------------------------------------------------------
Id: 6523455
title: C# LINQ Sugesstion required
tags: c#, linq, tableadapter
view_count: 81
body:

I am in process of learning LINQ with optimized queries . The following is a method written that queries the standard Northwind database included with MS SQL. It returns the average price paid per item given a customer ID. Please review and critique the method as if it exists verbatim in a production environment. Thanks !

public static Decimal getapp(string cid) {
    var ta1 = new NorthwindDataSetTableAdapters.OrdersTableAdapter();
    var ta2 = new NorthwindDataSetTableAdapters.Order_DetailsTableAdapter();
    var ta3 = new NorthwindDataSetTableAdapters.ProductsTableAdapter();
    var ta4 = new NorthwindDataSetTableAdapters.CategoriesTableAdapter();

    var dt1 = ta1.GetData(); // SELECT * FROM Orders
    var dt2 = ta2.GetData(); // SELECT * FROM [Order Details]

    var customerOrders = dt1.Where(r => r.CustomerID == cid);
    var customerOrderItems = dt2.Where(r => customerOrders.Any(co => (co.OrderID == r.OrderID)));

    Decimal totq = Convert.ToDecimal(0.0);
    Decimal totp = Convert.ToDecimal(0.0);

    foreach (NorthwindDataSet.Order_DetailsRow dr in dt2) {
        if (customerOrderItems.Any(r => r.ProductID == dr.ProductID)) {
            var product = ta3.GetData().First(r => r.ProductID == dr.ProductID); // ta3.GetData -> SELECT Products.* FROM Products"
            var cagteory = ta4.GetData().First(r => r.CategoryID == product.CategoryID); // ta4.GetData -> SELECT Categories.* FROM Categories

            if (cagteory.CategoryName != "Condiments") {
                totq = totq + dr.Quantity;
                totp = totp + (dr.UnitPrice * dr.Quantity);
            }
        }
    }

    return totp / totq;
    }
comments:

1 : I suspect there are other sites for which this "question" would be better suited. This isn't a code review site. Voting to close.

2 : You might want to post this on http://codereview.stackexchange.com/

3 : http://codereview.stackexchange.com/


---------------------------------------------------------------------------------------------------------------
Id: 6499526
title: Moles and Binding Redirects
tags: moles, pex-and-moles
view_count: 184
body:

The scenario I have is pretty common, one nuget package is using V1.0 and another is using V1.1 so I had to add a Binding Redirect. However, the moles runner appears to be ignoring the binding redirect in both the App.config and assembly config file.

To load the App.config I am using the code found on: How To Read UnitTest Project's App.Config From Test With HostType("Moles")

Any ideas?

Ok took me some time but I have figured out how to mimic the behavior of Binding Redirect. This is the code that I did for that. Leave this as Wiki to allow others to improve upon this code:

<!-- language: lang-cs -->
public static void MoleBindingRedirect()
{
    try
    {
        var fileMap = new ExeConfigurationFileMap();
        Assembly assembly = Assembly.GetExecutingAssembly();
        fileMap.ExeConfigFilename = assembly.Location + ".config";

        Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
        ConfigurationSection assemblyBindingSection = config.Sections["runtime"];

        var sectionRoot = XDocument.Parse(assemblyBindingSection.SectionInformation.GetRawXml()).Root;
        var assemblyBinding = sectionRoot.Elements(XName.Get("assemblyBinding", "urn:schemas-microsoft-com:asm.v1"));
        if (assemblyBinding == null)
            return;        

        AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
        {
            var assemblyToLoad = new AssemblyName(args.Name);
            var query = from dependency in assemblyBinding.Elements(XName.Get("dependentAssembly", "urn:schemas-microsoft-com:asm.v1"))
                        from identity in dependency.Elements(XName.Get("assemblyIdentity", "urn:schemas-microsoft-com:asm.v1"))
                        from attribute in identity.Attributes()
                        where attribute.Value == assemblyToLoad.Name
                        select dependency;

            if (!query.Any())
                return null;

            var assemblyDefinition = query.First();

            var identityElement = assemblyDefinition.Element(XName.Get("assemblyIdentity", "urn:schemas-microsoft-com:asm.v1"));
            var bindingRedirectElement = assemblyDefinition.Element(XName.Get("bindingRedirect", "urn:schemas-microsoft-com:asm.v1"));

            var assemblyName = identityElement.Attribute("name").Value;
            var assemblyPublicKeyToken = identityElement.Attribute("publicKeyToken");
            var assemblyCulture = identityElement.Attribute("culture");
            var assemblyVersion = bindingRedirectElement.Attribute("newVersion").Value;

            if (assemblyPublicKeyToken != null && !string.IsNullOrWhiteSpace(assemblyPublicKeyToken.Value))
                assemblyName += ", PublicKeyToken=" + assemblyPublicKeyToken.Value;

            if (assemblyCulture != null && !string.IsNullOrWhiteSpace(assemblyCulture.Value))
                assemblyName += ", Culture=" + assemblyCulture.Value;

            if (!string.IsNullOrWhiteSpace(assemblyVersion))
                assemblyName += ", Version=" + assemblyVersion;

            return Assembly.Load(assemblyName);
        };
    }
comments:

1 : Anyone knows how to apply the lang-cs syntax highlight? It seams to be non working.

2 : Worked like a charm! Thanks!


---------------------------------------------------------------------------------------------------------------
Id: 5978657
title: How to check unassigned value of enum in c++
tags: c++, enums, unassigned-variable
view_count: 166
body:

Possible Duplicate:
How to check if enum value is valid?

HI, I have a ENUM variable without intializing the values to each enum value. i.e. enum TEST ={VALUE1,VALUE2,VALUE3};

Now, I create a variable (ENUM_TEST) of type TEST and values VALUE2 to it. How can I check that the ENUM_TEST is having valid value or not?? When I tried printing ENUM_TEST, I could see a special character instead of VALUE2 or 1 ( as this is a default value for enum when we dont initialize).

Any help is greately appreciated.

Thanks

comments:

1 : Note that this is not "assignment".

2 : Why try to *describe* code rather than simply posting it?

3 : Most likely you are printing with the wrong format. Print it with `%d` and not `%c`.


---------------------------------------------------------------------------------------------------------------
Id: 4739655
title: Windows 7: "DatabaseAssist is not working"
tags: c#, .net, sql-server, windows-7
view_count: 56
body:

I have a simple application that backs up or restores a MS SQL database. After adding the ability to process a few command line parameters and to write to an error log, it now fails under Windows 7 with ""DatabaseAssist is not working". It runs fine under XP, and can still be run successfully in Compatabilty Mode. The previous version of the program always worked without complaint on either XP or Win 7.

The recent changes to the code have no relation to accessing the database. I am not able to find any reference to "DatabaseAssist" in MSDN or via Google. When I am able to get Win 7 on the development PC I will track down the exact point of failure, but in the meantime I'm curious about what "DatabaseAssist" is all about.

Edit: Oops, of course - written in C#, .net using VS 2008.

Can anyone shed some light on this for me?

Thanks.

comments:

1 : "Run as Administrator" allows this app to run normally, but although that provides a pretty good hint as to what the issue is, it still does not identify "DatabaseAssist" for me. I would have hoped that if Microsoft used that identifier in a error message they would have mentioned it in a document somewhere. I'm not finding any more on the net now than I did 4 months back when this first came up.

2 : What are you writing the app in? I think that is probably relevant...


---------------------------------------------------------------------------------------------------------------
Id: 3742328
title: Why am I getting this very strange form POST action behaviour?
tags: iis, forms, post
view_count: 57
body:

I have the simplest of forms written using classic ASP:

<html>
<head><title>Test</title>
</head>
<body>
<form action="testpost.asp" method="post">
Say something: <input type="text" name="something" id="something" />
<input type="submit" value="Submit" />
</form>

<% Response.Write(Request.Form)
Response.Write("hello")
%>
</body>
</html>

The form should write to html document whatever was written in the 'something' text box when the submit button is clicked. I have set this form up because of errors that have started occurring in existing code. Having set up this test form and tested I found that the errors were a result of values not being posted from forms in this particular directory.

Using the above script in the problem directory, I get the desired behaviour. However, in IE I'm not getting anything posted. If I rename the directory that the script above is in then it works in IE. Also, I tried using the Charles HTTP debugging proxy - whilst enabled the script worked in IE in the problem directory!

I've checked IIS settings but can't see any obvious reason as to why this would be happening. Any ideas why this strange behaviour is occurring? (i've tried an iis restart)

comments:

1 : "If I rename the directory"... what name is giving you the problem?

2 : There aren't any special characters in there, just renamed from cerb to cerbx


---------------------------------------------------------------------------------------------------------------
Id: 4996406
title: Android Phone is not recognized on Ubuntu/Windows via USB
tags: android, debugging, usb
view_count: 1151
body:

I am using Samsung Galaxy 3. I have turned on the debug option and have connected the phone via usb to ubuntu/windows but the phone is simply not recognized.

It was working perfectly fine i.e. recognized on ubuntu for me to work with Eclipse, until I decided to reboot the phone with usb still connected to the computer.

I have tried rebooting the phone multiple times and everytime, when I plug in the usb, it simply charges and no notification of usb connection ever shows up. What am I doing wrong here? Please help.

comments:

1 : i am using android 2.1 on Samsung Galaxy 3

2 : Did you read http://developer.android.com/guide/developing/device.html and did you follow the instructions there? If so, what do you see if you execute "adb devices"?

3 : I agree, the Samsung Galaxy series phones are a pain when it comes to debugging. I haven't been able to solve these problems myself, but here are two things you can try - If the phone is not showing the "USB debugging on" warning even after you've checked the option, then simply restart it with USB connected. However, if it is showing that warning, the only thing that works for me is Factory Data Reset. Also, make sure that you never eject your phone when you disconnect USB - that somehow messes up the whole USB debugging thing.

4 : If you do find a way to get USB debugging working without a factory reset, please do post here !


---------------------------------------------------------------------------------------------------------------
Id: 3692035
title: How should i plan it?
tags: career-development
view_count: 53
body:

I am in my MCA last year. And wished to join educational sector such as lecturer .

Simultaneously i need the flavor of industry.

So what is the best option available for a person like me who is a part of educational sector but also wishes to work as technical guy.

comments:

1 : Off topic question! Not related to anything programming... voting to close...

2 : be a tech tutor! learn a technology/platform throughly and be an `evangelist`.

3 : @Ankit : Well who is an evangelist ?

4 : read here: http://en.wikipedia.org/wiki/Technology_evangelist

5 : @Ankit : Thanks for the link, but i thought that to be a technology evangelist i need to a developer. how am i going to do that ?


---------------------------------------------------------------------------------------------------------------
Id: 4612118
title: Want to Make Video File From Sequences of Images and Audio file
tags: objective-c
view_count: 253
body:

I want to make a Video file of format (.avi or .mp4) from sequences of Images and audio file(in a wave format) in Objective C. I have tried different methods but it does not work. Can anybody give me a direction of work So that i can achieve my goal.

comments:

1 : What methods have you tried?


---------------------------------------------------------------------------------------------------------------
Id: 6836698
title: Developing an online word processor
tags: django, google-docs, word-processor
view_count: 107
body:

I'm creating a site for writers and having a native web-app for the users to edit and collaborate on documents is critical for the service.

I realize there are a couple of very similar topics posted on here already, but none seem to address certain issues in the programming stages.

Clearly, for live editing and collaboration purposes, incredibly similar to Google Docs in that respect, there will to be JavaScript/AJAX development. I'm still learning JavaScript, but before I get too far, I'd like to get an idea of what is necessary to get something simple running.

I'm using Ubuntu, but that has no real bearing overall. I've seen that having an OpenOffice instance (LibreOffice for me) running in listener mode is one great way of making this work. I'm all for that, but not entirely sure how I'd transport the data (text & formatting) between the browser and the server LibreOffice instance.

Any help or suggestions would be appreciated.

Also, I'm developing the site in Django.

comments:

1 : I think this is *way* too broad a question to be answered meaningfully.

2 : Little advice. You're attempting to learn how to develop a web application that's going to require very complex infastructure, while learning JS and I'm guessing python/django as well. This requires some very tricky stuff and is kinda a bit too much of a project for someone just starting to learn the ropes. You're dealing with some form of Comet (push vs polling), some heavy duty javscript and a task that django isn't the best tool for (and I love django)


---------------------------------------------------------------------------------------------------------------
Id: 3677315
title: Library? C or Python - Socks5 proxy a non-socks aware application
tags: proxy, connection, socks, tunneling
view_count: 333
body:

I need to write an application that will use an open socks5 proxy and tunnel data through it;

eg. Photoshop does not support connections via a proxy, I want to create an app that will take all connections from photoshop and run them through the socks5 proxy.

Any help would be great, thanks :)

comments:

1 : Is the question which language to use?

2 : No sorry, the question is about which libraries I should be looking into to achieve this using either C or Python, sorry for the confusion.


---------------------------------------------------------------------------------------------------------------
Id: 6783333
title: Silence Detection in AMR
tags: algorithm, audio, artificial-intelligence, voice-recognition, amr
view_count: 139
body:

How to make difference between silence and other audio in AMR? I want to implement custom Voice Activity Detection mechanism. Any ideas on how to proceed? I need the algorithm for that.

comments:

1 : See Wikipedia [entry](http://en.wikipedia.org/wiki/Voice_activity_detection) on VAD.


---------------------------------------------------------------------------------------------------------------
Id: 4043772
title: PHP stream socket server
tags: php, linux, ubuntu-10.04
view_count: 356
body:

I have a PHP server listening on port 5001 and 127.0.0.1

$socket =  stream_socket_server("$host:$port", $errno, $errstr)

It work fine when a client in php connects to the server, but the same fails if a client written in C tries to connect.

I have updated firewall settings, just unable to resolve the issue. Is there a different way to handle incoming connections from a C client.

comments:

1 : I can't see a socket being smart enough to recognize WHO opened a socket and go into bigot mode and deny the C app because it's C. A socket's a socket, regardless of who opened it and who's connecting. There must be a difference between the two clients, in terms of execution environment.

2 : The issue is resolved, the communication was somehow not working on IP 127.0.0.1, after changing IP to actual server IP it worked.


---------------------------------------------------------------------------------------------------------------
Id: 3552990
title: VLC from source Ubuntu Lucid
tags: ubuntu, vlc, libavcodec
view_count: 213
body:

hey guys i'm getting and error when compile VLC from source using ubuntu lucid

configure: error: Could not find libavcodec or libavutil.

I have isntall both of the -dev packages for the requeired libs but still get the same error

comments:

1 : More appropriate for superuser.com

2 : Maybe for http://unix.stackexchange.com/ ?

3 : alright thanks guys wasn't sure


---------------------------------------------------------------------------------------------------------------
Id: 6426075
title: CALayer borderColor Error
tags: iphone, cocoa-touch, core-animation
view_count: 384
body:

I have very strange error here is my snippet of code:

- (void) drawRect:(CGRect)rect{
CGRect fr = rect;

fr.size.width = fr.size.width-2*rad;
fr.size.height = fr.size.height-1;
fr.origin.x = rad;

// draw round corners layer
bglayer = [CALayer layer];
bglayer.borderWidth = 1;
bglayer.borderColor = [UIColor blackColor].CGColor; // Here I receive Error: Expected identifier before '[' token
bglayer.backgroundColor = bgColor.CGColor;
bglayer.cornerRadius = rad;
bglayer.frame = fr;
bglayer.zPosition = -5; // important, otherwise delete button does not fire / is covered
[self.layer addSublayer:bglayer];
......
.....
}

in line where: bglayer.borderColor = [UIColor blackColor].CGColor; I receive this error:

Expected identifier before '[' token

Can somebody help me please :)

comments:

1 : Try to use [[UIColor blackColor] CGColor]; or [bglayer setBorderColor: [[UIColor blackColor] CGColor] ];

2 : [bglayer setBorderColor: [[UIColor blackColor] CGColor] ]; is ok :) Thank you


---------------------------------------------------------------------------------------------------------------
Id: 3557912
title: If array contains certain Item show item's value
tags: c#, homework
view_count: 361
body:

I have a Console app, in which I input Users and Customers (that is stored in a array) and is then allowd to create a note from a user to a customer. At the end I want to show all the notes in the notes array that has been created but using the user and the customers fullname as in the users and customers array. Can anyone please help?

Hi, sorry I didnt meen to give all the code just thought it would be more clearer that way, I am having trouble with the last foreach satement to show all the notes. In the notes input I am only asking for user and customer ID's, I then what to check in the User and Customers arrays if that user and customer do extist and then display their fullname as it is in the user and customer arrays and not just their ID's. Thanks in advance. Here is my code:

class Program
{
    static void UserInput(User U)
    {
        Console.WriteLine("Add your User");
        Console.WriteLine("");

        Console.WriteLine("Please Enter a User:");
        Console.WriteLine("User ID:");
        U.ID = int.Parse(Console.ReadLine());
        Console.WriteLine("Titel:");
        U.Titel = (Console.ReadLine());
        Console.WriteLine("Name:");
        U.Name = (Console.ReadLine());
        Console.WriteLine("Surname:");
        U.Surname = (Console.ReadLine());
        Console.WriteLine("Telephone Number:");
        U.Telephone = int.Parse(Console.ReadLine());
        Console.WriteLine("");
    }

   static void CustomerInput(Customer C)
    {
        Console.WriteLine("Add your Customer");
        Console.WriteLine("");

        Console.WriteLine("Please Enter a Customer:");
        Console.WriteLine("Customer ID:");
        C.ID = int.Parse(Console.ReadLine());
        Console.WriteLine("Titel:");
        C.Titel = (Console.ReadLine());
        Console.WriteLine("Name:");
        C.Name = (Console.ReadLine());
        Console.WriteLine("Surname:");
        C.Surname = (Console.ReadLine());
        Console.WriteLine("Address:");
        C.Address = (Console.ReadLine());
        Console.WriteLine("");
    }

   static void NotesInput(Notes N)
   {
       Console.WriteLine("Create your Note");
       Console.WriteLine("");

       Console.WriteLine("Please enter User ID:");
       N.FromUserID = int.Parse(Console.ReadLine());
       Console.WriteLine("Please enter Customer ID:");
       N.ToCustomerID = int.Parse(Console.ReadLine());
       Console.WriteLine("Note Information:");
       N.Info = (Console.ReadLine());
       N.DateTime = DateTime.Now;
       Console.WriteLine("");
   }

    static void Main(string[] args)
    {
        //User Array
        int UserAmount;
        Console.WriteLine("How many Users do you want to input?");
        UserAmount = int.Parse(Console.ReadLine());

        User[] users = new User[UserAmount];

        for (int user = 0; user < users.Length; user++)
        {
            users[user] = new User();
            UserInput(users[user]);
        }

        //Customer Array
        int CustomerAmount;
        Console.WriteLine("How many Customers do you want to input?");
        CustomerAmount = int.Parse(Console.ReadLine());

        Customer[] customer = new Customer[CustomerAmount];

        for (int customers = 0; customers < customer.Length; customers++)
        {
            customer[customers] = new Customer();
            CustomerInput(customer[customers]);
        }

        Console.WriteLine("All Users");
        Console.WriteLine("");

        //Show All Users
        foreach (User user in users)
        {
            Console.WriteLine("User ID:" + " " + user.ID);
            Console.WriteLine("User Name:" + " " + user.FullName);
            Console.WriteLine("User Telephone number:" + " " + user.Telephone);
            Console.WriteLine("");
        }

        Console.WriteLine("All Customers");
        Console.WriteLine("");

        //Show All Cutomers
        foreach (Customer customers in customer)
        {
            Console.WriteLine("Customer ID:" + " " + customers.ID);
            Console.WriteLine("Customer Name:" + " " + customers.FullName);
            Console.WriteLine("Customer Address:" + " " + customers.Address);
            Console.WriteLine("");
        }

        //Notes Array
        int NoteAmount;
        Console.WriteLine("How many Notes do you want to input?");
        NoteAmount = int.Parse(Console.ReadLine());

        Notes[] note = new Notes[NoteAmount];

        for (int Note = 0; Note < note.Length; Note++)
        {
            note[Note] = new Notes();
            NotesInput(note[Note]);
        }

        //Show All Notes
        foreach (Notes Note in note)
        {
            User User;
            Customer Customer;
            string UserFullname;
            if (users.Contains(Note.FromUserID))
            {
                UserFullname = User.FullName;
            }
            string CustomerFullName;
            if (customer.Contains(Note.ToCustomerID))
            {
                CustomerFullName = Customer.FullName;
            }
            Console.WriteLine("From User:" + " " + + Note.FromUserID);
            Console.WriteLine("To Customer:" + " " + Note.ToCustomerID);
            Console.WriteLine("Info:" + " " + Note.Info);
            Console.WriteLine("Date Time:" + " " + Note.DateTime);
            Console.WriteLine("");
        }

    } 
}
comments:

1 : * Homework alert * There was one just like this earlier

2 : Yeah, this is the 2nd user to have very very very similar code asking a very similar question.

3 : If it's homework, just tag it as such, you'll still get help. More importantly, don't just spam us with your entire program. Highlight the part you are having difficulty with and explain where your attempts have gone awry.

4 : Can you simplify this code a little? Narrow it down to the part that's giving you trouble?

5 : We aren't reading your code and fixing it. If something is going wrong, narrow it down as much as possible and ask a specific question about the problem. "Here code--find bug" questions almost never get answered.


---------------------------------------------------------------------------------------------------------------
Id: 6475138
title: Load Assembly stored in Package (C#)
tags: assemblies, system.io.packaging
view_count: 75
body:

Is it possible to load an assembly that is stored in a package (a System.IO.Packaging type package, that is) in C#?

I am using ReflectionLoadFrom and passing the Uri that is formed by the PackageUriHelper, which looks correct. At runtime, I get a FileLoadException.

Edit: Here's the code loading the assembly:

Assembly assembly = Assembly.ReflectionOnlyLoadFrom(mainDllUri.ToString());

Here's the code that forms the URI:

UriBuilder packageUriBuilder = new UriBuilder();
                    packageUriBuilder.Path = this.path;
                    packageUriBuilder.Scheme = "pack";
                    Uri packageUri = packageUriBuilder.Uri;
                    Uri partUri = currRelationship.TargetUri;
                    return PackUriHelper.Create(packageUri, partUri);

I know you can use other URIs (e.g. file://), but I've never seen anyone use the pack URI.

comments:

1 : What language is this in? Could you post a code snipit of what you're trying?

2 : See edits in original question.


---------------------------------------------------------------------------------------------------------------
Id: 6739951
title: Jsf 2.0 needs prependId=false to run the autocompletion
tags: forms, jsf, autocomplete
view_count: 475
body:

Hi guys if i don't set on prependId=false the browser autocompletion behaviour doesn't work. Someone have the same problem or am I doing something wrong?

Thank you in advance

comments:

1 : In which browser(s) do you encounter this behaviour? All? Or only particular one(s)? The JSF default naming separator character `:` is an illegal character in HTML identifiers. It wouldn't surprise me if a certain browser chokes on this.

2 : Following your suggestion i check that the behaviour appear only in Chrome. Even if I change javax.faces.SEPARATOR_CHAR to - it doesn't work. Any idea? However it's safe to use like SEPARATOR_CHAR the "-". I'm using it in this way to work with js without need to escape the ":"

3 : I'd consider it a Chrome bug.

4 : However also in IE it doesn't work. Even if I change the separator chat with "_" the autocompletion still not working. Seems that the problem isn't the character.


---------------------------------------------------------------------------------------------------------------
Id: 3768414
title: MS Word list with sub-lists
tags: c#, word
view_count: 321
body:

I am using Interop.Microsoft.Office.Interop.Word.dll to dynamically build a Word document in C#.

Does anyone have a code example how to create a bulleted list with sub-lists?

comments:

1 : Do you want to do this directly, or based on pre-defined styles?

2 : @Richard Either way will be good


---------------------------------------------------------------------------------------------------------------
Id: 5111122
title: all files convert to pdf with adobe?
tags: c#, pdf, acrobat
view_count: 174
body:

I need to convert files into PDF.
Due to legal reasons its need to be done on the client computer.
Until now we use pdfcreator but it causes us to many problems buying a tool is much more expensive due to the amount of licences we need to buy.
We thought buyiny adobe acrobat to do this.

Is it possible to convert with adobe on server with C# ?

Updated

comments:

1 : If the only problem with PDFCreator is the licence, you need to know that it's free : [Licence](http://www.pdfforge.fr/content/license). Otherwise, you can try [DoPDF](http://www.dopdf.com/).

2 : Maybe you find something that suits your needs on http://csharp-source.net/open-source/pdf-libraries

3 : You should probably also specify what *type* of files you need convert to PDF.

4 : almost every html file (html, htm , mht ,mhtml /// ) and almost any image ,,, that depend on the client. its not the licence that is a problem with dpf creator , is that its not stable. and can only do Printurl for silent printing and not printfile or convert.


---------------------------------------------------------------------------------------------------------------