PostId
int64 13
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 3
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -33
210k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
5.77k
| Title
stringlengths 10
250
| BodyMarkdown
stringlengths 12
30k
| Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 47
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,729,898 |
09/16/2010 19:09:28
| 449,904 |
09/16/2010 19:09:28
| 1 | 0 |
How do I check to see if a list index exists in C#?
|
I have the following snippet of code:
public static List<string> sqlData = new List<string>();
//
// lots of code here
//
if (/* check here to see if the sqlData[whatever] index exists */)
{
sqlData.Insert(count2, sqlformatted);
}
else
{
sqlData.Insert(count2, sqlformatted + sqlData[count2]);
}
What I want to know is how to check the index on sqlData to see if it exists before trying to insert something that contains itself.
|
c#
|
list
| null | null | null | null |
open
|
How do I check to see if a list index exists in C#?
===
I have the following snippet of code:
public static List<string> sqlData = new List<string>();
//
// lots of code here
//
if (/* check here to see if the sqlData[whatever] index exists */)
{
sqlData.Insert(count2, sqlformatted);
}
else
{
sqlData.Insert(count2, sqlformatted + sqlData[count2]);
}
What I want to know is how to check the index on sqlData to see if it exists before trying to insert something that contains itself.
| 0 |
4,691,054 |
01/14/2011 12:31:22
| 296,258 |
03/18/2010 06:19:04
| 1 | 0 |
Open New Instance of Excel 2010 with every file
|
I am using Excel 2010 and want to manage a large Excel files.
So I would like to open a new Excel Instance when opening every file from my Windows Explorer. At the point all files are opened in the same Excel Instance.
Any assistance is kindly appreciated.
John.
|
excel
|
excel-2010
| null | null | null |
06/01/2011 06:14:31
|
off topic
|
Open New Instance of Excel 2010 with every file
===
I am using Excel 2010 and want to manage a large Excel files.
So I would like to open a new Excel Instance when opening every file from my Windows Explorer. At the point all files are opened in the same Excel Instance.
Any assistance is kindly appreciated.
John.
| 2 |
4,307,877 |
11/29/2010 20:38:04
| 97,964 |
04/29/2009 21:00:08
| 616 | 44 |
Uploading files with PhoneGap + iPhone
|
I understand that PhoneGap applications are largely (if not entirely) HTML5 + CSS + JavaScript. Natively, the iPhone doesn't provide controls to upload files.
Does PhoneGap provide any mechanisms that allow users to upload files? (images / video, in the case of the iPhone)
I know Titanium allows users to do this, but it's a different animal with its compiled Javascript and proprietary APIs. Thanks for your advice/input.
|
iphone
|
file-upload
|
phonegap
| null | null | null |
open
|
Uploading files with PhoneGap + iPhone
===
I understand that PhoneGap applications are largely (if not entirely) HTML5 + CSS + JavaScript. Natively, the iPhone doesn't provide controls to upload files.
Does PhoneGap provide any mechanisms that allow users to upload files? (images / video, in the case of the iPhone)
I know Titanium allows users to do this, but it's a different animal with its compiled Javascript and proprietary APIs. Thanks for your advice/input.
| 0 |
3,087,929 |
06/21/2010 19:40:51
| 291,981 |
03/11/2010 23:29:21
| 21 | 0 |
Why is it discouraged to use Resources.getIdentifier()
|
In the Android SDK, there is a comment that says it's more efficient to retrieve resources by identifier instead of by name.
Is this the only reason it's discouraged to use getIdentifier()?
I need to programmatically access one of several hundred resources and so far my design makes it easier to access raw resources by name instead of identifier.
|
android
| null | null | null | null | null |
open
|
Why is it discouraged to use Resources.getIdentifier()
===
In the Android SDK, there is a comment that says it's more efficient to retrieve resources by identifier instead of by name.
Is this the only reason it's discouraged to use getIdentifier()?
I need to programmatically access one of several hundred resources and so far my design makes it easier to access raw resources by name instead of identifier.
| 0 |
7,787,495 |
10/16/2011 21:35:19
| 599,184 |
02/01/2011 22:34:03
| 67 | 1 |
Do I need to register somewhere to use HTTPS?
|
I'm trying to enable https://mysite.com on my Ubuntu 11.04/Apache 2
I followed several guides online, but I still cannot access https://mysite.com
The guides mentioned getting certificates from CA, does that mean I have to register somewhere?
Or, can I simply redirect all https traffic to http?
|
apache
|
ssl
|
https
| null | null |
11/12/2011 00:45:09
|
off topic
|
Do I need to register somewhere to use HTTPS?
===
I'm trying to enable https://mysite.com on my Ubuntu 11.04/Apache 2
I followed several guides online, but I still cannot access https://mysite.com
The guides mentioned getting certificates from CA, does that mean I have to register somewhere?
Or, can I simply redirect all https traffic to http?
| 2 |
7,023,835 |
08/11/2011 09:46:48
| 889,628 |
08/11/2011 09:46:08
| 1 | 0 |
probleme add view VS MVC 2008
|
Bonjour, je developpe une application web avec VS MVC 2008, et une bd Sql server 2008, j'ai déja créé les tables sur sql server, j'ai utlisé Visuel studio 2008 sans probleme,
aujourd hui j'ai créer une nouvelle table, j'ai mis à jour mon link to sql sur VS, j'ai créer un nouvel conroller, mais j'ai pas trouver ma table dans la liste deroulante.
comment faire pour trouver ma table avec les autres, merci pour votre aide.
|
c#
|
.net
|
mvc
|
asp
| null |
08/11/2011 10:37:37
|
not a real question
|
probleme add view VS MVC 2008
===
Bonjour, je developpe une application web avec VS MVC 2008, et une bd Sql server 2008, j'ai déja créé les tables sur sql server, j'ai utlisé Visuel studio 2008 sans probleme,
aujourd hui j'ai créer une nouvelle table, j'ai mis à jour mon link to sql sur VS, j'ai créer un nouvel conroller, mais j'ai pas trouver ma table dans la liste deroulante.
comment faire pour trouver ma table avec les autres, merci pour votre aide.
| 1 |
1,261,898 |
08/11/2009 17:41:29
| 96,603 |
04/27/2009 15:02:57
| 118 | 9 |
Download manager that can continue download
|
I have a file half-downloaded. Do you know a download manager that can continue the download without loading the part I already loaded? Is this possible with HTTP?
Thanks
|
download
|
manager
| null | null | null | null |
open
|
Download manager that can continue download
===
I have a file half-downloaded. Do you know a download manager that can continue the download without loading the part I already loaded? Is this possible with HTTP?
Thanks
| 0 |
9,846,285 |
03/23/2012 20:46:05
| 1,284,102 |
03/21/2012 17:41:39
| 11 | 1 |
A customized object array sort in Java that does not sort
|
I've read a few tutorials on customizing Arrays.sort, and a lot of googling, but I'm missing the answer. Right now Arrays.sort(charList) does nothing. Here's what my code looks like.
public class character implements Comparable<character>{
//public vars
public String charName;
public int initModifier;
public int initRoll;
public int secondInit;
/* ... getters, setters, other vars .. */
@Override
public int compareTo(character another) {
int compareInit = ((character) another).getTotalInit();
int comp = this.totalInit - compareInit;
int compareSecondInit = ((character) another).getTotalInit();
if (comp != 0)
{
return comp;
}
else
{
return this.secondInit - compareSecondInit;
}
}
}
The main activity is a bundle of stuff. The part that deals with the arrays.sort follows:
//add a character to the array.
public void addResults(character c)
{
debugInt++; //using this to debug
if(debugInt==3)
{
Log.d(tag,charList[0].charName); //always prints the first object entered
Log.d(tag,charList[1].charName); //always prints the second object entered
}
if (playersPerTurn<charLimit)
{
charList[playersPerTurn]=c;
Arrays.sort(charList,0,playersPerTurn);
playersPerTurn++;
updateDisplay();
}
}
Help me SO, you're my only hope.
|
java
|
android
|
array-sorting
| null | null | null |
open
|
A customized object array sort in Java that does not sort
===
I've read a few tutorials on customizing Arrays.sort, and a lot of googling, but I'm missing the answer. Right now Arrays.sort(charList) does nothing. Here's what my code looks like.
public class character implements Comparable<character>{
//public vars
public String charName;
public int initModifier;
public int initRoll;
public int secondInit;
/* ... getters, setters, other vars .. */
@Override
public int compareTo(character another) {
int compareInit = ((character) another).getTotalInit();
int comp = this.totalInit - compareInit;
int compareSecondInit = ((character) another).getTotalInit();
if (comp != 0)
{
return comp;
}
else
{
return this.secondInit - compareSecondInit;
}
}
}
The main activity is a bundle of stuff. The part that deals with the arrays.sort follows:
//add a character to the array.
public void addResults(character c)
{
debugInt++; //using this to debug
if(debugInt==3)
{
Log.d(tag,charList[0].charName); //always prints the first object entered
Log.d(tag,charList[1].charName); //always prints the second object entered
}
if (playersPerTurn<charLimit)
{
charList[playersPerTurn]=c;
Arrays.sort(charList,0,playersPerTurn);
playersPerTurn++;
updateDisplay();
}
}
Help me SO, you're my only hope.
| 0 |
11,287,948 |
07/02/2012 04:55:14
| 557,524 |
12/29/2010 19:31:57
| 1 | 0 |
Facebook Open Graph Action not approved
|
I tried submitting a social reader app for my site (http://www.moneysmart.sg), but I got this feedback below from facebook. I'm not quite sure what they are referring to, all our images dont appear to be associating the site to facebook. Any ideas?
Your Like or Recommend button branding conflicts with Section 5.6 of the Facebook Terms and Section I.8 of the Platform Policy (https://developers.facebook.com/docs/guides/policy/policy_checklist/english/ ). Please resubmit with a different graphic that reflects your own branding and the ux of your site.
|
facebook
|
facebook-graph-api
| null | null | null |
07/03/2012 09:26:19
|
off topic
|
Facebook Open Graph Action not approved
===
I tried submitting a social reader app for my site (http://www.moneysmart.sg), but I got this feedback below from facebook. I'm not quite sure what they are referring to, all our images dont appear to be associating the site to facebook. Any ideas?
Your Like or Recommend button branding conflicts with Section 5.6 of the Facebook Terms and Section I.8 of the Platform Policy (https://developers.facebook.com/docs/guides/policy/policy_checklist/english/ ). Please resubmit with a different graphic that reflects your own branding and the ux of your site.
| 2 |
10,056,250 |
04/07/2012 16:33:08
| 844,872 |
07/14/2011 15:13:52
| 830 | 6 |
Obtaining and sending accelorometer data to Mac
|
I need to send data from an accelerometer (from my iPhone) to the Mac. I need a way to send this data to the Mac.
The data should be sent in real time. there should not be any delay as such. What is the best method to send data to the Mac.
1.) Is it through bluetooth or over the network ?
2.) I need to know if there are any tutorials/sample code to obtain accelerometers.
|
iphone
|
objective-c
|
accelerometer
| null | null |
04/09/2012 06:30:57
|
not constructive
|
Obtaining and sending accelorometer data to Mac
===
I need to send data from an accelerometer (from my iPhone) to the Mac. I need a way to send this data to the Mac.
The data should be sent in real time. there should not be any delay as such. What is the best method to send data to the Mac.
1.) Is it through bluetooth or over the network ?
2.) I need to know if there are any tutorials/sample code to obtain accelerometers.
| 4 |
7,939,487 |
10/29/2011 14:26:46
| 492,760 |
10/31/2010 13:12:44
| 35 | 4 |
Ant: How to start the web server and then return and run unit tests?
|
I have an Ant file contains a Junit target, before running the Junit target i have to start the web server(also a target) to let the Unit test run smoothly(there are some web based UI unit tests). However when i start the web server, the ant script is pending and block all following execution. Is there a way to start the web server and then return and running the Unit tests?
<target name="runserver" description="Run hosted mode">
<java failonerror="true" fork="true">.....</java>
</target>
<target name="test" depends="runserver">
<junit fork="yes" printsummary="yes" haltonerror="true" haltonfailure="true">...</junit>
</target>
|
ant
|
junit
| null | null | null | null |
open
|
Ant: How to start the web server and then return and run unit tests?
===
I have an Ant file contains a Junit target, before running the Junit target i have to start the web server(also a target) to let the Unit test run smoothly(there are some web based UI unit tests). However when i start the web server, the ant script is pending and block all following execution. Is there a way to start the web server and then return and running the Unit tests?
<target name="runserver" description="Run hosted mode">
<java failonerror="true" fork="true">.....</java>
</target>
<target name="test" depends="runserver">
<junit fork="yes" printsummary="yes" haltonerror="true" haltonfailure="true">...</junit>
</target>
| 0 |
10,972,620 |
06/10/2012 21:49:57
| 808,398 |
06/21/2011 12:17:57
| 68 | 7 |
windows phone DispatcherTimer precision
|
So, i got an application (windows phone 7.5 over c#) using an DispatcherTimer to emulate a timer. I have set the interval to 1 millisecond:
timer.Interval = new TimeSpan(0,0,0,0,1);
Then i am declaring a TimeSpan in order to make a simple countdown:
TimeSpan countdown = TimeSpan.FromSeconds(10);
On each tick im Substracting 1 millisencond:
countdown = countdown.Subtract(TimeSpan.FromMilliseconds(1));
In Visual Studio's windows phone emulator 256/512 its working with 'no problems', but when i run it on my phone (LG Quantum) it seems to have precision problems. I have compared it with my PC screen running the application and its way slower on the phone. I have tried to not to run the application in debug mode in my phone. Is there any solution to this? Or i have to take another approach?
|
c#
|
windows-phone-7
| null | null | null | null |
open
|
windows phone DispatcherTimer precision
===
So, i got an application (windows phone 7.5 over c#) using an DispatcherTimer to emulate a timer. I have set the interval to 1 millisecond:
timer.Interval = new TimeSpan(0,0,0,0,1);
Then i am declaring a TimeSpan in order to make a simple countdown:
TimeSpan countdown = TimeSpan.FromSeconds(10);
On each tick im Substracting 1 millisencond:
countdown = countdown.Subtract(TimeSpan.FromMilliseconds(1));
In Visual Studio's windows phone emulator 256/512 its working with 'no problems', but when i run it on my phone (LG Quantum) it seems to have precision problems. I have compared it with my PC screen running the application and its way slower on the phone. I have tried to not to run the application in debug mode in my phone. Is there any solution to this? Or i have to take another approach?
| 0 |
3,596,194 |
08/29/2010 19:17:21
| 230,632 |
12/13/2009 10:43:08
| 231 | 3 |
cocoa mousedown on a window and mouse up in another
|
I am developping a Cocoa application and I have a special need. In my main window, when I mouse down on a certain area, a new window (like a complex tooltip) appears. I want to be able to do:
- mouse down on the main window (mouse button stay pressed)
- user moves the mouse on the "tooltip" window and mouseup on it.
My issue is that the tooltip window does nto get any mousevent until the mouseup.
How can I fix this?
Thanks in advance for your help,
Regards,
|
objective-c
|
cocoa
|
mouseevent
|
first-responder
| null | null |
open
|
cocoa mousedown on a window and mouse up in another
===
I am developping a Cocoa application and I have a special need. In my main window, when I mouse down on a certain area, a new window (like a complex tooltip) appears. I want to be able to do:
- mouse down on the main window (mouse button stay pressed)
- user moves the mouse on the "tooltip" window and mouseup on it.
My issue is that the tooltip window does nto get any mousevent until the mouseup.
How can I fix this?
Thanks in advance for your help,
Regards,
| 0 |
7,434,647 |
09/15/2011 16:58:53
| 438,339 |
09/02/2010 19:43:41
| 1,094 | 7 |
Rounded Corners without using imagse
|
Are there any methods out there that do not use images to implement rounded box. That also works in all the IE browsers.
|
html
|
css
| null | null | null | null |
open
|
Rounded Corners without using imagse
===
Are there any methods out there that do not use images to implement rounded box. That also works in all the IE browsers.
| 0 |
5,608,705 |
04/09/2011 23:46:22
| 489,296 |
10/27/2010 20:00:07
| 17 | 0 |
Startup script fails because program not found, yet works when computer is booted.
|
This is my Bash script /etc/init.d/test: All it's doing is running md5deep on /usr/local/bin, which calculates the md5 checksums of each file.
#!/bin/bash
cd /usr/local/bin
md5deep * 2>&1 | tee /exe/zlog2.txt
When running it on my computer, this is the output:
root@beagleboard:~# /etc/init.d/test
aed52c61934a5b6c113d535e41bd7dd1 /usr/local/bin/gfcombine
149d9c8e711d772daf7bbb6c40cf630a /usr/local/bin/gfsplit
08ed28c2febb9e21de504b206583b75d /usr/local/bin/hashdeep
1575f479acab5fe3bee0046cc12d86e1 /usr/local/bin/md5deep
69109d35be14662c090316e2656dd546 /usr/local/bin/sha1deep
82bd68ce9658038d80ca62e4dec74ce9 /usr/local/bin/sha256deep
ee475a6c7d2d75016d5cb5b5a1df9e1b /usr/local/bin/stunnel
2aca377e96b82a4f944d3224656b4743 /usr/local/bin/stunnel3
1118f6115880cb106cfb8928cab89241 /usr/local/bin/tigerdeep
405becadbfff425c193c363da812443b /usr/local/bin/whirlpooldeep
I added this script to the startup via 1) crontab, 2) update-rc.d test start 60 2 3 4 5 . and 3) update-rc.d test start 99 2 3 4 5 .
The output of that log file is as follows:
> root@beagleboard:/usr/local/bin# cat /exe/zlog2.txt
> /exe/test: line 3: md5deep: command not found
I have run into problems before where commands weren't found because they weren't loaded, but I tried starting it up way after everything else. Does anyone know how to fix this?
Thank You!
-Eddie
|
linux
|
md5
|
startup
|
crontab
| null | null |
open
|
Startup script fails because program not found, yet works when computer is booted.
===
This is my Bash script /etc/init.d/test: All it's doing is running md5deep on /usr/local/bin, which calculates the md5 checksums of each file.
#!/bin/bash
cd /usr/local/bin
md5deep * 2>&1 | tee /exe/zlog2.txt
When running it on my computer, this is the output:
root@beagleboard:~# /etc/init.d/test
aed52c61934a5b6c113d535e41bd7dd1 /usr/local/bin/gfcombine
149d9c8e711d772daf7bbb6c40cf630a /usr/local/bin/gfsplit
08ed28c2febb9e21de504b206583b75d /usr/local/bin/hashdeep
1575f479acab5fe3bee0046cc12d86e1 /usr/local/bin/md5deep
69109d35be14662c090316e2656dd546 /usr/local/bin/sha1deep
82bd68ce9658038d80ca62e4dec74ce9 /usr/local/bin/sha256deep
ee475a6c7d2d75016d5cb5b5a1df9e1b /usr/local/bin/stunnel
2aca377e96b82a4f944d3224656b4743 /usr/local/bin/stunnel3
1118f6115880cb106cfb8928cab89241 /usr/local/bin/tigerdeep
405becadbfff425c193c363da812443b /usr/local/bin/whirlpooldeep
I added this script to the startup via 1) crontab, 2) update-rc.d test start 60 2 3 4 5 . and 3) update-rc.d test start 99 2 3 4 5 .
The output of that log file is as follows:
> root@beagleboard:/usr/local/bin# cat /exe/zlog2.txt
> /exe/test: line 3: md5deep: command not found
I have run into problems before where commands weren't found because they weren't loaded, but I tried starting it up way after everything else. Does anyone know how to fix this?
Thank You!
-Eddie
| 0 |
11,633,224 |
07/24/2012 14:36:31
| 1,548,805 |
07/24/2012 13:06:48
| 1 | 0 |
How to debug visual studio add-in application build using Visual Studio 2010
|
I was just playing around a visual studio add-in extension application build using VS 2010. How to go for debugging such an application?
|
c#
|
asp.net
|
visual-studio-debugging
|
visual-studio-addins
| null |
07/25/2012 12:08:44
|
not a real question
|
How to debug visual studio add-in application build using Visual Studio 2010
===
I was just playing around a visual studio add-in extension application build using VS 2010. How to go for debugging such an application?
| 1 |
11,505,169 |
07/16/2012 13:17:33
| 1,528,998 |
07/16/2012 13:13:50
| 1 | 0 |
How to build a simple login system?
|
Can someone tell me how I can build a login system using PHP without encryption, please?
|
php
|
login
| null | null | null |
07/16/2012 13:18:54
|
not a real question
|
How to build a simple login system?
===
Can someone tell me how I can build a login system using PHP without encryption, please?
| 1 |
5,959,709 |
05/11/2011 05:33:10
| 748,054 |
05/11/2011 05:33:10
| 1 | 0 |
COBOL Question - UNICODE
|
We are currently looking to convert our legacy COBOL code from ANSII to UNICODE however we have come across a problem where just changing the PIC X fields to PIC N and setting NSYMBOL(NATIONAL) will cause problems when data structures contain a REDEFINES or RENAME statement with elementary DATA items using PIC 9 fields.
01 WS-RECORD PIC N(26).
01 WS-RECORD-1 REDEFINES WS-RECORD.
02 WS-NUM PIC 9(6).
02 WS-DATA PIC N(20).
MOVE N"123456ABCDEFGHIJKLM" TO WS-RECORD.
In the above the string being moved will be in UTF-16 format, therefore the field WS-NUM will be corrupt as it will contain X"310032003300" which is an invalid numeric, WS-DATA will contain X"3400350036004100..etc
The question is, when using NATIONAL (UTF-16) data types how can numerics be handled so as to get the correct data after it has been redefined.
I can sort of get this to work doing the following but will get invalid data in other WS-RECORD.
MOVE 123456 TO WS-NUM.
MOVE N"ABCDEFGHIJKLM" TO WS_DATA.
The above will be correct, however if I examine WS-RECORD I will see ???ABCDEFGHIJKLM where ??? is X"313233343536" in hexi-decimal.
Our problem is that we have multiple data records depending on the record type identifier, we also use redefines on many of our LINKAGE ITEMS.
Has anyone had experience moving from legacy ASCII to UNICODE?
|
cobol
| null | null | null | null | null |
open
|
COBOL Question - UNICODE
===
We are currently looking to convert our legacy COBOL code from ANSII to UNICODE however we have come across a problem where just changing the PIC X fields to PIC N and setting NSYMBOL(NATIONAL) will cause problems when data structures contain a REDEFINES or RENAME statement with elementary DATA items using PIC 9 fields.
01 WS-RECORD PIC N(26).
01 WS-RECORD-1 REDEFINES WS-RECORD.
02 WS-NUM PIC 9(6).
02 WS-DATA PIC N(20).
MOVE N"123456ABCDEFGHIJKLM" TO WS-RECORD.
In the above the string being moved will be in UTF-16 format, therefore the field WS-NUM will be corrupt as it will contain X"310032003300" which is an invalid numeric, WS-DATA will contain X"3400350036004100..etc
The question is, when using NATIONAL (UTF-16) data types how can numerics be handled so as to get the correct data after it has been redefined.
I can sort of get this to work doing the following but will get invalid data in other WS-RECORD.
MOVE 123456 TO WS-NUM.
MOVE N"ABCDEFGHIJKLM" TO WS_DATA.
The above will be correct, however if I examine WS-RECORD I will see ???ABCDEFGHIJKLM where ??? is X"313233343536" in hexi-decimal.
Our problem is that we have multiple data records depending on the record type identifier, we also use redefines on many of our LINKAGE ITEMS.
Has anyone had experience moving from legacy ASCII to UNICODE?
| 0 |
11,327,739 |
07/04/2012 10:59:15
| 1,501,342 |
07/04/2012 10:54:17
| 1 | 0 |
asd scroller - how to pause on hover JS/jQuery
|
I have a simple scroller for ads ;]
Need help whit pause it on hover.
$(document).ready(function(mnmTicker){
var mnmAdsInterval = 2000;
/* Do not modify code below */
var mnmAdsLenght = m3ads_numberadverts;
function mnmSlideAds(){
hT = $('.someClass').find('a');
hT2 = hT;
slideMargin = document.getElementsByClassName('a')[0].offsetHeight;
$(".someClass .a:first").clone().appendTo(".M3Adverts");
$(".someClass .a:first").animate({"marginTop":-+slideMargin,},1800, function(){
$(this).remove();
});
};
var interval = setInterval(mnmSlideAds, mnmAdsInterval); [/code]
BTW. Im testing this:
$('.someClass .a').hover(function() {
clearInterval(interval);
}, function() {
interval = setInterval(mnmSlideAds, mnmAdsInterval);
});
but do not work ;/
|
javascript
|
jquery
| null | null | null | null |
open
|
asd scroller - how to pause on hover JS/jQuery
===
I have a simple scroller for ads ;]
Need help whit pause it on hover.
$(document).ready(function(mnmTicker){
var mnmAdsInterval = 2000;
/* Do not modify code below */
var mnmAdsLenght = m3ads_numberadverts;
function mnmSlideAds(){
hT = $('.someClass').find('a');
hT2 = hT;
slideMargin = document.getElementsByClassName('a')[0].offsetHeight;
$(".someClass .a:first").clone().appendTo(".M3Adverts");
$(".someClass .a:first").animate({"marginTop":-+slideMargin,},1800, function(){
$(this).remove();
});
};
var interval = setInterval(mnmSlideAds, mnmAdsInterval); [/code]
BTW. Im testing this:
$('.someClass .a').hover(function() {
clearInterval(interval);
}, function() {
interval = setInterval(mnmSlideAds, mnmAdsInterval);
});
but do not work ;/
| 0 |
4,400,677 |
12/09/2010 16:35:42
| 442,912 |
09/08/2010 23:10:09
| 3 | 0 |
Android AsyncTask - One SubClass Per Database Operation?
|
I have an activity for initialising a game, that does multiple selects and inserts from a number of SQLite tables.
I'm trying to understand AsyncTask, but, from all the examples I've read so far, I'm wondering if I am going to have to subclass AsyncTask for every single different data operation I need to do?
For example, my NewGame Activity does the following:
1) Insert new player record into PLAYER table
2) Insert new player's pet record into PET table
3) Select cursor of n records from INVENTORY
4) Insert array of ranomly chosen inventory items into PLAYER_OWNED table
5) ....more things of a similar nature
There are going to be a few more selects and inserts for various things too, so having an individual subclass for each one is going to get crazy. Not to mention that there will be about 8 activities for this game, all relying heavily on database reads and writes.
So, basically, how do I best use AsyncTask to carry out a number of different SQLite operations?
|
android
|
sqlite
|
android-asynctask
| null | null | null |
open
|
Android AsyncTask - One SubClass Per Database Operation?
===
I have an activity for initialising a game, that does multiple selects and inserts from a number of SQLite tables.
I'm trying to understand AsyncTask, but, from all the examples I've read so far, I'm wondering if I am going to have to subclass AsyncTask for every single different data operation I need to do?
For example, my NewGame Activity does the following:
1) Insert new player record into PLAYER table
2) Insert new player's pet record into PET table
3) Select cursor of n records from INVENTORY
4) Insert array of ranomly chosen inventory items into PLAYER_OWNED table
5) ....more things of a similar nature
There are going to be a few more selects and inserts for various things too, so having an individual subclass for each one is going to get crazy. Not to mention that there will be about 8 activities for this game, all relying heavily on database reads and writes.
So, basically, how do I best use AsyncTask to carry out a number of different SQLite operations?
| 0 |
8,832,984 |
01/12/2012 09:49:45
| 925,471 |
09/02/2011 14:32:49
| 80 | 1 |
AJAX and C# method. Returning Lists to the client
|
I have a C# method, which queries my SQL Server 2008 DB. This method will return a List of strings.
The plan is for this list to be displayed in a asp:listbox on the web site.
What I wanted to know is how do I call this method using AJAX and then use the list it returns?
Thanks
|
c#
|
ajax
|
jquery-ajax
| null | null |
01/13/2012 15:03:21
|
not a real question
|
AJAX and C# method. Returning Lists to the client
===
I have a C# method, which queries my SQL Server 2008 DB. This method will return a List of strings.
The plan is for this list to be displayed in a asp:listbox on the web site.
What I wanted to know is how do I call this method using AJAX and then use the list it returns?
Thanks
| 1 |
6,254,479 |
06/06/2011 15:39:47
| 672,081 |
03/22/2011 22:26:37
| 41 | 2 |
php or jquery - How can I make a global index for my site?
|
I've some templates in my webserver wich act like portfolio and wanted to do something like dribbble.com homepage, loading the index of each template inside a square.
What do you recommend me?
Thanks,
Pluda
|
php
|
jquery
| null | null | null |
06/07/2011 04:04:01
|
not a real question
|
php or jquery - How can I make a global index for my site?
===
I've some templates in my webserver wich act like portfolio and wanted to do something like dribbble.com homepage, loading the index of each template inside a square.
What do you recommend me?
Thanks,
Pluda
| 1 |
11,475,647 |
07/13/2012 17:47:00
| 1,473,647 |
06/22/2012 01:09:21
| 15 | 0 |
OpenCV installation
|
HI i downloaded the tar archive for open CV and extracted it and then in a new folder used cmake i get this error every time while its processing the system.cpp.o file i am new to open cv and installation on linux from source please help. The error is:
The tar file is in /home/abir directory
In file included from /home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:460:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:37:1: warning: missing terminating " character
In file included from /home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:460:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:37: error: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:38:11: error: too many decimal points in number
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:38:29: error: invalid suffix "st" on integer constant
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:42:29: warning: character constant too long for its type
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:59: error: stray ‘@’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:59: error: stray ‘@’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:70:10: error: #include expects "FILENAME" or <FILENAME>
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:73: error: stray ‘\’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:73:9: warning: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:73: error: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:76:23: warning: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1482:32: warning: "_FILE_OFFSET_BITS" is not defined
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517: error: stray ‘\’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517:4: warning: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517: error: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc: In function ‘const std::string& cv::getBuildInformation()’:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:38: error: expected ‘,’ or ‘;’ before ‘version’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:140: error: ‘z_stream’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:142: error: expected ‘;’ before ‘typedef’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:163: error: ‘gz_header’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:165: error: expected ‘;’ before ‘typedef’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1507: error: ‘ZEXTERN’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1507: error: expected ‘;’ before ‘const’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1513: error: no return statement in function returning non-void [-Wreturn-type]
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc: At global scope:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517: error: expected unqualified-id before ‘)’ token
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:462: error: expected unqualified-id before ‘return’
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:465: error: ‘string’ does not name a type
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:474: error: ‘string’ does not name a type
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: In function ‘bool setBreakOnError(bool)’:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:535: warning: no previous declaration for ‘bool setBreakOnError(bool)’ [-Wmissing-declarations]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: At global scope:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: error: ISO C++ forbids declaration of ‘Exception’ with no type [-fpermissive]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: error: expected ‘,’ or ‘...’ before ‘&’ token
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: In function ‘void error(int)’:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: warning: no previous declaration for ‘void error(int)’ [-Wmissing-declarations]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:545: error: ‘exc’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:549: error: ‘exc’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:565: error: ‘exc’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: At global scope:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: warning: unused parameter ‘Exception’ [-Wunused-parameter]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: In function ‘int (* redirectError(int (*)(int, const char*, const char*, const char*, int, void*), void*, void**))(int, const char*, const char*, const char*, int, void*)’:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:569: warning: no previous declaration for ‘int (* redirectError(int (*)(int, const char*, const char*, const char*, int, void*), void*, void**))(int, const char*, const char*, const char*, int, void*)’ [-Wmissing-declarations]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: At global scope:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:582: error: expected declaration before ‘}’ token
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
|
linux
|
opencv
|
installation
|
debian
| null |
07/13/2012 17:52:29
|
not a real question
|
OpenCV installation
===
HI i downloaded the tar archive for open CV and extracted it and then in a new folder used cmake i get this error every time while its processing the system.cpp.o file i am new to open cv and installation on linux from source please help. The error is:
The tar file is in /home/abir directory
In file included from /home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:460:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:37:1: warning: missing terminating " character
In file included from /home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:460:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:37: error: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:38:11: error: too many decimal points in number
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:38:29: error: invalid suffix "st" on integer constant
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:42:29: warning: character constant too long for its type
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:59: error: stray ‘@’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:59: error: stray ‘@’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:70:10: error: #include expects "FILENAME" or <FILENAME>
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:73: error: stray ‘\’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:73:9: warning: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:73: error: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:76:23: warning: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1482:32: warning: "_FILE_OFFSET_BITS" is not defined
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517: error: stray ‘\’ in program
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517:4: warning: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517: error: missing terminating " character
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc: In function ‘const std::string& cv::getBuildInformation()’:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:38: error: expected ‘,’ or ‘;’ before ‘version’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:140: error: ‘z_stream’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:142: error: expected ‘;’ before ‘typedef’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:163: error: ‘gz_header’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:165: error: expected ‘;’ before ‘typedef’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1507: error: ‘ZEXTERN’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1507: error: expected ‘;’ before ‘const’
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1513: error: no return statement in function returning non-void [-Wreturn-type]
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc: At global scope:
/home/abir/disertation/OpenCV-2.4.2/build/modules/core/version_string.inc:1517: error: expected unqualified-id before ‘)’ token
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:462: error: expected unqualified-id before ‘return’
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:465: error: ‘string’ does not name a type
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:474: error: ‘string’ does not name a type
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: In function ‘bool setBreakOnError(bool)’:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:535: warning: no previous declaration for ‘bool setBreakOnError(bool)’ [-Wmissing-declarations]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: At global scope:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: error: ISO C++ forbids declaration of ‘Exception’ with no type [-fpermissive]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: error: expected ‘,’ or ‘...’ before ‘&’ token
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: In function ‘void error(int)’:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: warning: no previous declaration for ‘void error(int)’ [-Wmissing-declarations]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:545: error: ‘exc’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:549: error: ‘exc’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:565: error: ‘exc’ was not declared in this scope
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: At global scope:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:542: warning: unused parameter ‘Exception’ [-Wunused-parameter]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: In function ‘int (* redirectError(int (*)(int, const char*, const char*, const char*, int, void*), void*, void**))(int, const char*, const char*, const char*, int, void*)’:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:569: warning: no previous declaration for ‘int (* redirectError(int (*)(int, const char*, const char*, const char*, int, void*), void*, void**))(int, const char*, const char*, const char*, int, void*)’ [-Wmissing-declarations]
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp: At global scope:
/home/abir/disertation/OpenCV-2.4.2/modules/core/src/system.cpp:582: error: expected declaration before ‘}’ token
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
| 1 |
3,797,006 |
09/26/2010 07:50:01
| 257,022 |
01/22/2010 19:15:38
| 1,940 | 48 |
Help needed with mod_rewrite and htaccess for Drupal
|
I want to enable .htaccess files on my server in order to use "clean_url" functionality in Drupal.
This is what I've done so far:
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
cd /etc/apache2/mods-enabled
grep mod_rewrite *
In phpinfo() results I can see: `mod_rewrite`, so I guess the module is enabled.
I've added a htaccess file with the following content:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /path/to/website
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
But still it says me my server doesn't provide such functionality. What am I missing ?
|
apache
|
drupal
|
.htaccess
|
mod-rewrite
|
drupal-6
| null |
open
|
Help needed with mod_rewrite and htaccess for Drupal
===
I want to enable .htaccess files on my server in order to use "clean_url" functionality in Drupal.
This is what I've done so far:
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
cd /etc/apache2/mods-enabled
grep mod_rewrite *
In phpinfo() results I can see: `mod_rewrite`, so I guess the module is enabled.
I've added a htaccess file with the following content:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /path/to/website
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
But still it says me my server doesn't provide such functionality. What am I missing ?
| 0 |
10,273,540 |
04/23/2012 00:45:20
| 1,208,541 |
02/14/2012 07:36:37
| 1 | 0 |
Improving R Code for Memory Experiment
|
I am working on a data set for my experiment and I am trying to find out how how many trials resulted in an incorrect action on the part of the participant. In my table (see below) I added three columns at the end: prefix, corrfix, and errfix (0 indicates error and a numerical value indicates a correct action). What I want to start with is seeing how many trials per participant resulted in an incorrect action for the prefix column (i.e., there is no numerical value for that trial, indicating that they did no perform a correct action).
RECORDING_SESSION_LABEL CURRENT_FIX_INDEX identifier prefix corrfix errfix
10161 3 1 0 243 0
10161 1 29 0 0 0
10161 2 29 0 0 0
10161 3 29 201 0 0
10161 4 29 130 0 0
10161 5 29 0 231 0
I have been working on a code, but it will return multiple lines (of the same trial) when I only want trials where there is no numerical value (each participant should different trials per line) I would appreciate any help or suggestions. I am trying hard to refine my R skills.
flag=0
flag=1
if(new[i,]$CURRENT_FIX_INDEX==1){
flag=1
}
if (flag==1) {
if(new[i,]$prefix==0){
cbind(new$RECORDING_SESSION_LABEL, new$identifier)}
|
r
| null | null | null | null |
04/23/2012 11:04:43
|
too localized
|
Improving R Code for Memory Experiment
===
I am working on a data set for my experiment and I am trying to find out how how many trials resulted in an incorrect action on the part of the participant. In my table (see below) I added three columns at the end: prefix, corrfix, and errfix (0 indicates error and a numerical value indicates a correct action). What I want to start with is seeing how many trials per participant resulted in an incorrect action for the prefix column (i.e., there is no numerical value for that trial, indicating that they did no perform a correct action).
RECORDING_SESSION_LABEL CURRENT_FIX_INDEX identifier prefix corrfix errfix
10161 3 1 0 243 0
10161 1 29 0 0 0
10161 2 29 0 0 0
10161 3 29 201 0 0
10161 4 29 130 0 0
10161 5 29 0 231 0
I have been working on a code, but it will return multiple lines (of the same trial) when I only want trials where there is no numerical value (each participant should different trials per line) I would appreciate any help or suggestions. I am trying hard to refine my R skills.
flag=0
flag=1
if(new[i,]$CURRENT_FIX_INDEX==1){
flag=1
}
if (flag==1) {
if(new[i,]$prefix==0){
cbind(new$RECORDING_SESSION_LABEL, new$identifier)}
| 3 |
3,442,686 |
08/09/2010 17:49:11
| 415,374 |
08/09/2010 17:46:35
| 1 | 0 |
Should i learn C++ or ASM ?
|
I'm confused should i learn C++ or ASM?
I'm just a hobbyist so no big deal but i need some advise.
thank you
|
c++
|
asm
| null | null | null |
08/09/2010 17:57:36
|
not constructive
|
Should i learn C++ or ASM ?
===
I'm confused should i learn C++ or ASM?
I'm just a hobbyist so no big deal but i need some advise.
thank you
| 4 |
11,644,301 |
07/25/2012 07:01:46
| 973,477 |
09/30/2011 16:44:26
| 267 | 7 |
How to programatically change keyboard in iOS?
|
I would like to programatically change keyboard when i click a button event.
I used custom keyboard in my app, but i need to change English (US) keyboard in programatically when i click a button on my custom keyboard.
So how can i?
Thanks in advanced.
|
ios
| null | null | null | null | null |
open
|
How to programatically change keyboard in iOS?
===
I would like to programatically change keyboard when i click a button event.
I used custom keyboard in my app, but i need to change English (US) keyboard in programatically when i click a button on my custom keyboard.
So how can i?
Thanks in advanced.
| 0 |
2,353,849 |
03/01/2010 04:19:22
| 217,597 |
11/24/2009 07:00:19
| 6 | 1 |
J2ME/Java: Referencing StringBuffer through Threads
|
This question might be long, but I want to provide much information.
**Overview**: I'm creating a Stock Quotes Ticker app for Blackberry. But I'm having problems with my StringBuffer that contains an individual Stock information.
**Process**: My app connects to our server via SocketConnection. The server sends out a formatted set of strings that contains the latest Stock trade. So whenever a new trade happens, the server will send out an individual Stock Quote of that trade. Through an InputStream I am able to read that information and place each character in a StringBuffer that is referenced by Threads. By parsing based on ***char3*** I am able to determine a set of stock quote/information.
char1 - to separate data
char3 - means end of a stock quote/information
**sample stock quote format sent out by our server:**
stock_quote_name(char 1)some_data(char1)some_data(char1)(char3)
My app then parses that stock quote to compare certain data and formats it how it will look like when displayed in the screen. When trades happen gradually(slow) the app works perfectly. However..
**Problem**: When trades happen too quickly and almost at the same time, My app is not able to handle the information sent efficiently. The StringBuffer has its contents combined with the next trade. Meaning Two stock information in one StringBuffer.
**field should be:** Stock_quote_name some_data some_data
**sample of what's happening:** Stock_quote_name some_data some_dataStock_quote_name some_data some_data
here's my code for this part:
while (-1 != (data = is.read()))
{
sb.append((char)data);
while(3 != (data = is.read()))
{
sb.append((char)data);
}
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
try
{
synchronized(UiApplication.getEventLock())
{
SetStringBuffer(sb);
DisplayStringBuffer();
RefreshStringBuffer();
}
} catch (Exception e)
{
System.out.println("Error in setting stringbuffer: " + e.toString());
}
}
});
}
public synchronized void DisplayStringBuffer()
{
try
{
//parse sb - string buffer
......
}
catch(Exception ex)
{
System.out.println("error in DisplayStringBuffer(): " + ex.toString());
}
}
public synchronized void SetStringBuffer(StringBuffer dataBuffer)
{
this.sb =dataBuffer;
System.out.println(sb);
}
public synchronized void RefreshStringBuffer()
{
this.sb.delete(0, this.sb.length());
}
From what I can see, when trades happen very fast, The StringBuffer is not refreshed immediately and still has the contents of the previous trade, when i try to put new data.
**My Question is:**
Do you guys have any suggestion on how i can put data into the StringBuffer, without the next information being appended to the first content
|
blackberry
|
java-me
|
stringbuffer
|
inputstream
|
multithreading
| null |
open
|
J2ME/Java: Referencing StringBuffer through Threads
===
This question might be long, but I want to provide much information.
**Overview**: I'm creating a Stock Quotes Ticker app for Blackberry. But I'm having problems with my StringBuffer that contains an individual Stock information.
**Process**: My app connects to our server via SocketConnection. The server sends out a formatted set of strings that contains the latest Stock trade. So whenever a new trade happens, the server will send out an individual Stock Quote of that trade. Through an InputStream I am able to read that information and place each character in a StringBuffer that is referenced by Threads. By parsing based on ***char3*** I am able to determine a set of stock quote/information.
char1 - to separate data
char3 - means end of a stock quote/information
**sample stock quote format sent out by our server:**
stock_quote_name(char 1)some_data(char1)some_data(char1)(char3)
My app then parses that stock quote to compare certain data and formats it how it will look like when displayed in the screen. When trades happen gradually(slow) the app works perfectly. However..
**Problem**: When trades happen too quickly and almost at the same time, My app is not able to handle the information sent efficiently. The StringBuffer has its contents combined with the next trade. Meaning Two stock information in one StringBuffer.
**field should be:** Stock_quote_name some_data some_data
**sample of what's happening:** Stock_quote_name some_data some_dataStock_quote_name some_data some_data
here's my code for this part:
while (-1 != (data = is.read()))
{
sb.append((char)data);
while(3 != (data = is.read()))
{
sb.append((char)data);
}
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
try
{
synchronized(UiApplication.getEventLock())
{
SetStringBuffer(sb);
DisplayStringBuffer();
RefreshStringBuffer();
}
} catch (Exception e)
{
System.out.println("Error in setting stringbuffer: " + e.toString());
}
}
});
}
public synchronized void DisplayStringBuffer()
{
try
{
//parse sb - string buffer
......
}
catch(Exception ex)
{
System.out.println("error in DisplayStringBuffer(): " + ex.toString());
}
}
public synchronized void SetStringBuffer(StringBuffer dataBuffer)
{
this.sb =dataBuffer;
System.out.println(sb);
}
public synchronized void RefreshStringBuffer()
{
this.sb.delete(0, this.sb.length());
}
From what I can see, when trades happen very fast, The StringBuffer is not refreshed immediately and still has the contents of the previous trade, when i try to put new data.
**My Question is:**
Do you guys have any suggestion on how i can put data into the StringBuffer, without the next information being appended to the first content
| 0 |
2,273,246 |
02/16/2010 13:42:01
| 260,056 |
01/27/2010 12:35:58
| 6 | 1 |
how to get click event from a button in gridview
|
I am working on a app where i need to get the click event of a button in gridview. I am not getting it in row command may be because i am adding it dynamically as follows:
protected void gviewTemplate_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[1].Text != e.Row.Cells[2].Text)
{
e.Row.BackColor = System.Drawing.Color.Red;
LinkButton lbtnReload = new LinkButton();
lbtnReload.CommandArgument = e.Row.Cells[12].Text;
lbtnReload.Attributes.Add("onclick", "javascript:ShowDiv()");
lbtnReload.CommandName = "reload";
lbtnReload.Text = "Reload";
e.Row.Cells[1].Controls.Add(lbtnReload);
DataTable dt = (DataTable)ViewState["update"];
DataRow dr = dt.NewRow();
dr["id"] = e.Row.Cells[0].ToString();
dr["image"] = e.Row.Cells[1].ToString();
dt.Rows.Add(dr);
}
}
}
i have displlayed it in gridview in following manner
<asp:BoundField ItemStyle-Width="100" DataField="Uploded"
HeaderText="Uploaded Image" >
i need to get values from first column of this grid and update it into some hidden variable so that i can use it later. How will i do it. Thanks in advance
|
gridview
| null | null | null | null | null |
open
|
how to get click event from a button in gridview
===
I am working on a app where i need to get the click event of a button in gridview. I am not getting it in row command may be because i am adding it dynamically as follows:
protected void gviewTemplate_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[1].Text != e.Row.Cells[2].Text)
{
e.Row.BackColor = System.Drawing.Color.Red;
LinkButton lbtnReload = new LinkButton();
lbtnReload.CommandArgument = e.Row.Cells[12].Text;
lbtnReload.Attributes.Add("onclick", "javascript:ShowDiv()");
lbtnReload.CommandName = "reload";
lbtnReload.Text = "Reload";
e.Row.Cells[1].Controls.Add(lbtnReload);
DataTable dt = (DataTable)ViewState["update"];
DataRow dr = dt.NewRow();
dr["id"] = e.Row.Cells[0].ToString();
dr["image"] = e.Row.Cells[1].ToString();
dt.Rows.Add(dr);
}
}
}
i have displlayed it in gridview in following manner
<asp:BoundField ItemStyle-Width="100" DataField="Uploded"
HeaderText="Uploaded Image" >
i need to get values from first column of this grid and update it into some hidden variable so that i can use it later. How will i do it. Thanks in advance
| 0 |
6,705,087 |
07/15/2011 09:28:42
| 38,975 |
11/19/2008 15:26:15
| 3,227 | 138 |
Where is TweetSharp?
|
Cannot find TweetSharp v2.0
http://tweetsharp.codeplex.com/ - 404
http://code.google.com/p/tweetsharp/ - 403
https://github.com/danielcrenna/tweetsharp/ - seems out of date, for example does not have TweetSharp.Twitter.dll
This is quite strange. May be some light on this?
|
c#
|
twitter
|
tweetsharp
| null | null |
07/15/2011 10:12:44
|
too localized
|
Where is TweetSharp?
===
Cannot find TweetSharp v2.0
http://tweetsharp.codeplex.com/ - 404
http://code.google.com/p/tweetsharp/ - 403
https://github.com/danielcrenna/tweetsharp/ - seems out of date, for example does not have TweetSharp.Twitter.dll
This is quite strange. May be some light on this?
| 3 |
10,308,352 |
04/25/2012 01:51:17
| 1,345,260 |
04/19/2012 22:49:52
| 22 | 0 |
Is BLL absolutely necessary?
|
I'm new to the .Net world. I'm creating a website. It has DAL & Presentation Layer. As I mentioned earlier I'm a novice & I'm not sure how to create a BLL. So I was wondering if my current approach is fine? Will it cause any problems? Its a simple application which queries the SQL Server Database, Selects & Updates the Tables. Please help me understand this better
|
bll
| null | null | null | null |
04/25/2012 02:30:04
|
not a real question
|
Is BLL absolutely necessary?
===
I'm new to the .Net world. I'm creating a website. It has DAL & Presentation Layer. As I mentioned earlier I'm a novice & I'm not sure how to create a BLL. So I was wondering if my current approach is fine? Will it cause any problems? Its a simple application which queries the SQL Server Database, Selects & Updates the Tables. Please help me understand this better
| 1 |
1,729,761 |
11/13/2009 15:03:42
| 208,420 |
11/11/2009 05:16:51
| 15 | 0 |
2-demenstional arrangement practice
|
First, sorry for my poor language.
and I'm using VC++express myself.
Now i'm studying about arrangements.
The book gave me a project that
>make [5][5] arrangement
>vertical array is for subjects(4 of em)
>horizontal array is for students(same, 4 of em)
>each variable saves the score!
>end of the each low, sum entire value
![alt text][1]
and this is my answar code
>int main(void)
>{
>
int arr[5][5];
int i,j;
while(1)
{
printf("student: 1.Jim,2.Jombi,3.Joly,4.Moran if you done, type 0\n");
scanf("%d", &i);
if(i=0)
break;
printf("subject: 1.english,2.spanish,3.poolish,4.flash\n");
scanf("%d", &j);
printf("insult score!\n");
scanf("%d", arr[i-1][j-1]);//insulting score
}
for(i=0;i<4;i++)//initialization of sum parts
{
arr[i][4]=0;
arr[4][i]=0;
}
for(i=0;i<4;i++)
for(j=0;j<4;j++)
arr[4][i]+=arr[j][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
arr[i][4]+=arr[i][j];
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
printf("%d ",arr[i][j]);//printing result
printf("\n");
}
return 0;
>}
I complitely dont know why this code doesn't work
and even when i tried only "while" part, it didn't work also.
why is this?
[1]: http://img2.dcinside.com/viewGimage.php?no=2abcdc2aead569e96abec2b447826b2e8a31ed2bd95886ec8f7114dea41c5e0b50a950ba41f8c050e72c590e2df7750ec3b6ad8afa0bf7f7de8c653d99d03a
|
c
| null | null | null | null | null |
open
|
2-demenstional arrangement practice
===
First, sorry for my poor language.
and I'm using VC++express myself.
Now i'm studying about arrangements.
The book gave me a project that
>make [5][5] arrangement
>vertical array is for subjects(4 of em)
>horizontal array is for students(same, 4 of em)
>each variable saves the score!
>end of the each low, sum entire value
![alt text][1]
and this is my answar code
>int main(void)
>{
>
int arr[5][5];
int i,j;
while(1)
{
printf("student: 1.Jim,2.Jombi,3.Joly,4.Moran if you done, type 0\n");
scanf("%d", &i);
if(i=0)
break;
printf("subject: 1.english,2.spanish,3.poolish,4.flash\n");
scanf("%d", &j);
printf("insult score!\n");
scanf("%d", arr[i-1][j-1]);//insulting score
}
for(i=0;i<4;i++)//initialization of sum parts
{
arr[i][4]=0;
arr[4][i]=0;
}
for(i=0;i<4;i++)
for(j=0;j<4;j++)
arr[4][i]+=arr[j][i];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
arr[i][4]+=arr[i][j];
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
printf("%d ",arr[i][j]);//printing result
printf("\n");
}
return 0;
>}
I complitely dont know why this code doesn't work
and even when i tried only "while" part, it didn't work also.
why is this?
[1]: http://img2.dcinside.com/viewGimage.php?no=2abcdc2aead569e96abec2b447826b2e8a31ed2bd95886ec8f7114dea41c5e0b50a950ba41f8c050e72c590e2df7750ec3b6ad8afa0bf7f7de8c653d99d03a
| 0 |
6,600,340 |
07/06/2011 17:14:14
| 809,096 |
06/21/2011 19:01:19
| 1 | 0 |
Text Files and Android Application Q
|
I am new to Android programming, and I am trying to make an application that will read files from a bluetooth device. I don't need to worry about that right now, since that is the last step I plan to do.
I want to create my own textfile so that I could read fake data from that file and use it to test if my code and function of the application actually work. How would I go about creating this file in Android? And also, how would I also read the text file into my code?
|
android
|
text-files
| null | null | null | null |
open
|
Text Files and Android Application Q
===
I am new to Android programming, and I am trying to make an application that will read files from a bluetooth device. I don't need to worry about that right now, since that is the last step I plan to do.
I want to create my own textfile so that I could read fake data from that file and use it to test if my code and function of the application actually work. How would I go about creating this file in Android? And also, how would I also read the text file into my code?
| 0 |
5,205,109 |
03/05/2011 16:34:05
| 122,528 |
06/13/2009 18:06:38
| 1,560 | 2 |
Enumerable.Where - How To Read The API
|
I am trying to understand specifically why it is neccessary to have this 'Where<TSource>'
WHat does the type straight after Where tell you?
I understand the 'this' concept which means its an extension method but cannoth understand the type after Where
[code]
public static IEnumerable<TSource> Where<TSource>(
this IEnumerable<TSource> source,
Func<TSource, bool> predicate
)
[/code]
|
c#
| null | null | null | null | null |
open
|
Enumerable.Where - How To Read The API
===
I am trying to understand specifically why it is neccessary to have this 'Where<TSource>'
WHat does the type straight after Where tell you?
I understand the 'this' concept which means its an extension method but cannoth understand the type after Where
[code]
public static IEnumerable<TSource> Where<TSource>(
this IEnumerable<TSource> source,
Func<TSource, bool> predicate
)
[/code]
| 0 |
10,692,110 |
05/21/2012 20:25:43
| 1,407,892 |
05/21/2012 12:45:25
| 1 | 0 |
multiple nested macro
|
Let's consider the code
1. #define fx1( fgn, x ) fgn( x )
2. #define fx2( fgn, x ) fgn( x )
3. #define f1( x ) x
4. #define f2( x ) fx1( f1, x )
5. #define f( x ) fx2( f2, x )
6. #if f( 3 ) != 3
7. .....
8. #endif
It is some invented code, used only to show the problem, and in the above form it works as expected. The thing is that fx1 and fx2 are identical but if I try to use, let's say fx1 instead of fx2 on line 5, I get an error: "unexpected tokens following preprocessor directive - expected a newline" at line 6.
Question is why? and how can I make it work (use only one fx function)?
Thanks
|
macros
|
nested
| null | null | null |
05/22/2012 13:21:05
|
not a real question
|
multiple nested macro
===
Let's consider the code
1. #define fx1( fgn, x ) fgn( x )
2. #define fx2( fgn, x ) fgn( x )
3. #define f1( x ) x
4. #define f2( x ) fx1( f1, x )
5. #define f( x ) fx2( f2, x )
6. #if f( 3 ) != 3
7. .....
8. #endif
It is some invented code, used only to show the problem, and in the above form it works as expected. The thing is that fx1 and fx2 are identical but if I try to use, let's say fx1 instead of fx2 on line 5, I get an error: "unexpected tokens following preprocessor directive - expected a newline" at line 6.
Question is why? and how can I make it work (use only one fx function)?
Thanks
| 1 |
10,768,530 |
05/26/2012 17:52:45
| 1,041,117 |
11/11/2011 05:42:47
| 89 | 2 |
How to receive get parameters from url in struts2
|
I am using struts2 & configured so the url will look like as
www.myweb.com/index instead of www.myweb.com/index.action
But now the problem i am facing is how should i map in struts.xml file & get request parameters
as in struts1 i can receive it through mapping.getParameters() but what available in struts2 for this?
<action path="/profile/*"
type="net.viralpatel.struts.cleanurl.ProfileAction"
parameter="{1}">
<forward name="success" path="/profile.jsp" />
<forward name="fail" path="/profile.jsp" />
</action>
**String parameter = mapping.getParameter();**
So in struts2 if i hit
www.myweb.com/index/p=2
www.myweb.com/index/biz/name /*here biz & name are 2 parameters*/
www.myweb.com/index/biz/name/23 /*here biz & name & 23 are parameters*/
Thanks
|
java
|
struts-1
|
seo-friendly
|
strust2
| null | null |
open
|
How to receive get parameters from url in struts2
===
I am using struts2 & configured so the url will look like as
www.myweb.com/index instead of www.myweb.com/index.action
But now the problem i am facing is how should i map in struts.xml file & get request parameters
as in struts1 i can receive it through mapping.getParameters() but what available in struts2 for this?
<action path="/profile/*"
type="net.viralpatel.struts.cleanurl.ProfileAction"
parameter="{1}">
<forward name="success" path="/profile.jsp" />
<forward name="fail" path="/profile.jsp" />
</action>
**String parameter = mapping.getParameter();**
So in struts2 if i hit
www.myweb.com/index/p=2
www.myweb.com/index/biz/name /*here biz & name are 2 parameters*/
www.myweb.com/index/biz/name/23 /*here biz & name & 23 are parameters*/
Thanks
| 0 |
11,497,755 |
07/16/2012 03:22:33
| 1,510,869 |
07/09/2012 02:25:45
| 125 | 0 |
In which symfony file do i need to create entity functions
|
I am confused that in which file i need to create symfony functions.
E,g
I have class User.php and .
Now i have many functions
like
`addUser()` , `editUser()`, `sleectUserBySubject()` , `findUserBydate()`
Now i don't know where should i declare these
Entity\User.php
UserController.php
UserRepository.php
Model\User.php
Please guide which is the best practice
|
php
|
symfony-2.0
|
doctrine2
| null | null | null |
open
|
In which symfony file do i need to create entity functions
===
I am confused that in which file i need to create symfony functions.
E,g
I have class User.php and .
Now i have many functions
like
`addUser()` , `editUser()`, `sleectUserBySubject()` , `findUserBydate()`
Now i don't know where should i declare these
Entity\User.php
UserController.php
UserRepository.php
Model\User.php
Please guide which is the best practice
| 0 |
7,777,589 |
10/15/2011 11:34:25
| 986,408 |
10/09/2011 14:02:19
| 1 | 1 |
Symfony2 Bundle System
|
I'm just working through the Symfony2 Bible and I'm a little stuck on the bundle system. It is a great feature but I'm not quite sure how to split my flat PHP application into budles. It's my first time splitting my PHP code into a full featured MVC framework.
I'm working on a few online games (based on PHP) but how would I define the bundles ? Is it like one single onlinegame1 bundle with all the controllers and functions - Or like a login bundle, a register bundle, a war bundle - summarized one bundle for every single PHP file I got ?
I want to start clean and correct but I'm not quite sure if I understand that feature.
|
php
|
symfony-2.0
| null | null | null | null |
open
|
Symfony2 Bundle System
===
I'm just working through the Symfony2 Bible and I'm a little stuck on the bundle system. It is a great feature but I'm not quite sure how to split my flat PHP application into budles. It's my first time splitting my PHP code into a full featured MVC framework.
I'm working on a few online games (based on PHP) but how would I define the bundles ? Is it like one single onlinegame1 bundle with all the controllers and functions - Or like a login bundle, a register bundle, a war bundle - summarized one bundle for every single PHP file I got ?
I want to start clean and correct but I'm not quite sure if I understand that feature.
| 0 |
11,402,492 |
07/09/2012 20:20:13
| 1,217,281 |
02/17/2012 22:30:51
| 55 | 4 |
Separate Full Sentences in a block of NSString text
|
I have been trying to use Regular Expression to separate full sentences in a big block of text. I can't use the componentsSeparatedByCharactersInSet because it will obviously fail with sentences ending in ?!, !!, ... I have seen some external classes to do componentSeparateByRegEx but I prefer doing it without adding an external library.
Here is a sample input
**Hi, I am testing. How are you? Wow!! this is the best, and I am happy.**
The output should be an array
first element: **Hi, I am testing.**
second element: **How are you?**
third element: **wow!!**
forth element: **this is the best, and I am happy.**
This is what I have but as I mentioned it shouldn't do what I intend. Probably a regular expression will do a much better job here.
-(NSArray *)getArrayOfFullSentencesFromBlockOfText:(NSString *)textBlock{
NSMutableCharacterSet *characterSet = [[NSMutableCharacterSet alloc] init];
[characterSet addCharactersInString:@".?!"];
NSArray * sentenceArray = [textBlock componentsSeparatedByCharactersInSet:characterSet];
return sentenceArray;
}
Thanks for your help,
|
objective-c
|
ios
|
ios5
|
iphone-sdk-4.0
| null | null |
open
|
Separate Full Sentences in a block of NSString text
===
I have been trying to use Regular Expression to separate full sentences in a big block of text. I can't use the componentsSeparatedByCharactersInSet because it will obviously fail with sentences ending in ?!, !!, ... I have seen some external classes to do componentSeparateByRegEx but I prefer doing it without adding an external library.
Here is a sample input
**Hi, I am testing. How are you? Wow!! this is the best, and I am happy.**
The output should be an array
first element: **Hi, I am testing.**
second element: **How are you?**
third element: **wow!!**
forth element: **this is the best, and I am happy.**
This is what I have but as I mentioned it shouldn't do what I intend. Probably a regular expression will do a much better job here.
-(NSArray *)getArrayOfFullSentencesFromBlockOfText:(NSString *)textBlock{
NSMutableCharacterSet *characterSet = [[NSMutableCharacterSet alloc] init];
[characterSet addCharactersInString:@".?!"];
NSArray * sentenceArray = [textBlock componentsSeparatedByCharactersInSet:characterSet];
return sentenceArray;
}
Thanks for your help,
| 0 |
10,831,532 |
05/31/2012 10:09:56
| 1,310,527 |
04/03/2012 13:19:35
| 32 | 0 |
Python (beginner): CSV column writing, unexpected output for time-autocorrelation function
|
Trying to write a fourth column to a set of data which looks like this
8000.5 16745 0.1257
8001.0 16745 0.1242
8001.5 16745 0.1565
8002.0 16745 0.1595
Which has the number of times the second number (i.e. 16745) has been counted in that particular file (it does change, the list has a couple thousand entries). i.e. if this were the whole file
8000.5 16745 0.1257 4
8001.0 16745 0.1242 4
8001.5 16745 0.1565 4
8002.0 16745 0.1595 4
The problem with my code seems to be in the writing stage, the dictionary works, and csv.reader is reading the file fine if I print it but when it comes to appending the only dictionary key it picks up (field[1]) seems to be one where 16745 is -1 and the count of this is printed in the fourth column for all rows. I can't understand why it is cross referencing with the dictionary only for this value and not on a per row basis.
i.e. I get
8000.5 16745 0.1257 [count of -1 in column 2]
8001.0 16745 0.1242 [count of -1 in column 2]
8001.5 16745 0.1565 [count of -1 in column 2]
8002.0 16745 0.1595 [count of -1 in column 2]
Any help would be greatly appreciated!
import numpy
import string
import csv
import sys
import os
time = []
water = []
itemcount ={}
global filename
filename = sys.argv[1]
f1 = open(sys.argv[1], 'rt')
for line in f1:
fields = line.split()
time.append(fields[0])
water.append(fields[1])
f1.close()
for x in water:
a = water.count(x)
itemcount[x] = a
writerfp = open('watout.csv', 'w')
writer = csv.writer(writerfp)
for row in csv.reader(open(filename, 'r')):
fields = line.split()
row.append(itemcount[fields[1]])
writer.writerow(row)
writerfp.close()
|
python
| null | null | null | null | null |
open
|
Python (beginner): CSV column writing, unexpected output for time-autocorrelation function
===
Trying to write a fourth column to a set of data which looks like this
8000.5 16745 0.1257
8001.0 16745 0.1242
8001.5 16745 0.1565
8002.0 16745 0.1595
Which has the number of times the second number (i.e. 16745) has been counted in that particular file (it does change, the list has a couple thousand entries). i.e. if this were the whole file
8000.5 16745 0.1257 4
8001.0 16745 0.1242 4
8001.5 16745 0.1565 4
8002.0 16745 0.1595 4
The problem with my code seems to be in the writing stage, the dictionary works, and csv.reader is reading the file fine if I print it but when it comes to appending the only dictionary key it picks up (field[1]) seems to be one where 16745 is -1 and the count of this is printed in the fourth column for all rows. I can't understand why it is cross referencing with the dictionary only for this value and not on a per row basis.
i.e. I get
8000.5 16745 0.1257 [count of -1 in column 2]
8001.0 16745 0.1242 [count of -1 in column 2]
8001.5 16745 0.1565 [count of -1 in column 2]
8002.0 16745 0.1595 [count of -1 in column 2]
Any help would be greatly appreciated!
import numpy
import string
import csv
import sys
import os
time = []
water = []
itemcount ={}
global filename
filename = sys.argv[1]
f1 = open(sys.argv[1], 'rt')
for line in f1:
fields = line.split()
time.append(fields[0])
water.append(fields[1])
f1.close()
for x in water:
a = water.count(x)
itemcount[x] = a
writerfp = open('watout.csv', 'w')
writer = csv.writer(writerfp)
for row in csv.reader(open(filename, 'r')):
fields = line.split()
row.append(itemcount[fields[1]])
writer.writerow(row)
writerfp.close()
| 0 |
1,153,096 |
07/20/2009 11:46:58
| 130,546 |
06/29/2009 16:44:18
| 11 | 0 |
Updated (current) recommendation on Rails versus Django?
|
*(Disclaimer: I asked this question yesterday on HN http://bit.ly/m6onk. While responses were good, there was a notable lack of technical discussion and more of a "you should use rails because that's what you know". Since Joel and Jeff state clearly they don't mind reposts of questions from other sites...and since I really enjoy the answers I find here...here goes)*
Hi guys.
I realize this post is an infamous "versus" question, and undoubtedly redundant with older posts. However, most of the information I find on Rails versus Django is out of date and based on much older versions of the frameworks, so please forgive me.
First and foremost...I'm a Rails guy. I came to it three years ago and really enjoyed a lot of what it brought to the table. I'm not solely a Ruby guy...I have around 11 years of total experience, including Java, C/C++, Perl, Tcl, (some) Python, and more.
Anyway, I have an idea I believe will take over the world. I've already convinced a few folks it will as well and have friends and family funding to take on some offshore developers and get it in beta as quickly as possible.
Now, however, I am left with the decision of what tech to use. While I've really enjoyed Ruby...I'm growing tired of the magic, and the abuse of open classes. It's very nice when you need to inject some behavior quickly, but it can become a real pain when you have to maintain your project, or any of the plugins it depends on. I personally prefer Ruby over Python (largely because of blocks), but I envy the clarity-first attitude in the Python community. Given this frustration, I'm seriously considering a deep-dive into Django and using it for this project.
The pluses I see on the Rails side are:
1. Size of community (which, given some of this "community" includes PHP refugees, is not necessarily a plus)
2. My familiarity and experience
3. Number of companies using it and striving to improve it
4. Availability of offshore resources
Drawbacks of Rails include:
1. Too much magic
2. Documentation continues to be awful in places
3. Inconsistent API
4. Did I mention magic?
The (perceived) pluses on the Django side:
1. Clarity
2. Performance...I believe Unladen Swallow will really change the Python landscape and give it a competitive advantage
3. Google's support of the language itself (see #2)
Drawbacks of Django:
1. Learning curve
2. Smaller community
3. Slower development cycle of the project itself?
4. (un)Availability of offshore resources
So, this is my thought process so far. I'm pretty comfortable I could come up to speed quickly on Django, and I have the basics of Python still in my memory somewhere. But I wanted to get your opinions as I really respect the vision and experience of a lot of the folks I read on here.
I appreciate your help. I really think this idea will take off, so it's very important to me to make the right technology decision.
And saying to choose Rails simply because I have experience there just doesn't sound right. If that were the case, I'd still be using Perl or C.
Thank you!
|
django
|
ruby-on-rails
|
ruby
|
python
| null |
06/06/2012 17:02:00
|
not constructive
|
Updated (current) recommendation on Rails versus Django?
===
*(Disclaimer: I asked this question yesterday on HN http://bit.ly/m6onk. While responses were good, there was a notable lack of technical discussion and more of a "you should use rails because that's what you know". Since Joel and Jeff state clearly they don't mind reposts of questions from other sites...and since I really enjoy the answers I find here...here goes)*
Hi guys.
I realize this post is an infamous "versus" question, and undoubtedly redundant with older posts. However, most of the information I find on Rails versus Django is out of date and based on much older versions of the frameworks, so please forgive me.
First and foremost...I'm a Rails guy. I came to it three years ago and really enjoyed a lot of what it brought to the table. I'm not solely a Ruby guy...I have around 11 years of total experience, including Java, C/C++, Perl, Tcl, (some) Python, and more.
Anyway, I have an idea I believe will take over the world. I've already convinced a few folks it will as well and have friends and family funding to take on some offshore developers and get it in beta as quickly as possible.
Now, however, I am left with the decision of what tech to use. While I've really enjoyed Ruby...I'm growing tired of the magic, and the abuse of open classes. It's very nice when you need to inject some behavior quickly, but it can become a real pain when you have to maintain your project, or any of the plugins it depends on. I personally prefer Ruby over Python (largely because of blocks), but I envy the clarity-first attitude in the Python community. Given this frustration, I'm seriously considering a deep-dive into Django and using it for this project.
The pluses I see on the Rails side are:
1. Size of community (which, given some of this "community" includes PHP refugees, is not necessarily a plus)
2. My familiarity and experience
3. Number of companies using it and striving to improve it
4. Availability of offshore resources
Drawbacks of Rails include:
1. Too much magic
2. Documentation continues to be awful in places
3. Inconsistent API
4. Did I mention magic?
The (perceived) pluses on the Django side:
1. Clarity
2. Performance...I believe Unladen Swallow will really change the Python landscape and give it a competitive advantage
3. Google's support of the language itself (see #2)
Drawbacks of Django:
1. Learning curve
2. Smaller community
3. Slower development cycle of the project itself?
4. (un)Availability of offshore resources
So, this is my thought process so far. I'm pretty comfortable I could come up to speed quickly on Django, and I have the basics of Python still in my memory somewhere. But I wanted to get your opinions as I really respect the vision and experience of a lot of the folks I read on here.
I appreciate your help. I really think this idea will take off, so it's very important to me to make the right technology decision.
And saying to choose Rails simply because I have experience there just doesn't sound right. If that were the case, I'd still be using Perl or C.
Thank you!
| 4 |
3,826,112 |
09/29/2010 21:47:49
| 325,418 |
05/09/2009 15:50:29
| 5,805 | 132 |
In Ruby, always use "&&", "||" instead of "and", "or" unless for special situations?
|
Is it true that in most cases, in Ruby, it is best to use `&&`, `||` instead of `and`, `or`, unless it is some special situations.
I think one of Ruby's design principles is to have least surprises as possible, so using `and`, or `or` actually have some surprises... such as `and` not having a higher precedence than `or`, while `&&` has a higher precedence than `||`.
So I think in most cases, use `&&`, `||`. In know in some special situations, it may require using `and`, `or`, but I think if those are intermixed with `&&`, `||`, sooner or later it may create bugs when your coworkers who started in Ruby not so long ago need to edit your code.
|
ruby
|
logical-operators
| null | null | null |
10/01/2010 21:00:05
|
not a real question
|
In Ruby, always use "&&", "||" instead of "and", "or" unless for special situations?
===
Is it true that in most cases, in Ruby, it is best to use `&&`, `||` instead of `and`, `or`, unless it is some special situations.
I think one of Ruby's design principles is to have least surprises as possible, so using `and`, or `or` actually have some surprises... such as `and` not having a higher precedence than `or`, while `&&` has a higher precedence than `||`.
So I think in most cases, use `&&`, `||`. In know in some special situations, it may require using `and`, `or`, but I think if those are intermixed with `&&`, `||`, sooner or later it may create bugs when your coworkers who started in Ruby not so long ago need to edit your code.
| 1 |
5,676,474 |
04/15/2011 12:07:37
| 13,009 |
09/16/2008 16:37:56
| 2,103 | 53 |
Django - Generic Views - Object_list - What's the benefit, how to use?
|
I want to use the [object_list generic view][1]. But I can't tell what benefit it gives me besides pagination? It seems like I still need to write my own template?
How is this faster than writing my own view? Am I missing something?
If it is worth using and I do have to write my own template, what is supposed to be in the template? I can't find any examples.
[1]: http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-list
|
django
|
django-generic-views
| null | null | null | null |
open
|
Django - Generic Views - Object_list - What's the benefit, how to use?
===
I want to use the [object_list generic view][1]. But I can't tell what benefit it gives me besides pagination? It seems like I still need to write my own template?
How is this faster than writing my own view? Am I missing something?
If it is worth using and I do have to write my own template, what is supposed to be in the template? I can't find any examples.
[1]: http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-list
| 0 |
1,154,275 |
07/20/2009 15:32:31
| 141,442 |
07/20/2009 14:44:28
| 1 | 0 |
MySQL: Updating a left-joined view, where right table has no matching data.
|
I'm curious to know if this is actually possible...
In this simplified example, I have:
Table_A: Table_B:
+------+--------+ +------+--------+
| id | data_1 | | id | data_2 |
+------+--------+ +------+--------+
| 1 | Hello | | 1 | There |
+------+--------+ +------+--------+
| 2 | Hi |
+------+--------+
A MySQL View (`CREATE VIEW...`) called `tables` is:
SELECT table_a.id AS id,
table_a.data_1 AS data_1,
table_b.data_2 AS data_2
FROM table_a
LEFT JOIN table_b
ON table_a.id=table_b.id
So, a simple `SELECT * FROM tables` will return:
+------+--------+--------+
| id | data_1 | data_2 |
+------+--------+--------+
| 1 | Hello | There |
+------+--------+--------+
| 2 | Hi | NULL |
+------+--------+--------+
An update to existing data is fine. Ie., `UPDATE tables SET data_2='World' WHERE id=1` completes and the result for id 1 would be:
+------+--------+--------+
| id | data_1 | data_2 |
+------+--------+--------+
| 1 | Hello | World |
+------+--------+--------+
But what about using an `UPDATE` statement on the right table (`table_b`) if it does not have any data matching the id? Using the same example as earlier, `UPDATE tables SET data_2='John' WHERE id=2` will result in 0 Rows matched (and therefore, `tables` will still return `NULL` instead of `John` in the `data_2` field).
+------+--------+--------+
| id | data_1 | data_2 |
+------+--------+--------+
| 2 | Hi | NULL |
+------+--------+--------+
Is there a way to make this work on the `tables` view, without having to touch the `table_b` directly?
|
mysql
|
query
| null | null | null | null |
open
|
MySQL: Updating a left-joined view, where right table has no matching data.
===
I'm curious to know if this is actually possible...
In this simplified example, I have:
Table_A: Table_B:
+------+--------+ +------+--------+
| id | data_1 | | id | data_2 |
+------+--------+ +------+--------+
| 1 | Hello | | 1 | There |
+------+--------+ +------+--------+
| 2 | Hi |
+------+--------+
A MySQL View (`CREATE VIEW...`) called `tables` is:
SELECT table_a.id AS id,
table_a.data_1 AS data_1,
table_b.data_2 AS data_2
FROM table_a
LEFT JOIN table_b
ON table_a.id=table_b.id
So, a simple `SELECT * FROM tables` will return:
+------+--------+--------+
| id | data_1 | data_2 |
+------+--------+--------+
| 1 | Hello | There |
+------+--------+--------+
| 2 | Hi | NULL |
+------+--------+--------+
An update to existing data is fine. Ie., `UPDATE tables SET data_2='World' WHERE id=1` completes and the result for id 1 would be:
+------+--------+--------+
| id | data_1 | data_2 |
+------+--------+--------+
| 1 | Hello | World |
+------+--------+--------+
But what about using an `UPDATE` statement on the right table (`table_b`) if it does not have any data matching the id? Using the same example as earlier, `UPDATE tables SET data_2='John' WHERE id=2` will result in 0 Rows matched (and therefore, `tables` will still return `NULL` instead of `John` in the `data_2` field).
+------+--------+--------+
| id | data_1 | data_2 |
+------+--------+--------+
| 2 | Hi | NULL |
+------+--------+--------+
Is there a way to make this work on the `tables` view, without having to touch the `table_b` directly?
| 0 |
10,682,937 |
05/21/2012 09:45:34
| 1,396,860 |
05/15/2012 17:43:28
| 8 | 0 |
Creating columns within database table (C#)
|
Okay so I am trying to create a column inside a database table using c# and I haven't done much database work before so please excuse if I sound silly.
I have created a class that SHOULD add the column which is the following:
public class AddDisplayOnWebsiteToCatFeatures : DatabaseCommandBase, IUpdateDatabaseCommand
{
ISessionFactory sessionFactory;
public AddDisplayOnWebsiteToCatFeatures(ISessionFactory sessionFactory)
: base("Adds column display on website to cat feature.")
{
this.sessionFactory = sessionFactory;
}
public override void Execute()
{
using (var connection = sessionFactory.ConnectionProvider.GetConnection())
{
var util = new DatabaseUtil(connection);
if (util.TableExists("tbl_ecom_cat_feature"))
util.EnsureColumnExists("tbl_ecom_cat_feature", "display_on_website", "bit");
}
}
}
I am also trying to get it to check if the actual table is present and the same for the column and if they are, to do nothing.
However when I am executing my program it is not creating the column for some reason, I have all the necessary code within my NHibernate file as well, however whenever I try and enter the category it crashes the program and throws up an exception.
|
c#
|
sql
| null | null | null |
05/21/2012 21:09:45
|
too localized
|
Creating columns within database table (C#)
===
Okay so I am trying to create a column inside a database table using c# and I haven't done much database work before so please excuse if I sound silly.
I have created a class that SHOULD add the column which is the following:
public class AddDisplayOnWebsiteToCatFeatures : DatabaseCommandBase, IUpdateDatabaseCommand
{
ISessionFactory sessionFactory;
public AddDisplayOnWebsiteToCatFeatures(ISessionFactory sessionFactory)
: base("Adds column display on website to cat feature.")
{
this.sessionFactory = sessionFactory;
}
public override void Execute()
{
using (var connection = sessionFactory.ConnectionProvider.GetConnection())
{
var util = new DatabaseUtil(connection);
if (util.TableExists("tbl_ecom_cat_feature"))
util.EnsureColumnExists("tbl_ecom_cat_feature", "display_on_website", "bit");
}
}
}
I am also trying to get it to check if the actual table is present and the same for the column and if they are, to do nothing.
However when I am executing my program it is not creating the column for some reason, I have all the necessary code within my NHibernate file as well, however whenever I try and enter the category it crashes the program and throws up an exception.
| 3 |
2,312,643 |
02/22/2010 17:13:07
| 63,492 |
02/06/2009 20:42:05
| 78 | 2 |
How do I test a controller that has an Authorize attribute and dependencies injection by IoC?
|
I’ve taken over an ASP.NET MVC project from a colleague. I have only a rudimentary knowledge of both ASP.NET MVC and unit testing.
I’m trying to get off on the right foot by creating unit tests. I thought I’d start with testing a controller. Unfortunately I stumbled at the first hurdle! The controller in question has the Authorize attribute and dependencies that are injected via dependency injection (Unity).
The controller looks something like:
namespace Project.Controllers
{
[Authorize( Roles = "Admin,PurchaseOrderUser" )]
public class SomeController : Controller
{
private readonly IOrganisationService _organisationService;
private readonly IPurchaseOrderService _purchaseOrderService;
// Dependency injection will provide these
public SomeController(
IPurchaseOrderService purchaseOrderService,
IOrganisationService organisationService)
{
_purchaseOrderService = purchaseOrderService;
_organisationService = organisationService;
}
// List Purchase Orders
public ActionResult Index( )
{
Return View();
}
// Rest of controller....
So, using nUnit and Rhino Mock Mocks how can I test the Index action?
Thanks.
Alan T
|
asp.net-mvc
|
rhino-mocks
|
dependency-injection
| null | null | null |
open
|
How do I test a controller that has an Authorize attribute and dependencies injection by IoC?
===
I’ve taken over an ASP.NET MVC project from a colleague. I have only a rudimentary knowledge of both ASP.NET MVC and unit testing.
I’m trying to get off on the right foot by creating unit tests. I thought I’d start with testing a controller. Unfortunately I stumbled at the first hurdle! The controller in question has the Authorize attribute and dependencies that are injected via dependency injection (Unity).
The controller looks something like:
namespace Project.Controllers
{
[Authorize( Roles = "Admin,PurchaseOrderUser" )]
public class SomeController : Controller
{
private readonly IOrganisationService _organisationService;
private readonly IPurchaseOrderService _purchaseOrderService;
// Dependency injection will provide these
public SomeController(
IPurchaseOrderService purchaseOrderService,
IOrganisationService organisationService)
{
_purchaseOrderService = purchaseOrderService;
_organisationService = organisationService;
}
// List Purchase Orders
public ActionResult Index( )
{
Return View();
}
// Rest of controller....
So, using nUnit and Rhino Mock Mocks how can I test the Index action?
Thanks.
Alan T
| 0 |
11,692,917 |
07/27/2012 17:41:55
| 95,024 |
04/23/2009 15:07:33
| 288 | 4 |
ORM with built-in audit trail
|
I am designing an ASP.NET MVC web app with a database backend that requires a full audit trail for regulatory purposes.
I've implemented audit trails in the past but it feels like I would be safer using an ORM tool with built-in features for this. It looks like NHibernate would be one way to go - could you recommend other options?
|
c#
|
asp.net-mvc
|
orm
|
audit-trail
| null |
07/27/2012 18:31:44
|
not constructive
|
ORM with built-in audit trail
===
I am designing an ASP.NET MVC web app with a database backend that requires a full audit trail for regulatory purposes.
I've implemented audit trails in the past but it feels like I would be safer using an ORM tool with built-in features for this. It looks like NHibernate would be one way to go - could you recommend other options?
| 4 |
8,959,524 |
01/22/2012 06:43:17
| 705,414 |
04/13/2011 06:40:40
| 1,373 | 1 |
what is the advantage to use Spline to represent curve?
|
Often hear about curve modeled using spline. What's the advantage of using spline?
|
graphics
|
geometry
|
computational-geometry
|
spline
| null |
01/22/2012 15:36:04
|
off topic
|
what is the advantage to use Spline to represent curve?
===
Often hear about curve modeled using spline. What's the advantage of using spline?
| 2 |
7,661,873 |
10/05/2011 13:16:55
| 896,689 |
08/16/2011 12:52:39
| 5 | 0 |
Given a string, compute recursively (no loops)
|
Given a string, compute recursively (no loops) the number of times lowercase "hi" appears in the string
countHi("xxhixx") -> 1
countHi("xhixhixx") -> 2
countHi("hi") -> 1
public class Tester {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int count = countHi("xxhixx");
System.out.println("countHi: " + count);
}
public static int countHi(String s) {
if (s.length() == 0) {
return 0;
}
int spot = s.indexOf("hi");
if(spot > 0)
{
String nextString = s.substring(spot + 2);
return 1 + countHi(nextString);
}
return 1;
}
}
|
java
|
string
| null | null | null |
10/05/2011 13:35:59
|
too localized
|
Given a string, compute recursively (no loops)
===
Given a string, compute recursively (no loops) the number of times lowercase "hi" appears in the string
countHi("xxhixx") -> 1
countHi("xhixhixx") -> 2
countHi("hi") -> 1
public class Tester {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int count = countHi("xxhixx");
System.out.println("countHi: " + count);
}
public static int countHi(String s) {
if (s.length() == 0) {
return 0;
}
int spot = s.indexOf("hi");
if(spot > 0)
{
String nextString = s.substring(spot + 2);
return 1 + countHi(nextString);
}
return 1;
}
}
| 3 |
4,737,808 |
01/19/2011 16:23:16
| 581,747 |
01/19/2011 16:23:16
| 1 | 0 |
Java Framework for creating Ajax Websites (as opposed to web applications).
|
I'm looking for a java framework to develop a website that will contain various AJAXy style components on it, but will use tradition page refreshes when switching between pages. I understand that there are a lot of java based frameworks for building web applications (GWT, ZK etc.) but from what I can see these are good for building swing style web applications rather than traditional websites with Ajax components.
So my question is what java frameworks would you suggest using for this case?
|
java
|
ajax
|
frameworks
|
website
| null | null |
open
|
Java Framework for creating Ajax Websites (as opposed to web applications).
===
I'm looking for a java framework to develop a website that will contain various AJAXy style components on it, but will use tradition page refreshes when switching between pages. I understand that there are a lot of java based frameworks for building web applications (GWT, ZK etc.) but from what I can see these are good for building swing style web applications rather than traditional websites with Ajax components.
So my question is what java frameworks would you suggest using for this case?
| 0 |
9,250,870 |
02/12/2012 17:22:06
| 941,518 |
09/12/2011 23:08:06
| 616 | 56 |
What are the real advantages of using blocks in Objective-C?
|
I have learned about blocks in ObjC, the syntax is clear and simple. I can read “block are great feature, its syntax is...” almost everywhere. However, I miss the real advantages of their using.
Maybe it is a silly question - I have just started with ObjC, but what are the real advantages of blocks over a “traditional” approach? Can anybody give me some brief and clear explanation?
|
objective-c
|
objective-c-2.0
| null | null | null |
02/13/2012 07:30:44
|
not constructive
|
What are the real advantages of using blocks in Objective-C?
===
I have learned about blocks in ObjC, the syntax is clear and simple. I can read “block are great feature, its syntax is...” almost everywhere. However, I miss the real advantages of their using.
Maybe it is a silly question - I have just started with ObjC, but what are the real advantages of blocks over a “traditional” approach? Can anybody give me some brief and clear explanation?
| 4 |
11,457,363 |
07/12/2012 17:32:03
| 1,236,258 |
02/27/2012 18:36:38
| 18 | 2 |
get all file names from a directory in php
|
well what I gone through a lot of posts here on stackoverflow and other sites, I need a simple task, I want to provide my user facility to click on upload file from his account, then select a directory and get the list of all the files names inside that directory. According to the posts here what I got is I have to pre-define the directory name, which I want to avoid. Is there a simple way to click a directory and get all the files names in an array in PHP? many thanks in advance!
|
php
| null | null | null | null | null |
open
|
get all file names from a directory in php
===
well what I gone through a lot of posts here on stackoverflow and other sites, I need a simple task, I want to provide my user facility to click on upload file from his account, then select a directory and get the list of all the files names inside that directory. According to the posts here what I got is I have to pre-define the directory name, which I want to avoid. Is there a simple way to click a directory and get all the files names in an array in PHP? many thanks in advance!
| 0 |
10,724,484 |
05/23/2012 16:53:20
| 1,413,173 |
05/23/2012 16:43:55
| 1 | 0 |
Programming Java
|
i create a program that read the ID and Answer from user then calculate the grades ,
now i want to know , how i used the String file and text in my program , i want Each student’s ID and test answers are stored in the file for example “students.txt”. and The output will be written on another file “results.txt” that contains each student’s ID, number of correct answers, and grade, along the single highest score for the class.
**this my program , and i want to know how i use the String file and text**
>
import java.util.*;
public class StudentGrade {
public static void main(String[] args) {
int[] studentID = new int[5];
int[] correctAnswers = new int[5];
char[] grades = new char[5];
Answers(studentID, correctAnswers);
calculateGrades(correctAnswers, grades);
printGrades(studentID, correctAnswers, grades);
}
public static void Answers(int[] ids, int[] answers)
{
Scanner input = new Scanner(System.in);
int Id;
int count = 0;
int answer = 1;
boolean invalidAnswer = true;
boolean found = false;
int j;
while(count < 5)
{
System.out.print("Student ID:" );
Id = input.nextInt();
j=0;
found = false;
while (j < count && !found)
{
if(Id == ids[j]){
System.out.println("ID already inserted!!!");
found = true;
}
else j++;
}
if (!found)
{
ids[count]=Id ;
for(int x = 0; x < 10; x++)
{
while(invalidAnswer)
{
System.out.print("Answer " + (x+1) + ": ");
answer = input.nextInt();
if(answer == 0 || answer == 1)
invalidAnswer = false;
else
System.out.println("Invalid value, try again");
}
invalidAnswer = true;
if(answer == 1)
answers[count] = answers[count] + 1;
}
count++;
}
}
}
public static char Grade(int score, int bestScore)
{
char result = '0';
if(score >= bestScore - 2)
result = 'A';
else if(score <= bestScore - 3 && score >= bestScore - 5)
result = 'B';
else if(score <= bestScore - 6 && score >= bestScore - 8)
result = 'C';
else if(score < bestScore - 8)
result = 'F';
return result;
}
public static void calculateGrades(int[] correctAnswers, char[] grades) {
for(int i = 0; i < correctAnswers.length; i++)
{
grades[i] = Grade(correctAnswers[i], BestScore(correctAnswers));
}
}
public static int BestScore(int[] correctAnswers) {
int highest = 0;
for(int i = 0; i < correctAnswers.length; i++)
{
if(correctAnswers[i] > highest)
highest = correctAnswers[i];
}
return highest;
}
public static void printGrades(int[] studentID, int[] correctAnswers, char[] grades) {
System.out.printf("%10s%10s%10s\n", "StudentID", "Correct", "Grade");
for(int i = 0; i < studentID.length; i++)
{
System.out.printf("%10s%10d%10c\n", studentID[i], correctAnswers[i], grades[i]);
}
}
}
|
java
|
oop
| null | null | null |
05/23/2012 18:54:23
|
too localized
|
Programming Java
===
i create a program that read the ID and Answer from user then calculate the grades ,
now i want to know , how i used the String file and text in my program , i want Each student’s ID and test answers are stored in the file for example “students.txt”. and The output will be written on another file “results.txt” that contains each student’s ID, number of correct answers, and grade, along the single highest score for the class.
**this my program , and i want to know how i use the String file and text**
>
import java.util.*;
public class StudentGrade {
public static void main(String[] args) {
int[] studentID = new int[5];
int[] correctAnswers = new int[5];
char[] grades = new char[5];
Answers(studentID, correctAnswers);
calculateGrades(correctAnswers, grades);
printGrades(studentID, correctAnswers, grades);
}
public static void Answers(int[] ids, int[] answers)
{
Scanner input = new Scanner(System.in);
int Id;
int count = 0;
int answer = 1;
boolean invalidAnswer = true;
boolean found = false;
int j;
while(count < 5)
{
System.out.print("Student ID:" );
Id = input.nextInt();
j=0;
found = false;
while (j < count && !found)
{
if(Id == ids[j]){
System.out.println("ID already inserted!!!");
found = true;
}
else j++;
}
if (!found)
{
ids[count]=Id ;
for(int x = 0; x < 10; x++)
{
while(invalidAnswer)
{
System.out.print("Answer " + (x+1) + ": ");
answer = input.nextInt();
if(answer == 0 || answer == 1)
invalidAnswer = false;
else
System.out.println("Invalid value, try again");
}
invalidAnswer = true;
if(answer == 1)
answers[count] = answers[count] + 1;
}
count++;
}
}
}
public static char Grade(int score, int bestScore)
{
char result = '0';
if(score >= bestScore - 2)
result = 'A';
else if(score <= bestScore - 3 && score >= bestScore - 5)
result = 'B';
else if(score <= bestScore - 6 && score >= bestScore - 8)
result = 'C';
else if(score < bestScore - 8)
result = 'F';
return result;
}
public static void calculateGrades(int[] correctAnswers, char[] grades) {
for(int i = 0; i < correctAnswers.length; i++)
{
grades[i] = Grade(correctAnswers[i], BestScore(correctAnswers));
}
}
public static int BestScore(int[] correctAnswers) {
int highest = 0;
for(int i = 0; i < correctAnswers.length; i++)
{
if(correctAnswers[i] > highest)
highest = correctAnswers[i];
}
return highest;
}
public static void printGrades(int[] studentID, int[] correctAnswers, char[] grades) {
System.out.printf("%10s%10s%10s\n", "StudentID", "Correct", "Grade");
for(int i = 0; i < studentID.length; i++)
{
System.out.printf("%10s%10d%10c\n", studentID[i], correctAnswers[i], grades[i]);
}
}
}
| 3 |
6,805,297 |
07/24/2011 06:22:38
| 809,135 |
06/21/2011 19:30:01
| 1 | 0 |
Using jquery to dynamically load Vimeo videos
|
I would like to create a function that would allow me to embed my Vimeo videos on my website and run it like a YouTube playlist i.e. when a video link is clicked, rather than reloading the page it only reloads the video. So for example, this being a film website, I have a trailer for the project as well as a few promo clips, I would like to be able to show all of those by simply having the user click a link which loads a new video. How would I do this?
Thanks!
jwinton
|
vimeo
| null | null | null | null | null |
open
|
Using jquery to dynamically load Vimeo videos
===
I would like to create a function that would allow me to embed my Vimeo videos on my website and run it like a YouTube playlist i.e. when a video link is clicked, rather than reloading the page it only reloads the video. So for example, this being a film website, I have a trailer for the project as well as a few promo clips, I would like to be able to show all of those by simply having the user click a link which loads a new video. How would I do this?
Thanks!
jwinton
| 0 |
487,508 |
01/28/2009 12:51:55
| 22,674 |
09/26/2008 12:48:33
| 963 | 23 |
robots.txt: block all but a select few
|
I've been thinking a while about disallowing every crawler except Ask, Google, Microsoft, and Yahoo! from my site.
The reasoning behind this is that I've never seen any traffic being generated by any of the other web-crawlers out there.
My questions are:
1. Is there any reason not to?
2. Does it make any difference in bandwidth consumption?
3. Has anybody done this?
|
web-crawler
|
robots.txt
|
seo
| null | null |
06/06/2012 12:25:38
|
off topic
|
robots.txt: block all but a select few
===
I've been thinking a while about disallowing every crawler except Ask, Google, Microsoft, and Yahoo! from my site.
The reasoning behind this is that I've never seen any traffic being generated by any of the other web-crawlers out there.
My questions are:
1. Is there any reason not to?
2. Does it make any difference in bandwidth consumption?
3. Has anybody done this?
| 2 |
8,086,841 |
11/10/2011 21:50:44
| 1,019,129 |
10/28/2011 21:12:21
| 6 | 0 |
Full page as/plus Partials
|
I want to have a page which is a full blown page i.e. I can call it with URL like this for example :
/path/to/client/33
but then I want to be able to call/render it from another page i.e. (pseudo code)
/path/to/customer/678
...find client id.....
render :client, :id => 33 #inside the customer page
render :customer
I understand that I can do it like partial, what I can't figure out is how to pass parameters between them.
I was thinking of layout also, but then how do I arrange for the customer controller to be first to run? So that I can find the client ID and then render client.
Think of a customer as one entity "having" many clients.
|
ruby-on-rails
|
partial
| null | null | null | null |
open
|
Full page as/plus Partials
===
I want to have a page which is a full blown page i.e. I can call it with URL like this for example :
/path/to/client/33
but then I want to be able to call/render it from another page i.e. (pseudo code)
/path/to/customer/678
...find client id.....
render :client, :id => 33 #inside the customer page
render :customer
I understand that I can do it like partial, what I can't figure out is how to pass parameters between them.
I was thinking of layout also, but then how do I arrange for the customer controller to be first to run? So that I can find the client ID and then render client.
Think of a customer as one entity "having" many clients.
| 0 |
10,531,707 |
05/10/2012 10:02:25
| 449,344 |
09/16/2010 10:08:29
| 643 | 17 |
Insufficient_data aws cloud_watch
|
I have configured the aws ec2 instance for the auto_scaling. I have set the cloud watch alarms using aws ec2 command line API's. But When I checked in the aws management console, its say insufficient data. The instances are not booting up though I have set to scale up if the cpu usage goes beyond 70%.
|
amazon-web-services
| null | null | null | null | null |
open
|
Insufficient_data aws cloud_watch
===
I have configured the aws ec2 instance for the auto_scaling. I have set the cloud watch alarms using aws ec2 command line API's. But When I checked in the aws management console, its say insufficient data. The instances are not booting up though I have set to scale up if the cpu usage goes beyond 70%.
| 0 |
4,607,620 |
01/05/2011 18:13:50
| 564,373 |
01/05/2011 18:13:50
| 1 | 0 |
error in visual Studio
|
What is this error?
What is the solution?
> Error while trying to run project: could not load file or eassembly 'consolesample; or one of its dependencies. the module was expected to contain an assembly manifest.
|
visual-studio
|
visual-studio-2008
|
visual-studio-2010
| null | null |
11/14/2011 22:55:50
|
not a real question
|
error in visual Studio
===
What is this error?
What is the solution?
> Error while trying to run project: could not load file or eassembly 'consolesample; or one of its dependencies. the module was expected to contain an assembly manifest.
| 1 |
7,939,463 |
10/29/2011 14:22:00
| 521,070 |
10/23/2010 15:30:48
| 1,066 | 5 |
Why does not Java provide a standard function to reverse arrays?
|
As I understand, JDK does not provide a function to reverse arrays. I know `Apache` has such a function (in `commons.lang`) I guess there are other libraries, which provide it. I wonder why Java has no _standard_ functions for this. Is there any rational behind that?
|
java
|
arrays
|
reverse
| null | null |
10/29/2011 14:28:53
|
not constructive
|
Why does not Java provide a standard function to reverse arrays?
===
As I understand, JDK does not provide a function to reverse arrays. I know `Apache` has such a function (in `commons.lang`) I guess there are other libraries, which provide it. I wonder why Java has no _standard_ functions for this. Is there any rational behind that?
| 4 |
3,025,851 |
06/11/2010 20:04:23
| 364,880 |
06/11/2010 19:43:12
| 1 | 0 |
C++ template function specialization using TCHAR on Visual Studio 2005
|
I'm writing a logging class that uses a templatized operator<< function. I'm specializing the template function on wide-character string so that I can do some wide-to-narrow translation before writing the log message. I can't get TCHAR to work properly - it doesn't use the specialization. Ideas?
Here's the pertinent code:
// Log.h header
class Log
{
public:
template <typename T> Log& operator<<( const T& x );
template <typename T> Log& operator<<( const T* x );
template <typename T> Log& operator<<( const T*& x );
...
}
template <typename T> Log& Log::operator<<( const T& input )
{ printf("ref"); }
template <typename T> Log& Log::operator<<( const T* input )
{ printf("ptr"); }
template <> Log& Log::operator<<( const std::wstring& input );
template <> Log& Log::operator<<( const wchar_t* input );
And the source file
// Log.cpp
template <> Log& Log::operator<<( const std::wstring& input )
{ printf("wstring ref"); }
template <> Log& Log::operator<<( const wchar_t* input )
{ printf("wchar_t ptr"); }
template <> Log& Log::operator<<( const TCHAR*& input )
{ printf("tchar ptr ref"); }
Now, I use the following test program to exercise these functions
// main.cpp - test program
int main()
{
Log log;
log << "test 1";
log << L"test 2";
std::string test3( "test3" );
log << test3;
std::wstring test4( L"test4" );
log << test4;
TCHAR* test5 = L"test5";
log << test4;
}
Running the above tests reveals the following:
// Test results
ptr
wchar_t ptr
ref
wstring ref
ref
Unfortunately, that's not quite right. I'd really like the last one to be "TCHAR", so that I can convert it. According to Visual Studio's debugger, the when I step in to the function being called in test 5, the type is wchar_t*& - but it's not calling the appropriate specialization. Ideas?
I'm not sure if it's pertinent or not, but this is on a Windows CE 5.0 device.
|
c++
|
templates
|
template-specialization
|
wchar-t
|
widestring
| null |
open
|
C++ template function specialization using TCHAR on Visual Studio 2005
===
I'm writing a logging class that uses a templatized operator<< function. I'm specializing the template function on wide-character string so that I can do some wide-to-narrow translation before writing the log message. I can't get TCHAR to work properly - it doesn't use the specialization. Ideas?
Here's the pertinent code:
// Log.h header
class Log
{
public:
template <typename T> Log& operator<<( const T& x );
template <typename T> Log& operator<<( const T* x );
template <typename T> Log& operator<<( const T*& x );
...
}
template <typename T> Log& Log::operator<<( const T& input )
{ printf("ref"); }
template <typename T> Log& Log::operator<<( const T* input )
{ printf("ptr"); }
template <> Log& Log::operator<<( const std::wstring& input );
template <> Log& Log::operator<<( const wchar_t* input );
And the source file
// Log.cpp
template <> Log& Log::operator<<( const std::wstring& input )
{ printf("wstring ref"); }
template <> Log& Log::operator<<( const wchar_t* input )
{ printf("wchar_t ptr"); }
template <> Log& Log::operator<<( const TCHAR*& input )
{ printf("tchar ptr ref"); }
Now, I use the following test program to exercise these functions
// main.cpp - test program
int main()
{
Log log;
log << "test 1";
log << L"test 2";
std::string test3( "test3" );
log << test3;
std::wstring test4( L"test4" );
log << test4;
TCHAR* test5 = L"test5";
log << test4;
}
Running the above tests reveals the following:
// Test results
ptr
wchar_t ptr
ref
wstring ref
ref
Unfortunately, that's not quite right. I'd really like the last one to be "TCHAR", so that I can convert it. According to Visual Studio's debugger, the when I step in to the function being called in test 5, the type is wchar_t*& - but it's not calling the appropriate specialization. Ideas?
I'm not sure if it's pertinent or not, but this is on a Windows CE 5.0 device.
| 0 |
7,465,989 |
09/19/2011 02:43:27
| 887,106 |
08/10/2011 03:17:00
| 65 | 4 |
how to judge the page has been edited
|
there is many fields in a page for input .
i want to work on a function as "**your page has been edited but not save ,do you want to leave?** ",how to do it?i don't want to compare each field in page ,too many they are.and i feel it is not a good idea.thanks for and response.
----stackoverflow said the context before this line cant be post because It does not meet quality standards ,so igore context after this line,it only use for passing the check ------------------------
public class stackoverflow
{
public string dosth4pass()
{
return "sorry";
}
}
|
asp.net
| null | null | null | null |
09/19/2011 06:15:29
|
not a real question
|
how to judge the page has been edited
===
there is many fields in a page for input .
i want to work on a function as "**your page has been edited but not save ,do you want to leave?** ",how to do it?i don't want to compare each field in page ,too many they are.and i feel it is not a good idea.thanks for and response.
----stackoverflow said the context before this line cant be post because It does not meet quality standards ,so igore context after this line,it only use for passing the check ------------------------
public class stackoverflow
{
public string dosth4pass()
{
return "sorry";
}
}
| 1 |
3,358,917 |
07/29/2010 01:51:16
| 1,444,475 |
12/28/2009 22:18:52
| 286 | 4 |
PHP: print success or error message on submit?
|
i wonder how i can solve that:
i have a lot of forms on my website. whenever i submit a button i would like to print a message on the following page. when a form is submitted the page simply refreshes. what's the easiest way to do that or how is it normally done?
thanks for the help
|
php
| null | null | null | null | null |
open
|
PHP: print success or error message on submit?
===
i wonder how i can solve that:
i have a lot of forms on my website. whenever i submit a button i would like to print a message on the following page. when a form is submitted the page simply refreshes. what's the easiest way to do that or how is it normally done?
thanks for the help
| 0 |
10,497,366 |
05/08/2012 11:03:38
| 866,963 |
07/28/2011 07:46:34
| 52 | 7 |
Zend Framework: Download?
|
I am new to zend. Downloaded the zend framework from the zend site. Now how do i generate the zend folder structure like applications, bin, public folders!? What's the best way to generate the folder structure?
Thanks.
|
zend-framework
|
download
| null | null | null |
06/16/2012 21:03:40
|
not a real question
|
Zend Framework: Download?
===
I am new to zend. Downloaded the zend framework from the zend site. Now how do i generate the zend folder structure like applications, bin, public folders!? What's the best way to generate the folder structure?
Thanks.
| 1 |
2,827,569 |
05/13/2010 14:26:45
| 1,789 |
08/18/2008 15:06:40
| 42 | 5 |
How do you SetMaxAttachmentSize in TFS 2010?
|
I want to set the maximum work item attachment size. From old blogs I have found that it is possible by calling `SetMaxAttachmentSize`, but the blogs are for older versions of TFS. I have found the new webservice path for TFS 2010.
http://localhost:8080/tfs/_tfs_resources/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx/SetMaxAttachmentSize
Unfortunately when I call it like that I receive this error: `This request can only be made against a project collection. The (.asmx) file should be located in the project directory (usually _tfs_resources under the application root).`
I don't know how to format the call via a browser to target a specific project collection. Any thoughts?
|
tfs2010
| null | null | null | null | null |
open
|
How do you SetMaxAttachmentSize in TFS 2010?
===
I want to set the maximum work item attachment size. From old blogs I have found that it is possible by calling `SetMaxAttachmentSize`, but the blogs are for older versions of TFS. I have found the new webservice path for TFS 2010.
http://localhost:8080/tfs/_tfs_resources/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx/SetMaxAttachmentSize
Unfortunately when I call it like that I receive this error: `This request can only be made against a project collection. The (.asmx) file should be located in the project directory (usually _tfs_resources under the application root).`
I don't know how to format the call via a browser to target a specific project collection. Any thoughts?
| 0 |
5,471,709 |
03/29/2011 11:23:19
| 679,704 |
03/28/2011 05:49:48
| 1 | 0 |
how to stop SMS activity
|
i want to stop outgoing sms..... plz help me on this
|
android
| null | null | null | null |
03/29/2011 13:27:49
|
not a real question
|
how to stop SMS activity
===
i want to stop outgoing sms..... plz help me on this
| 1 |
2,532,883 |
03/28/2010 12:32:27
| 303,571 |
03/28/2010 12:32:27
| 1 | 0 |
Having a problem inserting a foreign key data into a table using a PHP form
|
I am newbee with PHP and MySQL and need help...
I have two tables (Staff and Position) in the database. The Staff table (StaffId, Name, PositionID (fk)). The Position table is populated with different positions (Manager, Supervisor, and so on). The two tables are linked with a PositionID foreign key in the Staff table. I have a staff registration form with textfields asking for the relevant attributes and a dynamically populated drop down list to choose the position. I need to insert the user's entry into the staff table along with the selected position. However, when inserting the data, I get the following error (Cannot add or update a child row: a foreign key constraint fails). How do I insert the position selected by the user into the staff table?
Here is some of my code...
...
echo "<tr>";
echo "<td>";
echo "*Position:";
echo "</td>";
echo "<td>";
//dynamically populate the staff position drop down list from the position table
$position="SELECT PositionId, PositionName
FROM Position
ORDER BY PositionId";
$exeposition = mysql_query ($position) or die (mysql_error());
echo "<select name=position value=''>Select Position</option>";
while($positionarray=mysql_fetch_array($exeposition))
{
echo "<option value=$positionarray[PositionId]>$positionarray[PositionName]</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>"
//the form is processed with the code below
$FirstName = $_POST['firstname'];
$LastName = $_POST['lastname'];
$Address = $_POST['address'];
$City = $_POST['city'];
$PostCode = $_POST['postcode'];
$Country = $_POST['country'];
$Email = $_POST['email'];
$Password = $_POST['password'];
$ConfirmPass = $_POST['confirmpass'];
$Mobile = $_POST['mobile'];
$NI = $_POST['nationalinsurance'];
$PositionId = $_POST[$positionarray['PositionId']];
//format the dob for the database
$dobpart = explode("/", $_POST['dob']);
$formatdob = $dobpart[2]."-".$dobpart[1]."-".$dobpart[0];
$DOB = date("Y-m-d", strtotime($formatdob));
$newReg = "INSERT INTO Staff (FirstName, LastName, Address, City, PostCode,
Country, Email, Password, Mobile, DOB, NI, PositionId) VALUES ('".$FirstName."',
'".$LastName."', '".$Address."', '".$City."', '".$PostCode."', '".$Country."',
'".$Email."', '".$Password."', ".$Mobile.", '".$DOB."', '".$NI."', '".$PostionId."')";
Your time and help is surely appreciated.
|
php
|
and
|
mysql
| null | null | null |
open
|
Having a problem inserting a foreign key data into a table using a PHP form
===
I am newbee with PHP and MySQL and need help...
I have two tables (Staff and Position) in the database. The Staff table (StaffId, Name, PositionID (fk)). The Position table is populated with different positions (Manager, Supervisor, and so on). The two tables are linked with a PositionID foreign key in the Staff table. I have a staff registration form with textfields asking for the relevant attributes and a dynamically populated drop down list to choose the position. I need to insert the user's entry into the staff table along with the selected position. However, when inserting the data, I get the following error (Cannot add or update a child row: a foreign key constraint fails). How do I insert the position selected by the user into the staff table?
Here is some of my code...
...
echo "<tr>";
echo "<td>";
echo "*Position:";
echo "</td>";
echo "<td>";
//dynamically populate the staff position drop down list from the position table
$position="SELECT PositionId, PositionName
FROM Position
ORDER BY PositionId";
$exeposition = mysql_query ($position) or die (mysql_error());
echo "<select name=position value=''>Select Position</option>";
while($positionarray=mysql_fetch_array($exeposition))
{
echo "<option value=$positionarray[PositionId]>$positionarray[PositionName]</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>"
//the form is processed with the code below
$FirstName = $_POST['firstname'];
$LastName = $_POST['lastname'];
$Address = $_POST['address'];
$City = $_POST['city'];
$PostCode = $_POST['postcode'];
$Country = $_POST['country'];
$Email = $_POST['email'];
$Password = $_POST['password'];
$ConfirmPass = $_POST['confirmpass'];
$Mobile = $_POST['mobile'];
$NI = $_POST['nationalinsurance'];
$PositionId = $_POST[$positionarray['PositionId']];
//format the dob for the database
$dobpart = explode("/", $_POST['dob']);
$formatdob = $dobpart[2]."-".$dobpart[1]."-".$dobpart[0];
$DOB = date("Y-m-d", strtotime($formatdob));
$newReg = "INSERT INTO Staff (FirstName, LastName, Address, City, PostCode,
Country, Email, Password, Mobile, DOB, NI, PositionId) VALUES ('".$FirstName."',
'".$LastName."', '".$Address."', '".$City."', '".$PostCode."', '".$Country."',
'".$Email."', '".$Password."', ".$Mobile.", '".$DOB."', '".$NI."', '".$PostionId."')";
Your time and help is surely appreciated.
| 0 |
10,436,368 |
05/03/2012 17:23:34
| 1,234,936 |
02/27/2012 06:13:29
| 1 | 0 |
Add contain of tables in data base to another table
|
I have database this database contain many tables .These tables are in relationship in Id(s).This id(s) are auto-incremented. also I have computers these computers are connected to gather by server.The server and each computer contains the same database and store its data.In the last day I want to Store all the data from all the computers in the server database .please help me to solve my problem .
|
php
|
mysql
| null | null | null |
05/04/2012 12:58:52
|
not a real question
|
Add contain of tables in data base to another table
===
I have database this database contain many tables .These tables are in relationship in Id(s).This id(s) are auto-incremented. also I have computers these computers are connected to gather by server.The server and each computer contains the same database and store its data.In the last day I want to Store all the data from all the computers in the server database .please help me to solve my problem .
| 1 |
9,639,791 |
03/09/2012 19:24:05
| 965,895 |
09/26/2011 21:49:09
| 24 | 1 |
Locking a Java application to a particular PC
|
I want to devise a way to prevent piracy of my app or at least make it more difficult. The app will be installed in a standalone PC and I want to make it difficult for a person to simply copy the installation, or clone the hard drive, and simply deploy it on a second PC.
Is using the MAC address the best way? What about using WMI to get a mother board ID? Thanks
|
java
|
security
| null | null | null |
03/09/2012 20:20:57
|
not constructive
|
Locking a Java application to a particular PC
===
I want to devise a way to prevent piracy of my app or at least make it more difficult. The app will be installed in a standalone PC and I want to make it difficult for a person to simply copy the installation, or clone the hard drive, and simply deploy it on a second PC.
Is using the MAC address the best way? What about using WMI to get a mother board ID? Thanks
| 4 |
8,443,396 |
12/09/2011 09:21:56
| 537,712 |
12/10/2010 10:21:57
| 1,040 | 65 |
How to check where my disk-space goes in Ubuntu 10.04 LTS
|
How can i check the size of multiple (all) folders to see where most of my diskspace goes?
Is there a way to know why my diskspace is low without knowing where most storage is held?
To be short: I want to know where my diskspace is located, how can i do that.
This can be a GUI application of commandline commands.. Hope somebody can help..
Thanks in advance.
|
storage
|
ubuntu-10.04
|
diskspace
| null | null |
12/10/2011 04:24:30
|
off topic
|
How to check where my disk-space goes in Ubuntu 10.04 LTS
===
How can i check the size of multiple (all) folders to see where most of my diskspace goes?
Is there a way to know why my diskspace is low without knowing where most storage is held?
To be short: I want to know where my diskspace is located, how can i do that.
This can be a GUI application of commandline commands.. Hope somebody can help..
Thanks in advance.
| 2 |
11,675,437 |
07/26/2012 18:12:26
| 1,011,121 |
10/24/2011 15:04:15
| 120 | 0 |
Using a 3rd party JDBC driver with Coldfusion?
|
I'm attempting to use a 3rd party JDBC driver with my Coldfusion installation, but I've gone wrong somewhere, and I'm not exactly certain where.
I placed the .jar file inside of cfusion\wwwroot, but did not add it to my Datasources, as I'm not exactly certain if I have to/how I would since it is a local file.
Then, inside my test.cfm file I added the following code:
<cfset objDriver = createObject("java","java.sql.DriverManager")>
<cfset prop = createObject("java","java.util.Properties").init()>
<cfset prop.put("prop1", "prop1")>
<cfset prop.put("prop2", "prop2")>
<cfset prop.put("prop3", "prop3")>
<cfset conn = objDriver.getConnection("jdbc:mydriver:", prop) >
I verified that the properties and connection work fine in Java, so this is not the issue persay, but when I go to the page I get the following error on getConnection():
No suitable driver found for jdbc:mydriver:
I was wondering if I missed something obvious or silly.
|
jdbc
|
coldfusion
| null | null | null | null |
open
|
Using a 3rd party JDBC driver with Coldfusion?
===
I'm attempting to use a 3rd party JDBC driver with my Coldfusion installation, but I've gone wrong somewhere, and I'm not exactly certain where.
I placed the .jar file inside of cfusion\wwwroot, but did not add it to my Datasources, as I'm not exactly certain if I have to/how I would since it is a local file.
Then, inside my test.cfm file I added the following code:
<cfset objDriver = createObject("java","java.sql.DriverManager")>
<cfset prop = createObject("java","java.util.Properties").init()>
<cfset prop.put("prop1", "prop1")>
<cfset prop.put("prop2", "prop2")>
<cfset prop.put("prop3", "prop3")>
<cfset conn = objDriver.getConnection("jdbc:mydriver:", prop) >
I verified that the properties and connection work fine in Java, so this is not the issue persay, but when I go to the page I get the following error on getConnection():
No suitable driver found for jdbc:mydriver:
I was wondering if I missed something obvious or silly.
| 0 |
10,859,581 |
06/02/2012 03:33:25
| 167,520 |
09/02/2009 21:45:49
| 800 | 2 |
excel vba - protetcted sheet delete row
|
I learned that I need to write a macro if I want users to delete rows on a protected sheet.
This is the code I got by googling around:
Sub delete_row()
ActiveSheet.Unprotect Password:="justme"
ActiveCell.EntireRow.Delete
ActiveSheet.Protect Password:="justme"
End Sub
Where exactly should I place this code? Will it work if multiple rows are deleted etc.?
MrExcel is down today, so limited options.
|
excel
|
vba
| null | null | null | null |
open
|
excel vba - protetcted sheet delete row
===
I learned that I need to write a macro if I want users to delete rows on a protected sheet.
This is the code I got by googling around:
Sub delete_row()
ActiveSheet.Unprotect Password:="justme"
ActiveCell.EntireRow.Delete
ActiveSheet.Protect Password:="justme"
End Sub
Where exactly should I place this code? Will it work if multiple rows are deleted etc.?
MrExcel is down today, so limited options.
| 0 |
9,124,947 |
02/03/2012 07:08:40
| 626,090 |
02/21/2011 06:25:24
| 4 | 0 |
Web Service gives error after changing version of .Net framework from 4.0 to 3.5
|
i have created a web service using .net frame work 4.0 my service runs without error,
now when i change my .Net frame work from 4.0 to 3.5 my service gives error.
the error is as below
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
how to resolve this issue ..
all replies are welcome
Thanks in Advance :)
Regards
Kailash Kute
|
c#
|
.net
|
frameworks
| null | null |
02/06/2012 02:18:19
|
not a real question
|
Web Service gives error after changing version of .Net framework from 4.0 to 3.5
===
i have created a web service using .net frame work 4.0 my service runs without error,
now when i change my .Net frame work from 4.0 to 3.5 my service gives error.
the error is as below
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
how to resolve this issue ..
all replies are welcome
Thanks in Advance :)
Regards
Kailash Kute
| 1 |
3,749,997 |
09/20/2010 09:09:57
| 106,616 |
05/13/2009 20:15:30
| 505 | 16 |
T-SQL Why can I reffer only once to temporary object ?
|
with tmp_rows as
(
select * from [dbo].[customer]
)
select * from tmp_rows;
select count(*) from tmp_rows;
I can't get the count of the tmp_rows because I get the error: **Invalid object name 'tmp_rows'**
If I comment the "select *" query everything is OK
I need to select all rows and then get their count, how to do that ?
|
tsql
| null | null | null | null | null |
open
|
T-SQL Why can I reffer only once to temporary object ?
===
with tmp_rows as
(
select * from [dbo].[customer]
)
select * from tmp_rows;
select count(*) from tmp_rows;
I can't get the count of the tmp_rows because I get the error: **Invalid object name 'tmp_rows'**
If I comment the "select *" query everything is OK
I need to select all rows and then get their count, how to do that ?
| 0 |
11,002,533 |
06/12/2012 18:23:41
| 1,451,927 |
06/12/2012 18:08:31
| 1 | 0 |
Adv. mySQL SELECT
|
-.-
I'm sitting with this SELECT statement, and it's drivin me to crazyness!!
I got ONE product sepperated into 5 products, each with a culumn telling how many you should order to get it for that price.
What i want is for instance if i'm ordering 54, i should get the price from 50
If i'm ordering 100 or 101 etc.. i should get the price from 100.. and so on
Here's my SELECT so far .. PLEASE HELP -.-
SELECT
entity.entity_id AS "ID",
entity.value AS "Name",
qty_price.qty AS "Pcs",
qty_price.value AS "Price"
FROM `mg_catalog_product_entity_tier_price` qty_price
JOIN `mg_catalog_product_entity_varchar` entity
ON qty_price.entity_id = entity.entity_id
WHERE entity.entity_id = 300
AND entity.value = (SELECT name FROM `mg_catalog_product_flat_1` WHERE `mg_catalog_product_flat_1`.entity_id = entity.entity_id)
LIMIT 10;
|
mysql
|
sql
|
database
|
join
| null | null |
open
|
Adv. mySQL SELECT
===
-.-
I'm sitting with this SELECT statement, and it's drivin me to crazyness!!
I got ONE product sepperated into 5 products, each with a culumn telling how many you should order to get it for that price.
What i want is for instance if i'm ordering 54, i should get the price from 50
If i'm ordering 100 or 101 etc.. i should get the price from 100.. and so on
Here's my SELECT so far .. PLEASE HELP -.-
SELECT
entity.entity_id AS "ID",
entity.value AS "Name",
qty_price.qty AS "Pcs",
qty_price.value AS "Price"
FROM `mg_catalog_product_entity_tier_price` qty_price
JOIN `mg_catalog_product_entity_varchar` entity
ON qty_price.entity_id = entity.entity_id
WHERE entity.entity_id = 300
AND entity.value = (SELECT name FROM `mg_catalog_product_flat_1` WHERE `mg_catalog_product_flat_1`.entity_id = entity.entity_id)
LIMIT 10;
| 0 |
7,146,657 |
08/22/2011 11:17:14
| 626,664 |
02/21/2011 13:31:08
| 13 | 1 |
How to access and manipulate Google to-do list?
|
I need to access Google's todo list from Android programmatically. Please give me some clue where to start, and some examples if possible. Thanks in advance...
|
android
|
todos
| null | null | null | null |
open
|
How to access and manipulate Google to-do list?
===
I need to access Google's todo list from Android programmatically. Please give me some clue where to start, and some examples if possible. Thanks in advance...
| 0 |
6,362,949 |
06/15/2011 19:09:57
| 798,961 |
06/15/2011 05:23:22
| 1 | 0 |
is the asp.net-mvc instead way of regular asp.net web froms?
|
I have a question about MVC,
Can we say that mvc is the instead way of regular asp.net web froms?
If not which Scenario that I should not use mvc pattern?
Thanks
|
asp.net-mvc
| null | null | null | null |
06/15/2011 22:56:35
|
not constructive
|
is the asp.net-mvc instead way of regular asp.net web froms?
===
I have a question about MVC,
Can we say that mvc is the instead way of regular asp.net web froms?
If not which Scenario that I should not use mvc pattern?
Thanks
| 4 |
7,589,772 |
09/28/2011 21:23:22
| 959,912 |
09/22/2011 19:56:24
| 1 | 5 |
Change last octet of IP returned by gethostentry
|
Was wondering if anyone could help me out here. I don't dont much with c# but its easy for what im trying to do.
I am making a small application that will take in the hostname on my network and then return the full ipaddress(ipv4) ....From there i have options to ping/vnc/telnet...etc. My question lies here..I am using 'gethostentry' to return the ip address. Then I want to store the IP into a Var, and change the last octet. I figured a simple `sting.split('.')`
would be the answer, but I cant convert the IP to a string because the source is not a string..Any idea? Here is my Method to get the IP address, its just the basic gethostentry method:
IPHostEntry host;
host = Dns.GetHostEntry(hostname);
Console.WriteLine("GetHostEntry({0}) returns:", hostname);
/**This will loop though the IPAddress system array and echo out
the results to the console window **/
foreach (IPAddress ip in host.AddressList)
{
Console.WriteLine(" {0}", ip);
}
}
//This is the main static method
|
c#
|
split
|
ip-address
| null | null | null |
open
|
Change last octet of IP returned by gethostentry
===
Was wondering if anyone could help me out here. I don't dont much with c# but its easy for what im trying to do.
I am making a small application that will take in the hostname on my network and then return the full ipaddress(ipv4) ....From there i have options to ping/vnc/telnet...etc. My question lies here..I am using 'gethostentry' to return the ip address. Then I want to store the IP into a Var, and change the last octet. I figured a simple `sting.split('.')`
would be the answer, but I cant convert the IP to a string because the source is not a string..Any idea? Here is my Method to get the IP address, its just the basic gethostentry method:
IPHostEntry host;
host = Dns.GetHostEntry(hostname);
Console.WriteLine("GetHostEntry({0}) returns:", hostname);
/**This will loop though the IPAddress system array and echo out
the results to the console window **/
foreach (IPAddress ip in host.AddressList)
{
Console.WriteLine(" {0}", ip);
}
}
//This is the main static method
| 0 |
8,217,740 |
11/21/2011 19:57:48
| 1,058,478 |
11/21/2011 19:36:40
| 1 | 0 |
Indexing Matrices Matlab
|
I'm trying to compute two matrices , one of which is 400*2 and the other being 20*20. The first one contains x and y coordinates of 400 points and the second being another 400 points with x's being 2nd(i,i) and y's being (i,k) both i and k's are 20 number counters.I'm trying to compute the distances between those 2 matrix points which would give me 400*400 matrix. The code i'm using is ;
for i=1:20
for j=1:400
for k=1:20
L(j,)=sqrt((C(j,1)-M(i,i))^2+(C(j,2)-M(k,i))^2);
end
end
end
C being the first matrix and M being the second. Now i know i made it sound a little hard but the trouble is i cant find a counter to give to L(j, ) that part. If you guys have any idea please do tell...
|
matlab
|
matrix
| null | null | null | null |
open
|
Indexing Matrices Matlab
===
I'm trying to compute two matrices , one of which is 400*2 and the other being 20*20. The first one contains x and y coordinates of 400 points and the second being another 400 points with x's being 2nd(i,i) and y's being (i,k) both i and k's are 20 number counters.I'm trying to compute the distances between those 2 matrix points which would give me 400*400 matrix. The code i'm using is ;
for i=1:20
for j=1:400
for k=1:20
L(j,)=sqrt((C(j,1)-M(i,i))^2+(C(j,2)-M(k,i))^2);
end
end
end
C being the first matrix and M being the second. Now i know i made it sound a little hard but the trouble is i cant find a counter to give to L(j, ) that part. If you guys have any idea please do tell...
| 0 |
4,275,287 |
11/25/2010 09:05:46
| 341,791 |
05/15/2010 06:11:45
| 107 | 10 |
Option Recompile makes query fast - good or bad?
|
I have two SQL queries with about 2-3 INNER JOINS each. I need to do an INTERSECT between them.
Problem is that indiividually the queryes work fast, but after intersecting take about 4 seconds in total.
Now, if I put an OPTION (RECOMPILE) at the end of this whole query, the query works great again working quite fast returning almost instantly!.
I understand that option recopile forces a rebuild of execution plan, so I am confused now if my earler query taking 4 seconds is better or now the one with recompile, but taking 0 seconds is better.
|
sql
|
sql-server
|
optimization
| null | null | null |
open
|
Option Recompile makes query fast - good or bad?
===
I have two SQL queries with about 2-3 INNER JOINS each. I need to do an INTERSECT between them.
Problem is that indiividually the queryes work fast, but after intersecting take about 4 seconds in total.
Now, if I put an OPTION (RECOMPILE) at the end of this whole query, the query works great again working quite fast returning almost instantly!.
I understand that option recopile forces a rebuild of execution plan, so I am confused now if my earler query taking 4 seconds is better or now the one with recompile, but taking 0 seconds is better.
| 0 |
7,552,260 |
09/26/2011 08:08:51
| 962,745 |
09/12/2010 14:44:40
| 1 | 0 |
Apache Sling - exception when starting
|
I received the following error message when starting Sling (see below). I'm using Sling 6 (http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6-standalone.jar). Any idea what could be wrong?
Last time I tried using the same Sling version on Mac OSX and it worked perfectly (I have this error on a Windows machine).
Failed to Start OSGi framework
org.osgi.framework.BundleException: Uncaught Instantiation Issue:
java.lang.ArrayIndexOutOfBoundsException: -1
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:245)
at
org.apache.sling.launchpad.base.app.MainDelegate$1.<init>(MainDelegate.java:159)
at
org.apache.sling.launchpad.base.app.MainDelegate.start(MainDelegate.java:159)
at org.apache.sling.launchpad.app.Main.startSling(Main.java:244)
at org.apache.sling.launchpad.app.Main.<init>(Main.java:107)
at org.apache.sling.launchpad.app.Main.main(Main.java:56)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at
org.apache.felix.framework.BundleImpl.getCurrentModule(BundleImpl.java:1046)
at
org.apache.felix.framework.BundleImpl.getSymbolicName(BundleImpl.java:863)
at
org.apache.sling.launchpad.base.impl.SlingFelix.getSymbolicName(SlingFelix.java:32)
at org.apache.felix.framework.Felix.toString(Felix.java:1012)
at org.apache.felix.framework.Logger.doLog(Logger.java:128)
at org.apache.felix.framework.Logger._log(Logger.java:181)
at org.apache.felix.framework.Logger.log(Logger.java:114)
at
org.apache.felix.framework.ExtensionManager.<init>(ExtensionManager.java:201)
at org.apache.felix.framework.Felix.<init>(Felix.java:374)
at
org.apache.sling.launchpad.base.impl.SlingFelix.<init>(SlingFelix.java:39)
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:235)
|
sling
| null | null | null | null | null |
open
|
Apache Sling - exception when starting
===
I received the following error message when starting Sling (see below). I'm using Sling 6 (http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6-standalone.jar). Any idea what could be wrong?
Last time I tried using the same Sling version on Mac OSX and it worked perfectly (I have this error on a Windows machine).
Failed to Start OSGi framework
org.osgi.framework.BundleException: Uncaught Instantiation Issue:
java.lang.ArrayIndexOutOfBoundsException: -1
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:245)
at
org.apache.sling.launchpad.base.app.MainDelegate$1.<init>(MainDelegate.java:159)
at
org.apache.sling.launchpad.base.app.MainDelegate.start(MainDelegate.java:159)
at org.apache.sling.launchpad.app.Main.startSling(Main.java:244)
at org.apache.sling.launchpad.app.Main.<init>(Main.java:107)
at org.apache.sling.launchpad.app.Main.main(Main.java:56)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at
org.apache.felix.framework.BundleImpl.getCurrentModule(BundleImpl.java:1046)
at
org.apache.felix.framework.BundleImpl.getSymbolicName(BundleImpl.java:863)
at
org.apache.sling.launchpad.base.impl.SlingFelix.getSymbolicName(SlingFelix.java:32)
at org.apache.felix.framework.Felix.toString(Felix.java:1012)
at org.apache.felix.framework.Logger.doLog(Logger.java:128)
at org.apache.felix.framework.Logger._log(Logger.java:181)
at org.apache.felix.framework.Logger.log(Logger.java:114)
at
org.apache.felix.framework.ExtensionManager.<init>(ExtensionManager.java:201)
at org.apache.felix.framework.Felix.<init>(Felix.java:374)
at
org.apache.sling.launchpad.base.impl.SlingFelix.<init>(SlingFelix.java:39)
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:235)
| 0 |
11,667,893 |
07/26/2012 11:04:50
| 1,222,771 |
02/21/2012 07:08:08
| 31 | 1 |
.val() is not working in jquery?
|
Can we also pass array values to some variable and call through below code
$(document).ready(function() {
var somearray = "[1, 2, 3]";
$('#textvalue').val(somearray);
});
does it work?
Its not working with array don't know how :(
There is one more post related to this but that one is not with array
Link: http://stackoverflow.com/questions/5327331/jquery-val-not-working-when-setting-a-variable
Thanks in advance :)
|
javascript
|
jquery
| null | null | null |
07/30/2012 06:40:49
|
not a real question
|
.val() is not working in jquery?
===
Can we also pass array values to some variable and call through below code
$(document).ready(function() {
var somearray = "[1, 2, 3]";
$('#textvalue').val(somearray);
});
does it work?
Its not working with array don't know how :(
There is one more post related to this but that one is not with array
Link: http://stackoverflow.com/questions/5327331/jquery-val-not-working-when-setting-a-variable
Thanks in advance :)
| 1 |
4,177,006 |
11/14/2010 09:55:26
| 507,280 |
11/14/2010 09:55:26
| 1 | 0 |
CSI style zoom in and enhance now possible?
|
I have always thought the way they zoom in and enhance on TV and movies was strictly impossible. Essentially because you cannot create more information that there is to begin with.
There were ways to get better looking or clearer images like with re-sampling, but never to the extent seen on film.
Now, it seems that is not true.
I was reading [this][1] article, and it seems they have a way to do that now?
Or, is this just a better version of what was already possible? You still need to have a fairly clear image to start with? Otherwise, what are the limits of this technique?
[1]: http://www.wired.com/magazine/2010/02/ff_algorithm/
|
image
|
image-processing
|
image-enhancement
| null | null |
11/15/2010 20:31:35
|
off topic
|
CSI style zoom in and enhance now possible?
===
I have always thought the way they zoom in and enhance on TV and movies was strictly impossible. Essentially because you cannot create more information that there is to begin with.
There were ways to get better looking or clearer images like with re-sampling, but never to the extent seen on film.
Now, it seems that is not true.
I was reading [this][1] article, and it seems they have a way to do that now?
Or, is this just a better version of what was already possible? You still need to have a fairly clear image to start with? Otherwise, what are the limits of this technique?
[1]: http://www.wired.com/magazine/2010/02/ff_algorithm/
| 2 |
3,345,683 |
07/27/2010 16:19:19
| 403,620 |
07/27/2010 16:19:19
| 1 | 0 |
Best Ruby library for Excel files
|
What is the best Ruby library for dealing with Excel spreadsheets?
I found spreadsheet-gem but I didn't find it to be as good as PHPExcel - a library I used to use when I was a PHP developer.
Please help.<br>
Thanks.
|
ruby-on-rails
|
ruby
|
excel
| null | null |
09/15/2011 13:19:28
|
not constructive
|
Best Ruby library for Excel files
===
What is the best Ruby library for dealing with Excel spreadsheets?
I found spreadsheet-gem but I didn't find it to be as good as PHPExcel - a library I used to use when I was a PHP developer.
Please help.<br>
Thanks.
| 4 |
6,216,971 |
06/02/2011 15:55:57
| 781,439 |
06/02/2011 15:53:19
| 1 | 0 |
Web design help - adding a tab on a div
|
I would like to add a tab to a div which, floats center, on the top left of it. Kind of like a bookmark. Here is an image to help describe what I want to achieve.
http://i.stack.imgur.com/8ZvVr.png
The '???' is the tab I need.
Thanks
|
html
|
website
| null | null | null |
06/02/2011 16:02:47
|
off topic
|
Web design help - adding a tab on a div
===
I would like to add a tab to a div which, floats center, on the top left of it. Kind of like a bookmark. Here is an image to help describe what I want to achieve.
http://i.stack.imgur.com/8ZvVr.png
The '???' is the tab I need.
Thanks
| 2 |
4,858,904 |
02/01/2011 04:32:24
| 526,223 |
12/01/2010 08:00:23
| 30 | 1 |
Normal Probability Plot interpretation
|
I have a very basic question. What is the basis of the normal probability plot i.e. what do the probabilities represent? I am testing for a standard normal distribution. My NormPlot (in MATLAB) revealed that the values were more or less in a straight line BUT the probability of 0.5 corresponded to a value other than zero.
My question is, how do I interpret this? Does this mean that my data is normally distributed but has a non-zero mean (i.e. not standard normal) or does this probability only reflect something else? I tried Google and one link said the probabilities are the cumulative probabilities from the z-table, and I can't figure out what to make of it.
Also in MATLAB, is it that as long as the values are fitting into the line drawn by the program (the red dotted line) the values come fro ma normal distribution? In one of my graphs, the dotted line is very steep but the values fit in, does this mean that the one or two values that are way outside this line are just outliers?
I'm very new to stats, so please help!
Thanks!
|
matlab
|
graph
|
normalization
|
probability
|
interpretation
|
02/02/2011 03:17:00
|
off topic
|
Normal Probability Plot interpretation
===
I have a very basic question. What is the basis of the normal probability plot i.e. what do the probabilities represent? I am testing for a standard normal distribution. My NormPlot (in MATLAB) revealed that the values were more or less in a straight line BUT the probability of 0.5 corresponded to a value other than zero.
My question is, how do I interpret this? Does this mean that my data is normally distributed but has a non-zero mean (i.e. not standard normal) or does this probability only reflect something else? I tried Google and one link said the probabilities are the cumulative probabilities from the z-table, and I can't figure out what to make of it.
Also in MATLAB, is it that as long as the values are fitting into the line drawn by the program (the red dotted line) the values come fro ma normal distribution? In one of my graphs, the dotted line is very steep but the values fit in, does this mean that the one or two values that are way outside this line are just outliers?
I'm very new to stats, so please help!
Thanks!
| 2 |
8,058,368 |
11/08/2011 23:13:16
| 225,396 |
12/05/2009 13:21:01
| 3,520 | 232 |
How Can I create Spring Bean outside of Spring Application Context
|
I'm developing some kind of plugin which should be called by external java app.
my Plugin is using Spring and of cause I tried to simplify my as I can:
Let's consider that this is 3d party app and it's calling my plugin in its main function.
public class ThirdPartyClass {
public static void main(String[] args) {
GeneralPlugin plugin = new MyPlugin();
plugin.init();
//calling ext. plugin functionality.
plugin.method1();
}
}
Now this is my plugin
package com.vanilla.spring;
@Component
public class MyPlugin implements GeneralPlugin{
@Autowired
Dao mydao;
public void init(){
//some initiation logic goes here...
}
public void method1(){
dao.delete();
}
}
Now my Dao
package com.vanilla.spring;
Component(value="dao")
public class MyDao {
public void delete(){
//SOME DATABASE LOGIC GOES HERE!!!
}
}
now my XML:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
<context:annotation-config />
<context:component-scan base-package="com.vanilla.spring"></context:component-scan>
</beans>
My problem is that my dao is null and I'm getting `NullPointerException` when accessing dao object.
I
m believe it happens because I'm initiation bean out of Application context and as the result my Autowiring is not working.
Is there any other way to make autowiring work?
|
java
|
spring
|
java-ee
| null | null | null |
open
|
How Can I create Spring Bean outside of Spring Application Context
===
I'm developing some kind of plugin which should be called by external java app.
my Plugin is using Spring and of cause I tried to simplify my as I can:
Let's consider that this is 3d party app and it's calling my plugin in its main function.
public class ThirdPartyClass {
public static void main(String[] args) {
GeneralPlugin plugin = new MyPlugin();
plugin.init();
//calling ext. plugin functionality.
plugin.method1();
}
}
Now this is my plugin
package com.vanilla.spring;
@Component
public class MyPlugin implements GeneralPlugin{
@Autowired
Dao mydao;
public void init(){
//some initiation logic goes here...
}
public void method1(){
dao.delete();
}
}
Now my Dao
package com.vanilla.spring;
Component(value="dao")
public class MyDao {
public void delete(){
//SOME DATABASE LOGIC GOES HERE!!!
}
}
now my XML:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
<context:annotation-config />
<context:component-scan base-package="com.vanilla.spring"></context:component-scan>
</beans>
My problem is that my dao is null and I'm getting `NullPointerException` when accessing dao object.
I
m believe it happens because I'm initiation bean out of Application context and as the result my Autowiring is not working.
Is there any other way to make autowiring work?
| 0 |
4,890,661 |
02/03/2011 19:23:29
| 500,805 |
10/21/2010 20:39:28
| 128 | 6 |
Indexing for joins in mysql database
|
Had a quick question about joins in mysql and indexing. If I had 2 tables:
table1
id
name
table2
table1id
table2title
And I join table2 and table1 using id and table1id would I add a index to id on table1 and table1id in table2? Or would I just add an index to one of the tables? Im using MySQL with MyISAM version 5.x
|
mysql
|
index
|
inner-join
| null | null | null |
open
|
Indexing for joins in mysql database
===
Had a quick question about joins in mysql and indexing. If I had 2 tables:
table1
id
name
table2
table1id
table2title
And I join table2 and table1 using id and table1id would I add a index to id on table1 and table1id in table2? Or would I just add an index to one of the tables? Im using MySQL with MyISAM version 5.x
| 0 |
1,592,988 |
10/20/2009 07:29:37
| 192,898 |
10/20/2009 07:29:37
| 1 | 0 |
How to traverse XPath recursively ?
|
is there a way (and if so, how ?) to traverse a XPath query recursively ?
I have an AST in Java with the following scenario
@Relevant
public void foo() {
bar(true);
}
public void bar(boolean flag) {
assert flag;
}
I want to find the method which is annotated with '@Relevant' (thats easy) and check if the method which is called in foo (here bar) does have an assert Statement.
So a) how do I extract the methode name 'bar' and ask via XPath for the method called 'bar' ?
and what if 'bar' actually calls 'bla' in which the assert happens ?
hope this is understandable...
Thanks for any help
|
xpath
|
ast
|
java
| null | null | null |
open
|
How to traverse XPath recursively ?
===
is there a way (and if so, how ?) to traverse a XPath query recursively ?
I have an AST in Java with the following scenario
@Relevant
public void foo() {
bar(true);
}
public void bar(boolean flag) {
assert flag;
}
I want to find the method which is annotated with '@Relevant' (thats easy) and check if the method which is called in foo (here bar) does have an assert Statement.
So a) how do I extract the methode name 'bar' and ask via XPath for the method called 'bar' ?
and what if 'bar' actually calls 'bla' in which the assert happens ?
hope this is understandable...
Thanks for any help
| 0 |
3,386,414 |
08/02/2010 09:14:53
| 70,774 |
02/25/2009 10:34:47
| 187 | 1 |
how to add options for the drop down menu (magento)
|
i had to add custom options automatically when a product is added , the code works fine but i need to create a drop down menu with options and i dont know how to add options to the drop down created ,
my code is
public function Add_CustomOptions_Automatically($observer) {
$product = $observer->getEvent()->getProduct();
$save = false; if (!$product->getOptions()) $save = true;
$optionData = array(
'previous_group' => 'text',
'title' => 'Size',
'type' => 'drop_down',
'is_require' => 0,
'sort_order' => 0,
'price' => 0,
'price_type' => 'fixed');
if($save):
$product->setHasOptions(1)->save();
$option = Mage::getModel('catalog/product_option')
->setProductId($product->getId())
->setStoreId($product->getStoreId())
->addData($optionData);
$option->save();
$product->addOption($option);
endif;
}
}
i've created 'type' => 'drop_down' but how can i add option , i have no idea how to add the options,
any help would be very much appreciated
thanks,
|
magento
| null | null | null | null | null |
open
|
how to add options for the drop down menu (magento)
===
i had to add custom options automatically when a product is added , the code works fine but i need to create a drop down menu with options and i dont know how to add options to the drop down created ,
my code is
public function Add_CustomOptions_Automatically($observer) {
$product = $observer->getEvent()->getProduct();
$save = false; if (!$product->getOptions()) $save = true;
$optionData = array(
'previous_group' => 'text',
'title' => 'Size',
'type' => 'drop_down',
'is_require' => 0,
'sort_order' => 0,
'price' => 0,
'price_type' => 'fixed');
if($save):
$product->setHasOptions(1)->save();
$option = Mage::getModel('catalog/product_option')
->setProductId($product->getId())
->setStoreId($product->getStoreId())
->addData($optionData);
$option->save();
$product->addOption($option);
endif;
}
}
i've created 'type' => 'drop_down' but how can i add option , i have no idea how to add the options,
any help would be very much appreciated
thanks,
| 0 |
9,331,732 |
02/17/2012 16:16:04
| 1,216,673 |
02/17/2012 16:10:16
| 1 | 0 |
How to dig through a multidimentional array?
|
Array ( [0] => Array ( [PACKAGE] => Array ( [0] => Array ( [ATTRIBUTES] => Array ( [ID] => 0 ) [ZIPORIGINATION] => Array ( [0] => Array ( [VALUE] => 32751 ) ) [ZIPDESTINATION] => Array ( [0] => Array ( [VALUE] => 55967 ) ) [POUNDS] => Array ( [0] => Array ( [VALUE] => 0 ) ) [OUNCES] => Array ( [0] => Array ( [VALUE] => 9 ) ) [CONTAINER] => Array ( [0] => Array ( [VALUE] => Flat Rate Box ) ) [SIZE] => Array ( [0] => Array ( [VALUE] => REGULAR ) ) [ZONE] => Array ( [0] => Array ( [VALUE] => 6 ) ) [POSTAGE] => Array ( [0] => Array ( [MAILSERVICE] => Array ( [0] => Array ( [VALUE] => Priority Mail<sup>®</sup> Medium Flat Rate Box ) ) [RATE] => Array ( [0] => Array ( [VALUE] => 11.35 ) ) ) ) ) ) ) ) Array ( [0] => price Object ( [mailservice] => Priority Mail<sup>®</sup> Medium Flat Rate Box [rate] => 11.35 ) )
...yeah. I need to search through these and pull out the RATE value, which here is 11.35.
For/each loops have failed me so far, any other ideas?
|
php
|
arrays
|
multidimensional-array
|
foreach
| null | null |
open
|
How to dig through a multidimentional array?
===
Array ( [0] => Array ( [PACKAGE] => Array ( [0] => Array ( [ATTRIBUTES] => Array ( [ID] => 0 ) [ZIPORIGINATION] => Array ( [0] => Array ( [VALUE] => 32751 ) ) [ZIPDESTINATION] => Array ( [0] => Array ( [VALUE] => 55967 ) ) [POUNDS] => Array ( [0] => Array ( [VALUE] => 0 ) ) [OUNCES] => Array ( [0] => Array ( [VALUE] => 9 ) ) [CONTAINER] => Array ( [0] => Array ( [VALUE] => Flat Rate Box ) ) [SIZE] => Array ( [0] => Array ( [VALUE] => REGULAR ) ) [ZONE] => Array ( [0] => Array ( [VALUE] => 6 ) ) [POSTAGE] => Array ( [0] => Array ( [MAILSERVICE] => Array ( [0] => Array ( [VALUE] => Priority Mail<sup>®</sup> Medium Flat Rate Box ) ) [RATE] => Array ( [0] => Array ( [VALUE] => 11.35 ) ) ) ) ) ) ) ) Array ( [0] => price Object ( [mailservice] => Priority Mail<sup>®</sup> Medium Flat Rate Box [rate] => 11.35 ) )
...yeah. I need to search through these and pull out the RATE value, which here is 11.35.
For/each loops have failed me so far, any other ideas?
| 0 |
11,717,791 |
07/30/2012 08:28:27
| 1,511,222 |
07/09/2012 06:56:19
| 13 | 0 |
how to read files from *.txt and import the data content to a png file that it create a diagram
|
I have *.txt files and now i want to take the data content and put it in a *.png file.
But the *.png have to be new create.
I have no clue how to create a png file and no clue about how to read the data content from a txt and put it in the png file that´s in the end a diagram.
any suggestions?
|
python
|
png
| null | null | null |
07/30/2012 08:57:01
|
not a real question
|
how to read files from *.txt and import the data content to a png file that it create a diagram
===
I have *.txt files and now i want to take the data content and put it in a *.png file.
But the *.png have to be new create.
I have no clue how to create a png file and no clue about how to read the data content from a txt and put it in the png file that´s in the end a diagram.
any suggestions?
| 1 |
11,609,683 |
07/23/2012 09:22:58
| 1,545,422 |
07/23/2012 09:17:10
| 1 | 0 |
DataStructures Books and best way to study datastructures
|
Hii i am starting my data structures class this semester. Can anyone tell me how to start as a beginner and reach expertise within the course ends that is from aug to dec. Books prescribed for us is data structures using c and c++.
A brief description on how to start, what to study, would be helful.
Right now i am good at PHP, javascript, HTML & CSS also some C & C++
Thanks in advance and by the way why is that captcha used everywhere
|
data-structures
|
books
|
study
| null | null |
07/24/2012 01:57:51
|
not constructive
|
DataStructures Books and best way to study datastructures
===
Hii i am starting my data structures class this semester. Can anyone tell me how to start as a beginner and reach expertise within the course ends that is from aug to dec. Books prescribed for us is data structures using c and c++.
A brief description on how to start, what to study, would be helful.
Right now i am good at PHP, javascript, HTML & CSS also some C & C++
Thanks in advance and by the way why is that captcha used everywhere
| 4 |
9,236,609 |
02/11/2012 00:15:28
| 1,203,179 |
02/11/2012 00:07:34
| 1 | 0 |
jQuery and Lift non working without Lift abstractions
|
I am switching my server from python to scala using lift. And I have been unable to call any jquery functions from the html template. I have heard about the Lift javascript abstraction, but I wasn't able to make JE.Call work. What is the issue? How do you get Jquery to work on Lift? I have spent countless amount of time, and apologize if this is a trivial issue.
Thank you,
Julian (former Gilt Group Employee)
|
javascript
|
jquery
|
scala
| null | null | null |
open
|
jQuery and Lift non working without Lift abstractions
===
I am switching my server from python to scala using lift. And I have been unable to call any jquery functions from the html template. I have heard about the Lift javascript abstraction, but I wasn't able to make JE.Call work. What is the issue? How do you get Jquery to work on Lift? I have spent countless amount of time, and apologize if this is a trivial issue.
Thank you,
Julian (former Gilt Group Employee)
| 0 |
11,027,122 |
06/14/2012 05:25:57
| 829,165 |
02/16/2011 10:14:54
| 56 | 0 |
How to load/write data into a newfile using selenium?
|
I'm using selenium IDE to record & replay some testcase.
During this, i stored some values in variables.Now i've to load/write these variable's value into new file.How can i do it ? is it possible ?
|
selenium
| null | null | null | null | null |
open
|
How to load/write data into a newfile using selenium?
===
I'm using selenium IDE to record & replay some testcase.
During this, i stored some values in variables.Now i've to load/write these variable's value into new file.How can i do it ? is it possible ?
| 0 |
8,672,856 |
12/29/2011 20:11:29
| 1,028,441 |
11/03/2011 19:48:47
| 1 | 0 |
Best Algorithm Book
|
Nerdy question, but I think I'm at the right place:
If I'm interested in search algorithms, what's a good starter book? I know web programming languages and have a grasp of C (by grasp I mean I took a one semester course on it 5 years ago but haven't touched it since). I don't know Python, but I can read through the code and usually figure out what it's doing. I also have a math background.
I'm leaning towards "Programming Collective Intelligence" from O'Reilly. Good or is there something better?
Thanks everyone.
|
algorithm
|
books
| null | null | null |
12/29/2011 20:16:31
|
off topic
|
Best Algorithm Book
===
Nerdy question, but I think I'm at the right place:
If I'm interested in search algorithms, what's a good starter book? I know web programming languages and have a grasp of C (by grasp I mean I took a one semester course on it 5 years ago but haven't touched it since). I don't know Python, but I can read through the code and usually figure out what it's doing. I also have a math background.
I'm leaning towards "Programming Collective Intelligence" from O'Reilly. Good or is there something better?
Thanks everyone.
| 2 |
3,392,067 |
08/02/2010 21:47:38
| 384,972 |
07/06/2010 20:55:49
| 149 | 9 |
In order to 'learn' programming, which is better? web-development or traditional console/standalone app. development?
|
The traditional approach to teaching computer science focuses on standalone application development. That is how I (and I suspect most SO readers) learned how to do it, but I am wondering if that is in fact the best way to learn how to be a good developer.
I was wondering what others on SO think about this, is standalone development experience/theory a necessary first step in the education of a good developer? I realize this question is broad (and could even be further generalized if we treat the 'web layer' as any presentation layer) - but I am still curious if anyone here started at web development and eventually learned how to work with the back-end and how to write good class libraries and standalone applications.
'Classical' standalone application development makes up a smaller percentage of software development projects, while focus is continuously moving toward web-applications. While I don't expect the classical model to ever completely disappear, I see far more employment opportunities for web-developers than for standalone application developers. And if this employment picture persists, should we change the way we train developers? This question has interested me for a while, and I would welcome any thoughts, links or directions to resources which deal with this aspect of computer science education in greater depth.
|
education
|
standalone
| null | null | null |
08/04/2010 20:00:04
|
not constructive
|
In order to 'learn' programming, which is better? web-development or traditional console/standalone app. development?
===
The traditional approach to teaching computer science focuses on standalone application development. That is how I (and I suspect most SO readers) learned how to do it, but I am wondering if that is in fact the best way to learn how to be a good developer.
I was wondering what others on SO think about this, is standalone development experience/theory a necessary first step in the education of a good developer? I realize this question is broad (and could even be further generalized if we treat the 'web layer' as any presentation layer) - but I am still curious if anyone here started at web development and eventually learned how to work with the back-end and how to write good class libraries and standalone applications.
'Classical' standalone application development makes up a smaller percentage of software development projects, while focus is continuously moving toward web-applications. While I don't expect the classical model to ever completely disappear, I see far more employment opportunities for web-developers than for standalone application developers. And if this employment picture persists, should we change the way we train developers? This question has interested me for a while, and I would welcome any thoughts, links or directions to resources which deal with this aspect of computer science education in greater depth.
| 4 |
6,883,359 |
07/30/2011 13:21:26
| 698,943 |
04/08/2011 15:35:57
| 1 | 0 |
WP-Debug Issue with Image Resizing Script (WordPress)
|
Working with Victor Teixeira's image resizing script, and have used it on several premium themes. It functions great, but I'm getting some notices when I run the debugger, and I don't know how to resolve it. I wonder if anyone can help? :)
Here are the notices:
Notice: Undefined variable: file_path in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 129
Notice: Undefined index: extension in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 130
Notice: Undefined index: dirname in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 133
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 139
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 139
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 194
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 195
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 196
And here is the code:
function vt_resize( $attach_id = null, $img_url = null, $width, $height, $crop = false ) {
// this is an attachment, so we have the ID
if ( $attach_id ) {
$image_src = wp_get_attachment_image_src( $attach_id, 'full' );
$file_path = get_attached_file( $attach_id );
// this is not an attachment, let's use the image url
} else if ( $img_url ) {
$file_path = parse_url( $img_url );
$file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
//$file_path = ltrim( $file_path['path'], '/' );
//$file_path = rtrim( ABSPATH, '/' ).$file_path['path'];
$orig_size = getimagesize( $file_path );
$image_src[0] = $img_url;
$image_src[1] = $orig_size[0];
$image_src[2] = $orig_size[1];
}
$file_info = pathinfo( $file_path );
$extension = '.'. $file_info['extension'];
// the image path without the extension
$no_ext_path = $file_info['dirname'].'/'.$file_info['filename'];
$cropped_img_path = $no_ext_path.'-'.$width.'x'.$height.$extension;
// checking if the file size is larger than the target size
// if it is smaller or the same size, stop right here and return
if ( $image_src[1] > $width || $image_src[2] > $height ) {
// the file is larger, check if the resized version already exists (for $crop = true but will also work for $crop = false if the sizes match)
if ( file_exists( $cropped_img_path ) ) {
$cropped_img_url = str_replace( basename( $image_src[0] ), basename( $cropped_img_path ), $image_src[0] );
$vt_image = array (
'url' => $cropped_img_url,
'width' => $width,
'height' => $height
);
return $vt_image;
}
// $crop = false
if ( $crop == false ) {
// calculate the size proportionaly
$proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height );
$resized_img_path = $no_ext_path.'-'.$proportional_size[0].'x'.$proportional_size[1].$extension;
// checking if the file already exists
if ( file_exists( $resized_img_path ) ) {
$resized_img_url = str_replace( basename( $image_src[0] ), basename( $resized_img_path ), $image_src[0] );
$vt_image = array (
'url' => $resized_img_url,
'width' => $proportional_size[0],
'height' => $proportional_size[1]
);
return $vt_image;
}
}
// no cache files - let's finally resize it
$new_img_path = image_resize( $file_path, $width, $height, $crop );
$new_img_size = getimagesize( $new_img_path );
$new_img = str_replace( basename( $image_src[0] ), basename( $new_img_path ), $image_src[0] );
// resized output
$vt_image = array (
'url' => $new_img,
'width' => $new_img_size[0],
'height' => $new_img_size[1]
);
return $vt_image;
}
// default output - without resizing
$vt_image = array (
'url' => $image_src[0],
'width' => $image_src[1],
'height' => $image_src[2]
);
return $vt_image;
}
Thanks you in advance. This issue is causing me a headache :)
|
image
|
wordpress
|
image-resizing
| null | null | null |
open
|
WP-Debug Issue with Image Resizing Script (WordPress)
===
Working with Victor Teixeira's image resizing script, and have used it on several premium themes. It functions great, but I'm getting some notices when I run the debugger, and I don't know how to resolve it. I wonder if anyone can help? :)
Here are the notices:
Notice: Undefined variable: file_path in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 129
Notice: Undefined index: extension in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 130
Notice: Undefined index: dirname in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 133
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 139
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 139
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 194
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 195
Notice: Undefined variable: image_src in /nfs/c03/h01/mnt/51370/domains/minimalpixels.com/html/wp-content/themes/paragon/framework/functions/basicFunctions.php on line 196
And here is the code:
function vt_resize( $attach_id = null, $img_url = null, $width, $height, $crop = false ) {
// this is an attachment, so we have the ID
if ( $attach_id ) {
$image_src = wp_get_attachment_image_src( $attach_id, 'full' );
$file_path = get_attached_file( $attach_id );
// this is not an attachment, let's use the image url
} else if ( $img_url ) {
$file_path = parse_url( $img_url );
$file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
//$file_path = ltrim( $file_path['path'], '/' );
//$file_path = rtrim( ABSPATH, '/' ).$file_path['path'];
$orig_size = getimagesize( $file_path );
$image_src[0] = $img_url;
$image_src[1] = $orig_size[0];
$image_src[2] = $orig_size[1];
}
$file_info = pathinfo( $file_path );
$extension = '.'. $file_info['extension'];
// the image path without the extension
$no_ext_path = $file_info['dirname'].'/'.$file_info['filename'];
$cropped_img_path = $no_ext_path.'-'.$width.'x'.$height.$extension;
// checking if the file size is larger than the target size
// if it is smaller or the same size, stop right here and return
if ( $image_src[1] > $width || $image_src[2] > $height ) {
// the file is larger, check if the resized version already exists (for $crop = true but will also work for $crop = false if the sizes match)
if ( file_exists( $cropped_img_path ) ) {
$cropped_img_url = str_replace( basename( $image_src[0] ), basename( $cropped_img_path ), $image_src[0] );
$vt_image = array (
'url' => $cropped_img_url,
'width' => $width,
'height' => $height
);
return $vt_image;
}
// $crop = false
if ( $crop == false ) {
// calculate the size proportionaly
$proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height );
$resized_img_path = $no_ext_path.'-'.$proportional_size[0].'x'.$proportional_size[1].$extension;
// checking if the file already exists
if ( file_exists( $resized_img_path ) ) {
$resized_img_url = str_replace( basename( $image_src[0] ), basename( $resized_img_path ), $image_src[0] );
$vt_image = array (
'url' => $resized_img_url,
'width' => $proportional_size[0],
'height' => $proportional_size[1]
);
return $vt_image;
}
}
// no cache files - let's finally resize it
$new_img_path = image_resize( $file_path, $width, $height, $crop );
$new_img_size = getimagesize( $new_img_path );
$new_img = str_replace( basename( $image_src[0] ), basename( $new_img_path ), $image_src[0] );
// resized output
$vt_image = array (
'url' => $new_img,
'width' => $new_img_size[0],
'height' => $new_img_size[1]
);
return $vt_image;
}
// default output - without resizing
$vt_image = array (
'url' => $image_src[0],
'width' => $image_src[1],
'height' => $image_src[2]
);
return $vt_image;
}
Thanks you in advance. This issue is causing me a headache :)
| 0 |
8,521,374 |
12/15/2011 14:07:51
| 1,095,608 |
12/13/2011 11:11:58
| 11 | 0 |
is there any option to run and remove virus (spyware trojan malware ) in linux?
|
By title,This question may be crazy..
Still I am using linux (fedora 16) at my laptop and another my friend using windows 7.
We use share files using USB. so would like to check with you guys (expertise)
"is there any option to run and remove virus (spyware trojan malware ) in linux (fedora)? "
if so please do suggest me to make it happen...
Thanks in advance!
-
Thiyagarajan
|
linux
|
fedora
|
scan
|
malware
| null |
12/15/2011 15:13:31
|
off topic
|
is there any option to run and remove virus (spyware trojan malware ) in linux?
===
By title,This question may be crazy..
Still I am using linux (fedora 16) at my laptop and another my friend using windows 7.
We use share files using USB. so would like to check with you guys (expertise)
"is there any option to run and remove virus (spyware trojan malware ) in linux (fedora)? "
if so please do suggest me to make it happen...
Thanks in advance!
-
Thiyagarajan
| 2 |
6,554,742 |
07/02/2011 02:24:39
| 825,704 |
07/02/2011 02:24:39
| 1 | 0 |
Why are NoSQL solutions using Javascript these days for their "SQL"?
|
What were the trade offs? Why was js chosen?
Why not another scripting language like Ruby?
MongoDB and Riak both use JS. A lot of other ones are using JS too. Is this just a "follow the crowd" thing?
|
javascript
|
database
|
nosql
| null | null |
07/03/2011 13:07:38
|
not constructive
|
Why are NoSQL solutions using Javascript these days for their "SQL"?
===
What were the trade offs? Why was js chosen?
Why not another scripting language like Ruby?
MongoDB and Riak both use JS. A lot of other ones are using JS too. Is this just a "follow the crowd" thing?
| 4 |
7,228,530 |
08/29/2011 09:47:52
| 917,556 |
08/29/2011 09:47:52
| 1 | 0 |
New Facebook picture viewing Blurred, why?
|
Hi with the new upgrades to facebook have you noticed that the pictures are not clear anymore. I seem to have pixilated pictures.
Is there a reason? I do leave some time to see if they need to load up but the remain blurred/Pixilated. HELP please
|
facebook
|
picture
| null | null | null |
08/29/2011 11:37:45
|
off topic
|
New Facebook picture viewing Blurred, why?
===
Hi with the new upgrades to facebook have you noticed that the pictures are not clear anymore. I seem to have pixilated pictures.
Is there a reason? I do leave some time to see if they need to load up but the remain blurred/Pixilated. HELP please
| 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.