Wednesday, May 16, 2012

Saving SQL Server backup file in multiple parts

I am taking daily backups of a SQL Server database. Right now the .bak file is about 2GB and it is growing day by day. There is a scheduled job is running which moves this .bak file from one location to another.

Is there a way to save the .bak file in chunks - like part1.bak, part2.bak etc..

so it will be much easier to move small data and merge at destination?

How can write texts in OPENG window at c#

I want to know , how can i write texts in opengl window at c#. i use opentk tools for drawing
i would pleased for say me what code i must to use in c#.

tanx a lot

facebook like and share count shows same number

I am having fb-like and fb-share button on my page, but when i click like or share button, the count in like and share increases simultaneously.

As for example like count = 4 and share count = 3
after liking my web page Like count =5 and share count = 5

This is the problem

enter image description here

rspec let method + loop

i am having trouble running my rspec examples in a loop.

  describe "GET all providers" do
let(:current_user) { Factory(:user) }

[:twitter, :facebook, :google_oauth2].each do |provider|
before :each do
sign_in current_user

request.env['devise.mapping'] = Devise.mappings[:user]
request.env["omniauth.auth"] = OmniAuth.config.add_mock provider, {
:uid => '123456789',
:info => {
:email =>

it 'should add the authorization' do
get provider # method to create the authorization
authorization = Authorization.where(:provider => request.env["omniauth.auth"][:provider], :uid => request.env["omniauth.auth"][:uid]).first
current_user.authorizations.should include authorization

currently these examples all pass. the problem though is that current_user is a new user instance through each iteration of the loop, despite memoizing the current_user method. so if i add a test for current_user.authorizations.count.should == 3 it fails.

this became less of needing to actually test it, and more understanding why it isnt behaving how i expect. shouldn't let(:current_user) { Factory(:user) } persist the same user instance across all examples?

Multiple Carrierwave mount_uploader on a single model

I have a model called Recipe which has 2 images that use carrierwave, so in this model i have this to setup carrierwave

mount_uploader :author_photo, AuthorUploader
mount_uploader :photo, PhotoUploader

I have also added multiple version to my images such as thumb, small, medium, large

The problem is. say i have 2 images

Chocolate_Cake.jpg as the photo
My_Photo.jpg as author_photo

When i go into console and load up my recipe and to recipe.to_json, I get both my images back from carrierwave but they are both showing the photo for the recipe, not the author photo.

     "recipe": [
"author_photo": {
"url": "/uploads/recipe/photo/8/Chocolate_Cake.jpg",
"thumb": {
"url": "/uploads/recipe/photo/8/thumb_Chocolate_Cake.jpg"
"small": {
"url": "/uploads/recipe/photo/8/small_Chocolate_Cake.jpg"
"medium": {
"url": "/uploads/recipe/photo/8/medium_Chocolate_Cake.jpg"
"large": {
"url": "/uploads/recipe/photo/8/large_Chocolate_Cake.jpg"
"id": 8,
"photo": {
"url": "/uploads/recipe/photo/8/Chocolate_Cake.jpg",
"thumb": {
"url": "/uploads/recipe/photo/8/thumb_Chocolate_Cake.jpg"
"small": {
"url": "/uploads/recipe/photo/8/small_Chocolate_Cake.jpg"
"medium": {
"url": "/uploads/recipe/photo/8/medium_Chocolate_Cake.jpg"
"large": {
"url": "/uploads/recipe/photo/8/large_Chocolate_Cake.jpg"

So for some reason my json response isnt showing my uploaders properly.

If i was to type this in console,

They come up with different image urls

check if dates are between date range in sql (check without year)

I am developing a holiday guide site!
I am using a MySQL database in which I store the information about hotels.
I have 4 date fields in order to store the 2 possible seasons that works each hotel (date_from, date_to, date_from_extra, date_to_extra). I store the dates in a format like this: DD/MM, for example: 25/12.

I am trying to check if the date1 of first datepicker of the site and the date2 of the second datepicker are between first range (date_from, date_to) or between second range (date_from_extra, date_to_extra) in the database.

The problem is that I don't use years in database date fields and is difficult to compare dates especially when the first or second season in database doesn't finish at the end of the year but it lasts more, for example (14/11 - 25/02).

Any help?
Thanks a lot!

OnTouch method in OnDraw

I need to set an onTouch method to the rect that I have set up but I dont know how to do this in an OnDraw method. this but I dont know how here my code, Thanks for the help!

public class Tab3 extends View implements OnTouchListener
int x1, x2, y1, y2;
Rect Rect = new Rect();
public Tab3(Context context, AttributeSet attrs)
super (context, attrs);
x1 = 0;
x2 = 100;
y1 = 0;
y2 = 100;


protected void onDraw(Canvas canvas)
// TODO Auto-generated method stub

Rect.set(x1, y1, x2, y2);

Paint blue = new Paint();
canvas.drawRect(Rect, blue);

public boolean onTouch(View v, MotionEvent event)

return false;

skipping Byte Order mark (BOM) when using Stream CopyTo

I am trying to merge files into an output file and my individual files have the BOM on them, how can I get rid of it while using Stream.CopyTo method..

My code looks like this:

using (var output = File.Open(outputFile,FileMode.Append,FileAccess.Write))
foreach (var inputFile in inputFiles)
using (var input = File.OpenRead(inputFile))

Variable size buttons in the

I am creating a virtual on screen keyboard similar to the windows on screen keyboard. I dont know how to make buttons change its size with window size as it takes in place in windows on screen keyboard (osk.exe).

I also wanted to know if there is a way possible that could enlarge the buttons nearby the mouse cursor and recede & diminish the size of the buttons away from the mouse. So that accuracy of the clicks could be increased.

And how to attach dictionary with it as in windows on-screen keyboard, like it shows the possible words we could type.

And how to create those buttons dynamically on the form?

Creating custom jQuery class

I am creating a photo gallery for my website. I want a grid of the photos displayed when the page loads. Then when the user hovers over each photo, the photo enlarges a little.

I created the javascript for the hovering, but I do not know how to properly package this into a class.

Basically, I want to just create a list like this

<li><img src="img1.jpg" /></li>
<li><img src="img2.jpg" /></li>

And then it automatically creates each image with my hovering mechanism already in place.
Here is my code thus far.

<script src="jquery.js"></script>
<style text="text/css">
.hoverImage {
position: absolute;
width: 200px;
left: 500px;
top: 200px;
var originalWidth;
var originalHeight;

function onHover() {
originalWidth = $(this).width();
originalHeight = $(this).height();

$(this).stop(false, true).animate({
left: $(this).offset().left-(Math.floor(originalWidth/4)),
top: $(this).offset().top-(Math.floor(originalHeight/4)),
width: 300,

function offHover() {
$(this).stop(false, true).animate({
left: $(this).offset().left+(Math.floor(originalWidth/4)),
top: $(this).offset().top+(Math.floor(originalHeight/4)),
width: 200,

$(document).ready(function() {
$("img").hover(onHover, offHover);

<img class="hoverImage" src="Test.jpg"/>

how to grow the ul and ol list elements of a tree using javascript

I have to make a tree such that it allows the list to be generated dynamically just by clicking on it.for example

o 1
o 2
o 3

if in this, I click on 1 , a sub node should be created may be 11.clicking on the 1 again will create may be 22.

o 1
o 11
o 22
o 2
o 3

this process will be repeated how many times I will click on the element. one scenario may be like this.

o 1
o 11
o 111
o 222
o 333
o 22
o 33
o 111
o 222
o 333

I have absolutely no idea of jquery framework as I have never worked on that syntax all I understand that too a little about javascript. can you guide me regarding in this direction so that i may integrate in the project which is like this.

I have to generate knowledge based help module which contains several folder list which itself contains folders and each folder has data to be shown to the agent.

for ex


this structure would be shown using tree data structure, each folder contains the data. This folder structure would grow/ can grow dynamically.

Android : Application is running on background or foreground? :S

I have wrote an application and dont want to do anything other than my application on installed device. But in Android 3.x versions, i couldn't disable the status bar programmaticaly. Then i have to check the application, when it is BACKed and returned to device desktop, and when it is returned and worked on my application. Is there a way to check that application is active on foreground or invisible but runnning on background?

Thanks everyone.

STL nested containers dereferencing error

I'm pretty rusty in my C++ and what little STL knowledge I once had. I'm particularly struggling to read the voluminous error messages generated.


typedef map<string,int>layerType;
typedef vector<layerType> aggregateLayersType;

What's wrong with:

bool LayerManager::use_layers(aggregateLayersType& layers)
int layerVal = layers[0]["ts"];

The error is:

> No viable overloaded operator[] for type
> 'std::__debug::map<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >, int, std::less<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > >,
> std::allocator<std::pair<const std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >, int> > >'

I'm sure it's going to be something simple once someone points out the obvious.

Groovy on Grails

I want a link on my view page and it should extend with .xls file .When I click on that link then I should able to see the file downloaded.That file should be only in .xls.

mono_delegate_to_ftnptr: function call hangs

I'm embedding mono 2.10.8 into my application and have some troubles with functions, registered with mono_add_internal_call

Let's say i have managed method:

internal delegate void Win32ServiceHandler(long statusCode);

internal static class Win32Service
public static extern void Test(Win32ServiceHandler handler);

it's unmanaged definition:

void icall_TestDelegateCallback(MonoDelegate *ftn) {
LPHANDLER_FUNCTION f = (LPHANDLER_FUNCTION)mono_delegate_to_ftnptr(ftn);

and some code to test:

protected virtual void ServiceHandler(Win32ServiceControl statusCode)

public void MakeTest()

I run it from console application and when i call MakeTest(), the output is:


And application never return.

Actually it is a simplified eexample. In real program i need to pass function pointer as a callback to RegisterServiceCtrlHandler so stuff like mono_runtime_invoke (that btw works fine) etc isn't what i need.

The question is what is the proper way to call a function pointer obtained from MonoDelegate? Or is it any other correct way to pass it as a callback?

My platform is Windows 7 x64

How do i make my background change on refresh?

Hi i was wondering if there was a code or query that allows my background to change on every refresh, as well as the background color with the background as well

Take a look at this site

Notice that on every refresh the background changes and the background color coordinates with it too.

How is this done can anyone help me figure this out?

Thank You in advance.

Emitting XML from Clojure using

I have a need to serialize a Clojure data structure to XML, but I'm stumbling on how to emit a collection. To make this more concrete, assume I have a Clojure map as follows:

    (def parking-lot {:parking-lot #{
{:car {:color "red", :make "nissan", :year 2003}}
{:car {:color "blue", :make "toyota", :year 2001}}
{:car {:color "black", :make "honda", :year 2010}}}})

This is just a map with one element whose value is a set of "car" items. Now, let's assume that I want to serialize this map to produce the following XML:

    <? xml version="1.0" ?>
<car color="red" make="nissan" year="2003" />
<car color="blue" make="toyota" year="2001" />
<car color="black" make="black" year="2010" />

Searching the web for docs on how to best parse/emit XML in Clojure led me to the library, so that's what I'm using.

Here's a trivial example of how to use to emit some XML:

    REPL> (use '

=> nil
REPL> (emit-str (element :parking-lot {}))

=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>

A slightly more complicated example:

    REPL> (emit-str (element :parking-lot {}
(element :car {:color "yellow" :make "ford" :year "2000"})
(element :car {:color "purple" :make "chevrolet" :year "1977"})))

=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<car color=\"yellow\" year=\"2000\" make=\"ford\"></car>
<car color=\"purple\" year=\"1977\" make=\"chevrolet\"></car>

Here you see that the 3rd argument to the 'element' function can indeed be variable number of calls to 'element'. Without looking deeply at the docs for the 'element' function, I guess I assumed that 'element' would be overloaded to also take a sequence of element items as its 3rd argument. And so, without looking at the docs, I just went ahead and whipped up a small block of code that would do just that:

    REPL> (emit-str (element :parking-lot {}
(map (fn [car] (let [carattrs (:car car)]
(element :car {:color (:color carattrs),
:make (:make carattrs),
:year (:year carattrs)})))
(:parking-lot parking-lot))))

I was hoping this would work, but alas it does not. The problem is that the 3rd argument to the 'element' function cannot be a sequence itself.

So, at this point I'm a bit stumped as to what to do. I'm still relatively new to Lisp and Clojure, so go easy on me if my next thought is moronic. So my thought is, would this be a use case for a macro? I.e., should I create a macro that takes as its input a set (or any coll for that matter) of cars, and outputs its items as individual s-expressions? So for example, I'm thinking in my mind of a macro that behaves like this:

    REPL> (defmacro flatten-as-elements [coll-of-cars] ...)
REPL> (flatten-as-elements #{ {:color "blue" :model "honda" year "2000"}
{:color "yellow" :model "ford" year "2011"}})
=> (element :car {:color "blue" :model "honda" year "2000"})
(element :car {:color "yellow" :model "ford" year "2011"})

In my mind at least, the output of such a macro would fit as the 3rd argument to the 'element' function, and would produce my desired goal. Of course, my worry is that there is some completely obvious solution that I'm overlooking, and that using a macro here is misguided. Any help from the SO community is greatly appreciated! Thank you in advance!


MFC Feature Pack applications have wrong size when restored to maximized in secondary monitor

I've noticed that applications developed using MFC Feature Pack (VS2008), when restored from minimized to maximized in the secondary monitor, are sized as if they were in the primary monitor, leaving space for the Windows taskbar.

I've found this behaviour on my own programs, but also in the MFC Feature Pack samples, so I guess it's some bug in the MFC Feature Pack classes.

So, for example, I build the Visual Studio sample, run it, move it to the secondary monitor, maximize it there, minimize it, restore it, and I get this:

Check the gap under the window on the secondary monitor

Is there any known workaround for this? Has it been solved for more recent versions of MFC?


It seems to happen only if the secondary monitor is on the right of the main one, but not if it's on the left.

C function pointers error storage class specified for parameter `type name'

I currently have a piece of code that I am working on using function pointers as callbacks. I am having trouble with an error from gcc stating "storage class specified for parameter `type name'" The relevant portion of code is:

error_t addCommand(uint8_t command, void  (*callback)(uint16_t,uint8_t)){

This is actually using the nesC language for TinyOS but it seems to be a C issue. In my research on the issue I have found suggestions mostly stemming from one of two issues:
1. Something wrong in a header (missing semicolon)
2. passing a function pointer with a static or volatile value (i.e.
void (*callback)(volatile int, uint8_t)

I have eliminated problem 1 as far as I can tell. Problem 2 is only an issue if uint16_t or uint8_t are static of volatile (I don't have much experience with these types). Any tips/answers on how to solve this issue are greatly appreciated.

Also, if anyone is familiar with nesC the exact code looks more like this:

command error_t CommandEngine.addCommand(uint8_t command, void  (*callback)(uint16_t,uint8_t)){

It may be possible that what nesC is adding to the C language causes this error but I don't think this is the case.

Synchronizing Parent & Child process

I want to synchronize the parent and child process to alternatively print 1 to 10 into a file. And output which process printed the number. The following code prints alternatively, but the same number. Please help me out!

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

#define MSGSIZE 16
int parent= 1;
int n=-1;
main ()
int i;
char *msg = "How are you?";
char inbuff[MSGSIZE];
int p=0;
FILE *fp1,*fp2;
pid_t ret;

ret = fork ();
if (ret > 0)
i = 0;
while (i < 10)

// sprintf(msg, "%d", n);
// fp=fopen("abc.txt","a");
// write (p[1], itoa(n,msg,MSGSIZE), MSGSIZE);
// sleep (2);
// fclose(fp);
//read (p[0], inbuff, MSGSIZE);

printf("Parent: %d\n", n);

i = 0;
while (i < 10)

//sleep (1);
// read (p[0], inbuff, MSGSIZE);


printf("Child: %d\n", n);


exit (0);

C# Best way to store strings from an input file for manipulation and use?

I've got a file of blocks of strings, each which end with a certain keyword. I've currently got a stream reader setup which adds each line of the file to a list up until the end of the current block(line contains keyword indicating end of block).


Each block contains information e.g. Book bookName, Author AuthorName, Journal JournalName etc. So each block is hypothetically a single item (book, journal, conference etc)..

Now with around 50 or so blocks of information(items) i need some way to store the information so i can manipulate it and store each author(s), Title, pages etc. and know what information goes with what item etc.

While typing this I've come up with the idea of possibly storing each branch as an object of a class called 'Item', however with potentially several authors, I'm not sure how to achieve this, as i was thinking maybe using a counter to name a variable e.g.

int i = 0;
String Author[i] = "blahblah";

But as far as i know it's not allowed? So my question is basically what would be the simplest/easiest way to store each item so that i can manipulate the strings to store each item for use later.

Need to develop UI based debugger tool for c++ code matinaed in unix platform [closed]

I am working in c++ code that is developed and maintained in unix.

I need to develop a UI based debugger something like visual studio which will help me in faster debugging and provides all information like stack frame, watch etc.

We currently have GDB to debug code in unix, but it is not developer friendly.

So I am looking for some open source upon which I can have some add-on to have a debugger with good UI and that will help me greatly in understanding the code flow as well.

getting elements from mysql table to arraylist

i have an ArrayList that looks like this:

1 2011-05-10 1 22.0,
2 2011-05-10 2 5555.0,
3 2011-05-11 3 123.0,
4 2011-05-11 2 212.0,
5 2011-05-30 1 3000.0,
6 2011-05-30 1 30.0,
7 2011-06-06 1 307.0,
8 2011-06-06 1 307.0,
9 2011-06-06 1 307.0,
10 2011-06-08 2 3070.0,
11 2011-06-03 2 356.0,
12 2011-05-10 2 100.0,
13 2011-05-30 1 3500.0,
14 2011-05-10 3 1000.0,
15 2011-05-10 3 1000.0,
16 2011-05-07 1 5000.0,
17 2011-05-07 4 500.0,
18 2011-08-07 3 1500.0,
19 2011-08-08 6 11500.0,
20 2011-08-08 4 11500.0,
21 2011-08-08 7 11500.0,
22 2011-06-07 8 3000.0]

Here is the code how i got this arraylist:

public ArrayList<Expenses> getExpenses() {
ArrayList<Expenses> expenses = new ArrayList<Expenses>();
try {
Statement stmt = myConnection.createStatement();
ResultSet result = stmt.executeQuery("SELECT * FROM expenses");

Expenses expense = new Expenses();


catch (SQLException e){
return expenses;

but what i want to get to an arraylist so that each element of array wasn't the line of the table (what i have now), but every individual element of the table should be the element of array ( [1, 2011-05-10, 1, 22.0, 2, 2011-05-10, 2, 5555.0, 3, 2011-05-11, 3, 123.0,]. Can anyone help me with that?

Javascript attach an object syntactic sugar?

I have an object in my class like so:

this.options = {
a: 1,
b: 2,

I just wondered if there was a way to "attach" the options object to the current scope in Javascript, such that I can refer to a and b directly (instead of this.options.a and this.options.b). Something like:

var myVariable = a + 3; // 4


with( this.options, {
// code here
var myVariable = a + 3; // 4

In the above, the attach and with have the effect of taking all of the children of this.options and attaching them to the current scope so they are accessible via a instead of this.options.a. (The with version simply detaches this.options once you're done, enclosing the potentially-damaging attaching to within that scope).

As long as it works in the Spidermonkey/Mozilla engine, I don't mind if it's not portable.

I only mention this because of curiosity & laziness: all the nested names are getting annoying to type out, and I know that in the R language this is possible (in fact, the syntax in the snippets above is almost exactly what you'd write in R to achieve this).

Virtualenv and Python ucs-4

How can I convert an existing virtualenv python to become compatible with UCS4 ?

how to set text on "to" textarea in email activity

i have made an activityenter image description here

at subscribe button, i have to send email to some default email for which my code is:

import android.R.string;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class subscribeActivity extends Activity {
/** Called when the activity is first created. */
EditText name,age,address;
databaseforsubscribe addressBook;

public void onCreate(Bundle savedInstanceState) {

Button store = (Button)findViewById(;


addressBook = new databaseforsubscribe(this,"addressDB",null,2);

store.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
String s=new String();
String m=new String();
String n=new String();
Intent i = new Intent(Intent.ACTION_SEND);

i.putExtra(Intent.EXTRA_EMAIL, "");
// i.putExtra(Intent.EXTRA_EMAIL , new String[]{""});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT ,"NAME: "+s+" ; MOBILE: "+m+" ; EMAIL: "+n);
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(subscribeActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();


which open an intent like thisenter image description here

now either i have to set the email id to "To" textbox (and make it uneditable"), or to automatically click on that "send" button so that user dont see this intent and email is send in back ground..

Django NoArgsCommand gives NameError: name ' ' is not defined

I am trying to make a custom command to run on my celery crontabs, which extracts data from my db, makes a list, and then dumps that information as a list in redis. This list will then be used by other workers.

However, I am getting a NameError, which I haven't been able to solve despite reading relevant stack and Google posts.

My code below:

from import NoArgsCommand, CommandError
from detail.models import SD
import redis

class Command(NoArgsCommand):

help = 'Gathers the symbols from the database and generates a list for crontabs, saving to redis.'

def handle_noargs(self, **options):

all = SD.objects.all()

data = []

for info in all:

r = redis.Redis()


for xyz in data: **<---- the NameError refers to this line**
r.rpush('allsymbols', xyz)

What the format of latitude & longitude?

I got sql lite database from client. In that database latitude & longitude are present. I saw lots of format of lat & long but this format i did not understand. The same format is working in iphone app. I dont know how to use this format for Map activity. Please help me regarding this.
Check format which i got in database

latitude= longitude=4.842.159.586.816.360

some where in database like

lat=50.556.213 & long=-96.633.602

how to solve this problem. help me.

Cubrid DB for missions critical applications

I wanted to know how many of you have heard or used Cubrid database?

1) How long Cubrid are in the DB business?
2) Any benchmarks available?
3) Does Cubrid can be used in production?
4) How easy is to scale with it?

How to calculate total no of pixel of an object from image captured by camera?

I have an object of one color and I need to calculate the exact no of pixel occupied by object in captured image. How can I do this? I want to do this in Opencv. Please help...

Doing Golf course mapping in iPhone

I am doing one golf gps app for iPhone. For that I need to show the golf course map on the iPhone device. I searched about that in the internet. There are lot of methods and service providers for doing that golf course mapping(aerial image). For your reference : Somebody says that we can use google imagery for that. But my question is
1. How we could bring that golf course map data into iPhone app?
2. Is there any API or method available for that?
3. In which format, that golf course map data file will be?

iframe and validate.js

I have iframe inside my page for save data in database.I use validate.js to validate a field inside a iframe.If I validate field outside a iframe means in same page its work.If i do same thing in iframe its doesn't work.I want to know validate.js doesn't work inside a iframe?

I try:

var v = $("#form1").validate({
ignore: ':hidden',
rules: {
txtTitle: { required: true },
txtPost: { required: true },
txtSummary: { required: true }
messages: {
txtTitle: "Please enter a Post Title",
txtPost: "Please enter a Post description",
txtSummary: "Please enter a Post Summary"

And in button click I use like this.

 $("#btnPost").live("click", function() {
if (v.form()) {
else {
return false;

note:txtTitle,txtPost,txtSummary,btnPost all are iframe controls.Thanks.

Can I extract symmetric key in java SSLSocket class?

how can I get session symmetric key in Java? Is it hidden? (Looked for methods but there were none) That would make sense, however, I still need it. Is there a way to retrieve the symmetric key?

Extract Name from an HTML page using jquery

My University provides grade card, that is really very confusing and calculating final result is really very tough. Because all subjects has different weightage for final.

I am developing a BCA result calculator. Here is this

I have following code in a div (I can't change it because it is returned from the University website)

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Grade Card</TITLE>
<h1> Grade Card </h1>
(All programs Except for BIT/ADIT)

<BODY bgcolor=Lavender>

<form name=FRMResult method=post action=Result.asp>
<center> <font size=+2> Indira Gandhi National Open University </font>
<br> Grade Card Status as on May 09, 2012<br> (For information only)</center>
Enrolment Number: 092853268<br> Name: SHASHWAT TRIPATHI<br> Program: BCA<p><font size=-1> The Status is indicative only & cannot be used as a substitute for the final grade card which is sent by SRE at the end of a semester.</font><br><table border=1 width='80%' background='ignou.gif'><tr><td width='10%'> Course Code </td><td width='10%' align=center> Asgn1 </td><td width='10%' align=center> Asgn2 </td><td width='10%' align=center> Asgn3 </td><td width='10%' align=center> Asgn4 </td><td width='10%'> Term End Theory </td><td width='10%'> Term End Practical</td><td width='10%'> Status </td></tr><tr><td width='5%' >BCS61</td><td width='10%' >80</td><td width='10%' >73</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >40</td><td width='10%' >67</td><td width='20%' >Completed</td></tr><tr><td width='5%' >BSHF1</td><td width='10%' >35</td><td width='10%' >35</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >41</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS5</td><td width='10%' >80</td><td width='10%' >87</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >48</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS6</td><td width='10%' >70</td><td width='10%' >67</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >59</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS60</td><td width='10%' >90</td><td width='10%' >87</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >53</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS610</td><td width='10%' >60</td><td width='10%' >60</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >48</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS611</td><td width='10%' >80</td><td width='10%' >80</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >52</td><td width='10%' >88</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS612</td><td width='10%' >70</td><td width='10%' >67</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >70</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS62</td><td width='10%' >80</td><td width='10%' >80</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >40</td><td width='10%' >91</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS63</td><td width='10%' >90</td><td width='10%' >93</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >48</td><td width='10%' >85</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS64</td><td width='10%' >59</td><td width='10%' >59</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >40</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS65</td><td width='10%' >50</td><td width='10%' >53</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >97</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS66</td><td width='10%' >80</td><td width='10%' >80</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >57</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS67</td><td width='10%' >83</td><td width='10%' >83</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >93</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS68</td><td width='10%' >63</td><td width='10%' >63</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >62</td><td width='10%' >77</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS70</td><td width='10%' >70</td><td width='10%' >67</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >45</td><td width='10%'>-</td><td width='20%' >Completed</td></tr><tr><td width='5%' >CS71</td><td width='10%' >90</td><td width='10%' >87</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%'>-</td><td width='20%' >Not Completed</td></tr><tr><td width='5%' >FST1</td><td width='10%' >66</td><td width='10%' >66</td><td width='10%' >-</td><td width='10%' >-</td><td width='10%' >73</td><td width='10%'>-</td><td width='20%' >Completed</td></tr></table><br/><font size=-1 >Not with standing the result published/declared, any case of UFM(Unfairmeans) if found will make such result null and void.</font><p>&nbsp;</p><u>Note:- Assignment 4 and TE Practical do not apply to all the courses.</u><font size=-1 color=blue><center>Disclaimer: This electronically generated information does not have any legal validity</font></center>

<a href="javascript:history.back()">Back </a>

<!--#'include file=scroll.js-->


Suppose I put this code in a div with ID tempDiv
Now how can I extract student's Name and Program from the response the tempDiv

Also, here is a jsFiddle that shows the relevant part of the HTML from the University.

loop a series of image in javascript

i want to loop a series of image in javascript. below is the code i have so far


<img src="images/image1.jpg" alt="rotating image" width="600" height="500" id="rotator">

<script type="text/javascript">
(function() {
var rotator = document.getElementById('rotator'); // change to match image ID
//var imageDir = 'images/'; // change to match images folder
var delayInSeconds = 1; // set number of seconds delay
// list image names
var images = ['1.jpg','2.jpg', '3.jpg', '4.jpg'];

// don't change below this line
var num = 0;
var changeImage = function() {
var len = images.length;
rotator.src = images[num++];
if (num == len) {
num = 0;
setInterval(changeImage, delayInSeconds * 50);

it can only display the image i declare in the "var image". if i have 10000 image , how to do that . i have try using a for loop but it failed .. any suggestions ?? thanks in advance

How do get change value of <input> element?

I have a input in datalist

<input type="text" value="1" id="txtcount">

I want get new value of it when text change.

I use this code but don't work for me .

//look no global needed:)

// Get the initial value
var $el = $('#txtcount');
$'oldVal', $el.val() );

//store new value
var $this = $(this);
var newValue = $'newVal', $this.val());
// Get the value when input gains focus
var oldValue = $(this).data('oldVal');

Javascript and PHP validation both working

I'm using both client and server side validation.When a user does not upload the file, but tries to click submit the js validation is printing the error but even then it is going to php code and validating.

When the user does not upload the file and js finds it, why is it executing php scripts?

If a user disable js,then PHP validation should work. Where am i doing wrong?

Why is it working like this?

Let me know if you want my code.

  function name()
x = true;
checking the length
if it does not satisfy showing error using span tag
return false;
return x;

How do I refresh the page on click if an element has exact text?

I have a link that says 'Add to Favorites'. By default when you click this link and you are logged in, you get diverted to a confirmation page to say your favorite has been added. If you are not logged in it takes you to a login screen.

If you have already added that item to your favorites the text says 'Remove from Favorites' with an updated link to include '?A=Remove'. If you click it, you are redirected to a page confirming the favorite removal.

Now what I want to do is this:

If you're not logged in get an alert message.

If you are logged in - Refresh the page (Ideally I'd like to change 'Add to favorites' to 'Favorite added successfully' instead of refreshing the page - but I don't know how).

If you have already added to the favorites - Refresh the page (Ideally I'd like to change 'Remove from Favorites' to 'Favorite removed successfully' instead of refreshing the page - but I don't know how).

The {module_isloggedin} tag is generated by the system I am using. It generates a '1' if logged in & '0' if not logged in.

So far all that happens is the error message - Perhaps because my :contains isn't working?

The whole code seems much too long and sloppy. I'm still learning :)

This is my jQuery so far, I haven't put in a page refresh for the 'remove from favorites' yet.

if(jQuery('.add-favourites').size() === 0){ return; }

jQuery('.add-favourites a').live('click', function(e){

var loggedin = "{module_isloggedin}";

if (loggedin == 1) {
if (jQuery('.box-content ul li:contains("Add to Favorites")').length > 0) {
if(jQuery(this).attr('href').indexOf("A=Remove") != -1){
url: jQuery(this).attr('href'),
cache: false
url: jQuery(this).attr('href')+"&A=Remove",
cache: false
alert('You must be logged in to add favorites.');

How to make Remember Me more secured

I'm trying to do "Remember Me" on my website and have added the code below to my login script.

The password is run through sha1() function and the username was trimmed and run through mysql_real_escape_string() before assigning it to a SESSION.

How can I make this more secured, against hijacking.


 if($_POST['remember']) {

setcookie("CookieUser", $_SESSION ['usrename'], time() + 60 * 60 * 24 100, "/");

setcookie("CookiePass", $_SESSION ['password'], time() + 60 * 60 * 24 100);


Passing value from servlet to html

I have a servlet that processes some content from the web and generates a String value. I need to display this String value in a html page within a table tag.

How do I pass this string value from servlet using the setAttribute method and getrequestdispatcher method?

Abhishek S

calculate age in years and months and melt data

I'm working with some time data and I'm having problems converting a time difference to years and months.

My data looks more or less like this,

dfn <- data.frame(
Today = Sys.time(),
DOB = seq(as.POSIXct('2007-03-27 00:00:01'), len= 26, by="3 day"),
Patient = factor(1:26, labels = LETTERS))

First I subtract the data of birth (DOB) form today's data (Today).

dfn$ageToday <-  dfn$Today - dfn$DOB

This gives me the Time difference in days.

Time differences in days
[1] 1875.866 1872.866 1869.866 1866.866 1863.866
[6] 1860.866 1857.866 1854.866 1851.866 1848.866
[11] 1845.866 1842.866 1839.866 1836.866 1833.866
[16] 1830.866 1827.866 1824.866 1821.866 1818.866
[21] 1815.866 1812.866 1809.866 1806.866 1803.866
[26] 1800.866
[1] ""

This is where first part of my question comes in; how do I convert this difference to years and months (rounded to months)? (i.e. 4.7, 4.11, etc.)

I read the ?difftime man page and the ?format, but I did not figure it out.

Any help would be appreciated.

Furthermore, I would like to melt my final object and if I try using melt on the data frame above using this command,

mdfn <- melt(dfn, id=c('Patient'))

I get this strange warning I haven't see before

Error in as.POSIXct.default(value) : 
do not know how to convert 'value' to class "POSIXct"

So, my second question is; how do I create a time diffrence I can melt alongside my POSIXct variables? If I melt without dfn$ageToday everything works like a charm.

Thanks, Eric

WSO2 SOA suite first test

Stackoverflow community.
I found out that WSO2 community can be contacted on this site, so I'm going to ask a simple orientation question.

I would like to deploy a simple "Hello world" service and test it on WSO2 SOA Suite.
How should I proceed
(step by step)?

Other doubts related to this aim are:

"Which is WSO2 Carbon function? Is it a suite coordinator on which I can install components (like ESB, Governance Registry, BAM etc.)?"

"Do I need Carbon, ESB and/or Carbon Studio?"

Thanks in advance for your help!

Excel vb project-best practice

I'm not a vb developer neither so familiar with excel. Anyway i have a project to be done using MS Excel (cannot use access).
System is to provide a ratio analysis(ans some other analysis) of companies where data from an annual report need to entered to the system. Then based on several reports data I can derive graphs and all other information.

My question
Now I can store data in a single sheet like using is as as a database. it'll be like

CompanyName     Year     Data1     Data2    Data3...

Here the CompanyName can be duplicated as many Years data can be entered. If I use this method Each time I derive company data, I have to search for the relevant rows in the worksheet and keep lots of data in an array as I read through those rows and produce the final result.

Or I can use separate worksheet for each company. Then I only have to search for the relevant sheet name and perform operations in that worksheet it self easily.

So what is the best way to do this?

Getting results from SQLCLR

I have the following issue: I must have a DLL accessed from various clients inside the LAN, that resides in a the PC that hosts the SQL Server.

I need to access this DLL from all the clients in order to have it return a legal-tax checksum.

I thought to create a CLR procedure that calls the DLL in the server and returns the checksum.

I followed some internet examples and created a simple HelloWorld app....

I created a DLL in C#

public static int HelloWorld(int h)
return h;

I created the assembly in SQL Server:

from 'C:\Users\Panos\Documents\Visual Studio 2010\Projects\DigitalSignature\Algobox\bin\Debug\checksum.dll'

I created the procedure

CREATE PROC sp_mychecksum (@h int)
EXTERNAL NAME MyAlgobox.Signatures.HelloWorld

The bottom line is that when I execute my procedure (exec sp_mychecksum

) I get only a message

Command(s) completed successfully

and not the 12

Any clues?

How can I populate a list with values from a SQL Server database?

The list will grow and shrink depending on how many items I have in my database.

I need to populate a list not a listbox. I understand I will need to open a connection.

using (var conn = new SqlConnection(Properties.Settings.Default.DBConnectionString))
using (var cmd = conn.CreateCommand())

List<string> TagList = new List<string>();
for (int i = 0; i < TagList.Count; i++)
TagList[i].Add("Data from database");


I'm really not sure how to do this and I'm sure my method up here looks very wrong so I really need help.

Could someone show me what I'm doing wrong?

SharePoint WebPart cannot find list on Sub Site - Item does not exist. It may have been deleted by another user

I wrote a Web Part that I dropped on the root site page. That Web Part adds a list. This works great on the main page. That Web Part uses a custom list. Both the list and the Web Part were developed in VS 2010.

Issues/Steps - Sub Site

  1. I then activate the custom list feature on the sub site and that list shows up.

  2. I add my Web Part to the page.

  3. I get the error:

    Item does not exist. It may have been deleted by another user

This list is there on the sub-site. I do not get why the Web Part cannot find the list? It works well on the home page, the root site, but not on a sub site.

Need to help to convert string to hex bytes

I am programming in Java. The program have a String as below.

String str = "byte."

Can the above string be converted to an array of hex bytes as below?

byte[] data = {0x62, 0x79, 0x74, 0x65};

Thank you.

how can you measure the time spent in a context switch under java platform

Let's assume each thread is doing some FP calculation, I am interested in

  • how much time the CPU is used in switching threads instead of running them

  • how much synchronization traffic is created on shared memory bus - when threads share data, they must use synchronization mechanism

My question: how to design a test program to get this data?

svn+ssh svnserve: command not found on ix2 storCenter

Disclaimer: I'm not much of a Linux guy.

Yet, I've been tasked with setting up several subversion repositories on an Iomega ix2 storCenter; wherein there has to be a layer of security. svn+ssh seemed the easiest path. Now I'm stuck arguing amongst myselves as to how I can successfully check out locally using svn, but not svn+ssh. I see this:

user@ix2-200-TIIU4H:/testCheckout# svn co svn+ssh://user@localhost/var/svn/repos/target
user@localhost's password:
sh: svnserve: command not found
svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.
svn: Network connection closed unexpectedly

The first thing I did was find how to install subversion on this device. The device comes with a read only install partition. So, anything you want to install has to be installed elsewhere.

I've worked from several tutorials that all got me to this same result:

I have gone so far as to copy and paste every line from these tutorials to ensure I wasn't missing a step.

"the Subversion client is not connecting to a running svnserve daemon.
This method of access doesn't require a daemon, nor does it notice one
if present. It relies wholly on the ability of ssh to spawn a
temporary svnserve process, which then terminates when the network
connection is closed."

This tells me ssh doesn't know where to locate svnserve. Assuming ssh actually knows to spawn a temporary svnserve process, how do I tell ssh where svnserve is located?

Also, every time I log back into the machine, my group 'subversion' is gone...

Unfortunately I don't know enough about this problem to explain any better. My apologies. Please ask for clarifications.

Displaying spanish characters in Cakephp

I have a project with spanish characters, like (ñ,á) and Im using the 'ñ' character in one model.
then I had to change the collation and charset to utf-8.
I changed the default setting my.ini, httpd.conf, and php.ini

in my.ini i have this..


the problem is when i try to use the console with cake bake...because i have a model named 'Dueños' with the (ñ) character and doesnt show properly
(with strange character like 'Due|-#os') and cant create the application with 'cake bake'