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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,160,088 | 06/22/2012 16:12:43 | 1,475,255 | 06/22/2012 15:24:41 | 1 | 0 | Google Directions Server returns no results for routes to Texas? | Since early this morning, it appears that Google Directions to Texas are returning no results. Here's a sample response from within the Javascript API:
{"routes":[],"status":"ZERO_RESULTS","Yf":{"origin":"36.4037460138417,-105.57447329101564","destination":"35.22918668520182,-101.84597704772949","optimizeWaypoints":false,"unitSystem":1,"region":"us","provideRouteAlternatives":false,"travelMode":"DRIVING"}}
If you copy those way points into Google Maps, it finds a route. This appears to only be happening on on destinations to Texas as near as I can tell, but I need to do more testing.
Is anyone else experiencing this? Thoughts on how to resolve? | google | routes | directions | null | null | 06/23/2012 17:08:22 | too localized | Google Directions Server returns no results for routes to Texas?
===
Since early this morning, it appears that Google Directions to Texas are returning no results. Here's a sample response from within the Javascript API:
{"routes":[],"status":"ZERO_RESULTS","Yf":{"origin":"36.4037460138417,-105.57447329101564","destination":"35.22918668520182,-101.84597704772949","optimizeWaypoints":false,"unitSystem":1,"region":"us","provideRouteAlternatives":false,"travelMode":"DRIVING"}}
If you copy those way points into Google Maps, it finds a route. This appears to only be happening on on destinations to Texas as near as I can tell, but I need to do more testing.
Is anyone else experiencing this? Thoughts on how to resolve? | 3 |
1,027,389 | 06/22/2009 14:02:57 | 41,956 | 11/30/2008 17:33:49 | 1,704 | 178 | What is better to use: Dictionary<>.ForEach(pair =>) or Dictionary<>.Keys.ForEach(key =>) ? | If I have access only keys from a `Dictionary<TKey, TValue>` what is better to use:
Dictionary<TKey, TValue>.ForEach(pair => action(pair.Key))
or
Dictionary<TKey, TValue>.Keys.ForEach(key => action(key))
Which method is more 'best-practice' ? Speed in both cases I think seems to be very similar. | c# | .net | generics | extension-methods | null | null | open | What is better to use: Dictionary<>.ForEach(pair =>) or Dictionary<>.Keys.ForEach(key =>) ?
===
If I have access only keys from a `Dictionary<TKey, TValue>` what is better to use:
Dictionary<TKey, TValue>.ForEach(pair => action(pair.Key))
or
Dictionary<TKey, TValue>.Keys.ForEach(key => action(key))
Which method is more 'best-practice' ? Speed in both cases I think seems to be very similar. | 0 |
11,589,501 | 07/21/2012 04:36:33 | 480,043 | 10/19/2010 04:46:08 | 11 | 3 | Animate a button in JavaScript to bring up a modal dialog box from the button to the center of the screen? | I have a very specific trick I'm trying to perform in JavaScript, and I'm sure there are libraries out there that will allow me to do this, but my searching for a precise solution has failed so far.
I have a web page that has a "Login" button in the top right corner of the screen. When the user clicks the button, I will display a CSS modal dialog box on the center of the screen that allows the user to type in their authentication information. The CSS dialog box is all set, there's just one piece missing:
I want to add an animation when the user clicks on the login button that shows the modal box "opening" from the Login button to the center of the screen to help draw the user's eye to where it is supposed to go next. The animation should feel similar to when a window is minimized to/unminimized from the Windows taskbar.
Can anyone point me to a JavaScript library that has this functionality? Thanks so much! | javascript | null | null | null | null | null | open | Animate a button in JavaScript to bring up a modal dialog box from the button to the center of the screen?
===
I have a very specific trick I'm trying to perform in JavaScript, and I'm sure there are libraries out there that will allow me to do this, but my searching for a precise solution has failed so far.
I have a web page that has a "Login" button in the top right corner of the screen. When the user clicks the button, I will display a CSS modal dialog box on the center of the screen that allows the user to type in their authentication information. The CSS dialog box is all set, there's just one piece missing:
I want to add an animation when the user clicks on the login button that shows the modal box "opening" from the Login button to the center of the screen to help draw the user's eye to where it is supposed to go next. The animation should feel similar to when a window is minimized to/unminimized from the Windows taskbar.
Can anyone point me to a JavaScript library that has this functionality? Thanks so much! | 0 |
11,646,596 | 07/25/2012 09:23:40 | 1,340,370 | 04/18/2012 05:02:01 | 1 | 0 | graphael interactive piechartin ie8 got strucked | in ie8, when clicked on any point of the webpage which has interactive pie chart, the pie chart got strucked where as in other browsers it works correctly.
source code, you can see from the main websiteitself:
http://g.raphaeljs.com/piechart2.html.
Even when i download the code and made it to work, the same problem occurs.
Any one help me with this.
thanks in advance
| internet-explorer-8 | graphael | null | null | null | null | open | graphael interactive piechartin ie8 got strucked
===
in ie8, when clicked on any point of the webpage which has interactive pie chart, the pie chart got strucked where as in other browsers it works correctly.
source code, you can see from the main websiteitself:
http://g.raphaeljs.com/piechart2.html.
Even when i download the code and made it to work, the same problem occurs.
Any one help me with this.
thanks in advance
| 0 |
1,688,962 | 11/06/2009 17:07:23 | 188,276 | 10/12/2009 08:00:55 | 279 | 0 | swap vs page in operating system | what is the difference between these 2 terms in Operating SysteM: swap and page? | operating | system | memory | null | null | 11/08/2009 05:01:33 | off topic | swap vs page in operating system
===
what is the difference between these 2 terms in Operating SysteM: swap and page? | 2 |
11,468,727 | 07/13/2012 10:30:03 | 991,830 | 10/12/2011 16:21:05 | 72 | 0 | Joomla Xmap Implode Error on Sitemap | I am getting the following error on an 'xmap' sitemap plugin used on Joomla v2.5 with the K2 cck on one of my sites as below:
**Warning: implode() [function.implode]: Invalid arguments passed in /home/anctest/public_html/plugins/xmap/com_k2/com_k2.php on line 192**
Its pointing to the following line in the below code:
$query = $baseQuery."catid in (".implode(",", $ids).") order by 1 DESC ";
Code here:
case "categories":
if (!self::$suppressSub)
{
$query = $baseQuery."catid in (".implode(",", $ids).") order by 1 DESC ";
$db->setQuery($query);
$rows = $db->loadObjectList ();
}
else
{
$rows = array();
if (is_array($ids))
{
foreach($ids as $id)
{
$allrows = array();
xmap_com_k2::collectByCat($db, $id, $allrows);
$rows = array_merge($rows, $allrows);
}
}
}
Any ideas?
Thanks | php | joomla | error-message | implode | invalid-argument | null | open | Joomla Xmap Implode Error on Sitemap
===
I am getting the following error on an 'xmap' sitemap plugin used on Joomla v2.5 with the K2 cck on one of my sites as below:
**Warning: implode() [function.implode]: Invalid arguments passed in /home/anctest/public_html/plugins/xmap/com_k2/com_k2.php on line 192**
Its pointing to the following line in the below code:
$query = $baseQuery."catid in (".implode(",", $ids).") order by 1 DESC ";
Code here:
case "categories":
if (!self::$suppressSub)
{
$query = $baseQuery."catid in (".implode(",", $ids).") order by 1 DESC ";
$db->setQuery($query);
$rows = $db->loadObjectList ();
}
else
{
$rows = array();
if (is_array($ids))
{
foreach($ids as $id)
{
$allrows = array();
xmap_com_k2::collectByCat($db, $id, $allrows);
$rows = array_merge($rows, $allrows);
}
}
}
Any ideas?
Thanks | 0 |
426,397 | 01/08/2009 23:00:56 | 38,663 | 11/18/2008 18:18:27 | 46 | 2 | new line implementation in linux | I am trying to parse the linux /etc/passwd file in java. I'm currently reading each line through the scanner class in java and then using string.split() to delimit each line.
The problem is that the line "list:x:38:38:Mailing List Manager:/var/list:/bin/sh" is treated by the scanner as 3 different lines: 1) "list:x:38:38:Mailing" 2) "List" 3) "Manager..." When I type this out into a new file that I didn't get from linux, the Scanner parses it properly.
Is there something I'm not understanding about new lines in linux?
Obviously a work around is to parse it without using scanner, but it wouldn't be elegant. Does anyone know of an elegant way to do it?
Is there a way to convert the file into one that would work with Scanner?
Please let me know.
Thanks,
jbu | new | line | implementation | linux | java | 01/09/2009 05:35:26 | off topic | new line implementation in linux
===
I am trying to parse the linux /etc/passwd file in java. I'm currently reading each line through the scanner class in java and then using string.split() to delimit each line.
The problem is that the line "list:x:38:38:Mailing List Manager:/var/list:/bin/sh" is treated by the scanner as 3 different lines: 1) "list:x:38:38:Mailing" 2) "List" 3) "Manager..." When I type this out into a new file that I didn't get from linux, the Scanner parses it properly.
Is there something I'm not understanding about new lines in linux?
Obviously a work around is to parse it without using scanner, but it wouldn't be elegant. Does anyone know of an elegant way to do it?
Is there a way to convert the file into one that would work with Scanner?
Please let me know.
Thanks,
jbu | 2 |
11,171,353 | 06/23/2012 17:00:37 | 1,108,083 | 12/20/2011 14:54:00 | 12 | 0 | Adsense - Add subaccounts to accounts - Java | We have google adsense V1 implemented as part of the java code.Now we have sub accounts and we are to implement using V1.1 the existing system that is present in V1 maintaining the hierarchy.
Kindly let know on how this can be implemented.
Please send a sample java code for the credentials code to add subaccounts to accounts.
Present system we specify all the accounts and subaccounts without any hierarchy.
Thanks in Advance | java | api | adsense | adsense-for-search | null | 06/24/2012 00:20:40 | not a real question | Adsense - Add subaccounts to accounts - Java
===
We have google adsense V1 implemented as part of the java code.Now we have sub accounts and we are to implement using V1.1 the existing system that is present in V1 maintaining the hierarchy.
Kindly let know on how this can be implemented.
Please send a sample java code for the credentials code to add subaccounts to accounts.
Present system we specify all the accounts and subaccounts without any hierarchy.
Thanks in Advance | 1 |
3,246,940 | 07/14/2010 14:07:43 | 373,138 | 06/22/2010 12:09:58 | 15 | 0 | Do you need to display an EULA when using Flurry/Google Analytics? | i hear different things from different people on that topic and nobody is really sure. Also a quick google search doesn't reveal anything informative.
The question is: when using Flurry Analytics (or Google Analytics or whatever analytics tool) in an Android App. Do i need to inform the users in form an EULA or something similar that is shown on first app start and has to be accepted?
The stats collected are completely anonymous, so most people say you don't have to show an EULA. But what's the truth now?
Greets, Goddchen | android | google-analytics | analytics | flurry | null | 09/04/2011 20:10:21 | not constructive | Do you need to display an EULA when using Flurry/Google Analytics?
===
i hear different things from different people on that topic and nobody is really sure. Also a quick google search doesn't reveal anything informative.
The question is: when using Flurry Analytics (or Google Analytics or whatever analytics tool) in an Android App. Do i need to inform the users in form an EULA or something similar that is shown on first app start and has to be accepted?
The stats collected are completely anonymous, so most people say you don't have to show an EULA. But what's the truth now?
Greets, Goddchen | 4 |
11,561,500 | 07/19/2012 13:04:47 | 844,182 | 07/14/2011 09:01:30 | 20 | 0 | linux command nice works on any shell script? | does nice work on any shell script? or does it work on basic linux commands only?<br/>
for example, if I have a custom shell script that contains sort function, and I call
<pre>
nice myscript.sh
</pre>
would the nice scheduling priority apply to sort in the script?
would nice still work if myscript is running in the background(using & or nohup?)
thanks!
| linux | shell | nice | null | null | 07/20/2012 11:37:00 | off topic | linux command nice works on any shell script?
===
does nice work on any shell script? or does it work on basic linux commands only?<br/>
for example, if I have a custom shell script that contains sort function, and I call
<pre>
nice myscript.sh
</pre>
would the nice scheduling priority apply to sort in the script?
would nice still work if myscript is running in the background(using & or nohup?)
thanks!
| 2 |
4,436,110 | 12/14/2010 05:13:55 | 47,630 | 12/19/2008 03:01:01 | 3,549 | 92 | How can I use variable names other than $it$ in a StringTemplate partial? | How can I use variable names other than $it$ in a StringTemplate partial? | stringtemplate | null | null | null | null | null | open | How can I use variable names other than $it$ in a StringTemplate partial?
===
How can I use variable names other than $it$ in a StringTemplate partial? | 0 |
4,219,093 | 11/18/2010 20:11:03 | 48,735 | 12/23/2008 19:55:04 | 146 | 10 | Determine target service/method from CXF Interceptor | I'd like to write an interceptor for Apache CXF that inspects the target service/method for a particular annotation and does some special processing for that annotation.
I can't seem to find anything in the interceptor documentation that describes how to do this. Does anyone have any ideas?
Thanks! | java | cxf | apache-cxf | null | null | null | open | Determine target service/method from CXF Interceptor
===
I'd like to write an interceptor for Apache CXF that inspects the target service/method for a particular annotation and does some special processing for that annotation.
I can't seem to find anything in the interceptor documentation that describes how to do this. Does anyone have any ideas?
Thanks! | 0 |
10,418,570 | 05/02/2012 17:16:48 | 1,370,522 | 05/02/2012 16:21:31 | 1 | 0 | How to replace? | <pre>
How to replace using javascript regexp?
www.exemple.com
main.testsite.com
www.ex-emple.com.ar
main.test-site.co.uk
en.tour.mysite.nl
www.ip.com
www.one.lv
the result of replacing:
exemple.com
testsite.com
ex-emple.com.ar
test-site.co.uk
mysite.nl
ip.com
one.lv
other domains:
.ac
.ad
.ae
.af
.ag
.ai
.al
.am
.ao
.aq
.ar
.as
.asia
.at
.au
.aw
.ax
.az
.ba
.bb
.bd
.be
.bf
.bg
.bh
.bi
.bj
.bm
.bn
.bo
.br
.bs
.bt
.bw
.by
.bz
.ca
.cc
.cd
.cf
.cg
.ch
.ci
.ck
.cl
.cm
.cn
.co
.co.ao
.co.ba
.co.bw
.co.cc
.co.ck
.co.cr
.co.fk
.co.id
.co.il
.co.im
.co.in
.co.jp
.co.ke
.co.kr
.co.ls
.co.ma
.co.mz
.co.nl
.co.nz
.co.th
.co.tz
.co.ug
.co.uk
.co.uz
.co.ve
.co.vi
.co.za
.co.zm
.co.zw
.com
.com.af
.com.ag
.com.ai
.com.al
.com.ar
.com.au
.com.aw
.com.az
.com.bb
.com.bd
.com.bh
.com.bi
.com.bm
.com.bn
.com.bo
.com.br
.com.bs
.com.bt
.com.by
.com.bz
.com.cm
.com.cn
.com.co
.com.cu
.com.cv
.com.cy
.com.do
.com.dz
.com.ec
.com.ee
.com.eg
.com.es
.com.et
.com.fj
.com.ge
.com.gh
.com.gi
.com.gl
.com.gn
.com.gp
.com.gr
.com.gt
.com.gu
.com.hk
.com.hn
.com.hr
.com.ht
.com.jm
.com.jo
.com.kg
.com.kh
.com.ki
.com.kw
.com.ky
.com.kz
.com.lb
.com.lc
.com.lk
.com.lr
.com.lv
.com.ly
.com.mg
.com.mk
.com.mm
.com.mo
.com.mt
.com.mu
.com.mv
.com.mw
.com.mx
.com.my
.com.na
.com.nf
.com.ng
.com.ni
.com.np
.com.nr
.com.om
.com.pa
.com.pe
.com.pg
.com.ph
.com.pk
.com.pl
.com.pr
.com.ps
.com.pt
.com.py
.com.qa
.com.ro
.com.sa
.com.sb
.com.sc
.com.sg
.com.sl
.com.sn
.com.sv
.com.sy
.com.tj
.com.tn
.com.tr
.com.tt
.com.tw
.com.ua
.com.uy
.com.uz
.com.vc
.com.ve
.com.vi
.com.vn
.com.ye
.cr
.cv
.cx
.cy
.cz
.de
.dj
.dk
.dm
.do
.dz
.ec
.edu
.ee
.eg
.es
.eu
.fi
.fj
.fk
.fm
.fo
.fr
.ga
.gd
.ge
.gf
.gg
.gh
.gi
.gl
.gm
.gn
.gov
.gp
.gq
.gr
.gs
.gt
.gu
.gy
.hk
.hm
.hn
.hr
.ht
.hu
.id
.ie
.il
.im
.in
.io
.iq
.is
.it
.je
.jm
.jo
.jp
.ke
.kg
.kh
.ki
.km
.kn
.kr
.kw
.ky
.kz
.la
.lb
.lc
.li
.lk
.lr
.ls
.lt
.lu
.lv
.ly
.ma
.mc
.md
.me
.mg
.mil
.mk
.ml
.mm
.mn
.mo
.mobi
.mp
.mq
.mr
.ms
.mt
.mu
.mv
.mw
.mx
.my
.na
.name
.nc
.ne
.ne.jp
.net
.net.ck
.net.cm
.net.in
.nf
.ng
.ni
.nl
.no
.np
.nr
.nu
.nz
.og.ao
.om
.or.th
.org
.org.ck
.org.cn
.org.ls
.pa
.pe
.pf
.pg
.ph
.pk
.pl
.pm
.pn
.pr
.pro
.ps
.pt
.py
.qa
.re
.ro
.rs
.ru
.rw
.sa
.sb
.sc
.se
.sg
.sh
.si
.sk
.sl
.sm
.sn
.so
.sr
.st
.su
.sv
.sy
.tc
.td
.tf
.tg
.th
.tj
.tk
.tl
.tm
.tn
.to
.tr
.tt
.tv
.tw
.tz
.ua
.ug
.uk
.us
.uy
.uz
.vc
.ve
.vg
.vi
.vn
.vu
.wf
.ws
.xxx
.ye
.yt
.za
.zm
.zw
Thanks!
</pre> | javascript | regex | replace | null | null | 05/02/2012 17:26:50 | not a real question | How to replace?
===
<pre>
How to replace using javascript regexp?
www.exemple.com
main.testsite.com
www.ex-emple.com.ar
main.test-site.co.uk
en.tour.mysite.nl
www.ip.com
www.one.lv
the result of replacing:
exemple.com
testsite.com
ex-emple.com.ar
test-site.co.uk
mysite.nl
ip.com
one.lv
other domains:
.ac
.ad
.ae
.af
.ag
.ai
.al
.am
.ao
.aq
.ar
.as
.asia
.at
.au
.aw
.ax
.az
.ba
.bb
.bd
.be
.bf
.bg
.bh
.bi
.bj
.bm
.bn
.bo
.br
.bs
.bt
.bw
.by
.bz
.ca
.cc
.cd
.cf
.cg
.ch
.ci
.ck
.cl
.cm
.cn
.co
.co.ao
.co.ba
.co.bw
.co.cc
.co.ck
.co.cr
.co.fk
.co.id
.co.il
.co.im
.co.in
.co.jp
.co.ke
.co.kr
.co.ls
.co.ma
.co.mz
.co.nl
.co.nz
.co.th
.co.tz
.co.ug
.co.uk
.co.uz
.co.ve
.co.vi
.co.za
.co.zm
.co.zw
.com
.com.af
.com.ag
.com.ai
.com.al
.com.ar
.com.au
.com.aw
.com.az
.com.bb
.com.bd
.com.bh
.com.bi
.com.bm
.com.bn
.com.bo
.com.br
.com.bs
.com.bt
.com.by
.com.bz
.com.cm
.com.cn
.com.co
.com.cu
.com.cv
.com.cy
.com.do
.com.dz
.com.ec
.com.ee
.com.eg
.com.es
.com.et
.com.fj
.com.ge
.com.gh
.com.gi
.com.gl
.com.gn
.com.gp
.com.gr
.com.gt
.com.gu
.com.hk
.com.hn
.com.hr
.com.ht
.com.jm
.com.jo
.com.kg
.com.kh
.com.ki
.com.kw
.com.ky
.com.kz
.com.lb
.com.lc
.com.lk
.com.lr
.com.lv
.com.ly
.com.mg
.com.mk
.com.mm
.com.mo
.com.mt
.com.mu
.com.mv
.com.mw
.com.mx
.com.my
.com.na
.com.nf
.com.ng
.com.ni
.com.np
.com.nr
.com.om
.com.pa
.com.pe
.com.pg
.com.ph
.com.pk
.com.pl
.com.pr
.com.ps
.com.pt
.com.py
.com.qa
.com.ro
.com.sa
.com.sb
.com.sc
.com.sg
.com.sl
.com.sn
.com.sv
.com.sy
.com.tj
.com.tn
.com.tr
.com.tt
.com.tw
.com.ua
.com.uy
.com.uz
.com.vc
.com.ve
.com.vi
.com.vn
.com.ye
.cr
.cv
.cx
.cy
.cz
.de
.dj
.dk
.dm
.do
.dz
.ec
.edu
.ee
.eg
.es
.eu
.fi
.fj
.fk
.fm
.fo
.fr
.ga
.gd
.ge
.gf
.gg
.gh
.gi
.gl
.gm
.gn
.gov
.gp
.gq
.gr
.gs
.gt
.gu
.gy
.hk
.hm
.hn
.hr
.ht
.hu
.id
.ie
.il
.im
.in
.io
.iq
.is
.it
.je
.jm
.jo
.jp
.ke
.kg
.kh
.ki
.km
.kn
.kr
.kw
.ky
.kz
.la
.lb
.lc
.li
.lk
.lr
.ls
.lt
.lu
.lv
.ly
.ma
.mc
.md
.me
.mg
.mil
.mk
.ml
.mm
.mn
.mo
.mobi
.mp
.mq
.mr
.ms
.mt
.mu
.mv
.mw
.mx
.my
.na
.name
.nc
.ne
.ne.jp
.net
.net.ck
.net.cm
.net.in
.nf
.ng
.ni
.nl
.no
.np
.nr
.nu
.nz
.og.ao
.om
.or.th
.org
.org.ck
.org.cn
.org.ls
.pa
.pe
.pf
.pg
.ph
.pk
.pl
.pm
.pn
.pr
.pro
.ps
.pt
.py
.qa
.re
.ro
.rs
.ru
.rw
.sa
.sb
.sc
.se
.sg
.sh
.si
.sk
.sl
.sm
.sn
.so
.sr
.st
.su
.sv
.sy
.tc
.td
.tf
.tg
.th
.tj
.tk
.tl
.tm
.tn
.to
.tr
.tt
.tv
.tw
.tz
.ua
.ug
.uk
.us
.uy
.uz
.vc
.ve
.vg
.vi
.vn
.vu
.wf
.ws
.xxx
.ye
.yt
.za
.zm
.zw
Thanks!
</pre> | 1 |
8,729,582 | 01/04/2012 15:43:49 | 1,033,812 | 11/07/2011 13:22:23 | 15 | 0 | Change a list view through it's onItemListener | I made an onTouchListener to a list view that checks which item (string in my case) in that list was clicked and it's position. I want to take out that string of the list, so I made a method that gets the array adpter's string array and the poistion the list was touched and returns a new array that is the same but without the string that was touched. now I want to update the list view adapter to the new array.
thanks | java | android | listview | android-arrayadapter | null | null | open | Change a list view through it's onItemListener
===
I made an onTouchListener to a list view that checks which item (string in my case) in that list was clicked and it's position. I want to take out that string of the list, so I made a method that gets the array adpter's string array and the poistion the list was touched and returns a new array that is the same but without the string that was touched. now I want to update the list view adapter to the new array.
thanks | 0 |
9,651,314 | 03/11/2012 00:08:22 | 1,261,397 | 03/10/2012 18:39:33 | 1 | 0 | I think something is wrong with my css in chrome browser | My page is nicely viewable in mozilla and ie, but in chrome text is pushed down. Just the text, not background.
This is my page: <http://www.petricec.pondi.hr/index.html>
I tried to find similar problem here. but couldn't. Also tried many things to change in my CSS but couldn't find out where is the problem.
English is not my first language, so sorry for any misspells(I hate them too). Thanks for any help.
Can't post a image because I am new here.
This is CSS code:
<pre>
/* Reset */
html, body { margin: 0; padding: 0; border: 0;
background: transparent; font-size:10px; }
div, span, article, aside, footer, header, hgroup, nav, section,
h1, h2, h3, h4, h5, h6, p, blockquote, a, ol, ul, li,
table, tr, th, td, tbody, tfoot, thead {
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
background: transparent;
}
img { margin:0; padding:0; border:0; }
table, tr, th, td, tbody, tfoot, thead {
margin: 0; padding: 0; border: 0;
vertical-align: baseline;
background: transparent;
}
table { border-collapse: collapse; border-spacing: 0; }
input, select, textarea, form, fieldset {
margin: 0; padding: 0; border: 0;
}
article, aside, dialog, figure, footer, header, hgroup, nav, section {
display:block; }
h1, h2, h3, h4, h5, h6, p, li, blockquote, td, th, a, caption, em, strong, strike {
font-family: Arial, Helvetica, sans-serif;
font-size:100%;
font-weight: normal;
font-style: normal;
line-height: 100%;
text-indent: 0;
text-decoration: none;
text-align: left;
color: #000;
}
ol, ul { list-style: none; }
/* Global */
html { }
body {background-color:#06C; }
/* Headings */
h1, h2, h3, h4, h5, h6 { color: #000; }
h1 {
font-size:20px;
margin-left:45px;
font-weight:bold;
}
h2 {
font-size:16px;
margin-top: 25px;
margin-left:15px;
font-weight:bold;
line-height: 120%;
}
h3 {
font-size:15px;
margin-left:10px;
margin-right: 5px;
margin-top: 25px;
margin-bottom: 20px;
}
h4 {
font-size:12px;
margin-left: 15px;
margin-top: 20px;
font:Arial, Helvetica, sans-serif;
line-height: 135%; }
h5 { font-size:12px; }
h6 { font-size:12px; }
h1 img, h2 img, h3 img, h4 img, h5 img, h6 img { margin: 0; }
/* Text Elements */
p { color:#000; font-size:12px; line-height:150%; }
p .left { margin: 1.5em 1.5em 1.5em 0; padding: 0; }
p .right { margin: 1.5em 0 1.5em 1.5em; padding: 0; }
a { }
a:link {
color: #000;
}
a:visited {
color: #000;
}
a:active { color: #000; }
a:focus { color: #666; }
a:hover { color: #f00; }
blockquote { color:#000; font-size:12px; }
strong { font-weight: bold; }
em { font-style: italic; }
/* Images */
/* Lists */
ul { }
ol { list-style-type:decimal; }
ul li { color:#000; font-size:12px; }
ol li { color:#000; font-size:12px; }
dl { }
dt { }
dd { }
/* Tables */
table { width:100%; }
tr { }
.odd { background-color:#eee; }
.even { background-color:#fff; }
th { font-weight: bold; }
thead, th { background: #ccc; }
tbody { }
th,td,caption { }
caption { }
tfoot { }
.tfooter { background-color:#ccc; text-align:center; font-style:italic; }
caption { background: #efefef; }
/* Miscellaneous */
sup, sub { line-height: 0; }
abbr, acronym { border-bottom: 1px dotted #666; }
address { }
del { background:#FFCECE; color:#f00; }
code, pre { background-color:#FF9; padding:2px 0px; margin:4px 25px;
font-family:"Courier New", Courier, monospace; font-size:12px; font-weight:normal; line-height:150%; }
/* Containers */
#wrapper {
width:960px;
margin:0 auto;
background-color:#CCC;
}
#wrapper-outer {
width:1000px;
margin:0 auto;
background-color:#CCC;
}
#banner {
margin-left: 15px;
}
#logo {
margin:30px 0px;
float:left;
margin-left: 30px;
}
#topnav {
margin-top:30px;
background-image: url(../images/navi_bg.png);
background-repeat: repeat;
height: 55px;
}
#topnav ul {
padding:20px;
}
#topnav ul li {
display:inline;
font-size:16px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
margin-left: 20px;
}
#topnav ul li a {
padding: 0 20px;
font-weight: bold;
}
#topnav a:link {
color: #000;
font-weight:bold;
}
#topnav a:visited {
color: #000;
}
#topnav a:active {
color: #00F;
}
#topnav a:focus { color: #666; }
#pocetna_vijesti a:hover{
background-image: url(../images/menu_over_vijesti.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_sport a:hover{
background-image: url(../images/menu_over_sport.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_scena a:hover{
background-image: url(../images/menu_over_scena.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_kolumne a:hover{
background-image:url(../images/menu_over_kolumne.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_vrijeme a:hover{
background-image: url(../images/menu_over_vrijeme.png);
background-repeat: no-repeat;
background-position: bottom;
}
#content-wrapper {
clear:both;
width: 961px;
height:auto;
}
#leftside {
width: 664px;
float:left;
height: auto;
position: relative;
}
#rightside {
width:268px;
float:right;
height: auto;
position: relative;
}
#vijesti {
background-image: url(../images/content/vijesti_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 664px;
position: relative;
}
.box_nav {
padding-top: 5px;
position: relative;
}
#box_left1 {
width: 330px;
height:350px;
float:left;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #666;
margin-top: 5px;
position: relative;
}
#box_left2 {
width: 330px;
height:350px;
float:left;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #666;
margin-top: 5px;
position: relative;
}
#box_left3 {
width: 330px;
height:350px;
float:left;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #666;
margin-top: 5px;
position: relative;
}
.text_box {
width: 332px;
height:auto;
float:right;
margin-top: 40px;
position: relative;
}
.text_box ul li {
border-bottom-width: 1px;
border-bottom-style: dashed;
border-bottom-color: #666;
position: relative;
}
#sport {
background-image:url(../images/content/sport_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 664px;
margin-top: 10px;
}
#scena {
background-image:url(../images/content/scena_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 664px;
margin-top: 10px;
}
#vrijeme {
background-image:url(../images/content/vrijeme_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 268px;
margin-bottom: 12px;
padding-top: 7px;
}
#vrijeme a h1 {
margin-left: 35px;
}
#kolumne {
background-image:url(../images/content/kolumne_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 268px;
padding-top: 3px;
}
#kolumne a h1 {
margin-left: 30px;
}
#kolumne_box {
float: left;
height: auto;
width: 67px;
margin-left: 20px;
margin-top: 30px;
margin-right: 40px;
}
#kolumne ul li {
list-style-type: none;
margin-bottom: 50px;
margin-top: 25px;
height: auto;
}
#kolumne ul li a{
font-family: Arial, Helvetica, sans-serif;
text-decoration: none;
font-size: 15px;
color: #000;
}
#fb-live-stream{
float: left;
height:390;
width:267;
margin-top:90px;
}
.img {
border: 1px solid #000;
margin-bottom: 15px;
}
#box_right {
margin-top: 50px;
}
#box_right_img {
margin: 15px 0px 0px 35px;
}
#box_right_text h4 {
margin-top: -15px;
}
#box_left_img1 {
margin-left: 30px;
margin-top: 15px;
width:215px;
height:162px;
border: thin solid #000;
}
#box_left_img2 {
margin-left: 20px;
margin-top: 15px;
width:250px;
height:179px;
border: thin solid #000;
}
#box_left_img3 {
margin-left: 30px;
margin-top: 15px;
width:215px;
height:162px;
border: thin solid #000;
}
#clear {
clear: both;
}
#footer {
margin-top: 20px;
clear:both;
background-image:url(../images/content/footer_bg.png);
height: 54px;
width: 995px;
background-repeat: no-repeat;
}
#footer_text1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
text-decoration: none;
height: auto;
width: 200px;
position: absolute;
margin-top: 10px;
margin-left: 15px;
}
#footer_text3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
text-decoration: underline;
height: auto;
width: 70px;
position: absolute;
margin-top: 20px;
margin-left: 430px;
}
#footer_text2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
text-decoration: none;
height: auto;
width: 160px;
position: absolute;
margin-top: 20px;
margin-left: 790px;
}
/*Layout Extra
Navigation Extra */
Forms
form ol { list-style-type:none; }
form { text-align:left; margin:20px; }
label {
float: left; width: 150px; margin-top:5px;
text-align:right; display:block; background:none; font-weight:bold;
}
submit { background:none; }
input {
width: 280px; margin:0 0 16px 10px;
border:1px #bbb solid; padding:5px; background:none;
}
input:focus, textarea:focus { background-color:#BFEBFF; }
textarea {
width: 280px; height: 150px; margin:0 0 16px 10px;
border:1px #bbb solid; padding:5px; background:none;
}
select { margin-bottom:20px; }
.month { margin-left:155px; }
.submit {
width:90px; height:25px;
margin-left:160px;
font-size:12px;
}
br { clear: left; }
.clear { clear:both; }
Miscellaneous
.copyright-text { font-size:80%; font-style:italic; color:#333; }
.footer-text { font-size:80%; font-style:normal; color:#666; }
.title { font-size:18px; font-weight:bold; color:#333; }
.subtitle { font-size:14px; font-style:italic; color:#333; }
.artist { font-size:16px; font-weight:bold; color:#333; }
.author { font-size:14px font-weight:bold; color:#555; }
.editor { font-size:14px font-style:italic; color:#555; }
.pub-date { font-size:10px font-style:italic; color:#555; }
.article-date { font-size:10px font-style:italic; color:#555; }
.location { font-size:10px font-style:italic; color:#555; }
.float-right { float:right; }
.float-left { float:left; }
.clear { clear:both; }
.hide { display:none; }
.block { display:block; }
.inline { display:inline; }
.first { font-weight:bold; }
.last { font-weight:bold; }
.left { font-weight:bold; text-align:left; }
.right { font-weight:bold; text-align:right; }
.added { background:#D7D7FF; }
.removed { background:#FFCECE; color:#f00; }
.changed { background:#FFB; }
/*Success, info, notice and error/alert boxes - from Blueprint CSS Framework */
.error, .alert, .notice, .success, .info {
padding: 0.8em; margin-bottom: 1em; border: 2px solid #ddd; }
.error, .alert { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; }
.notice { background: #fff6bf; color: #514721; border-color: #ffd324; }
.success { background: #e6efc2; color: #264409; border-color: #c6d880; }
.info { background: #d5edf8; color: #205791; border-color: #92cae4; }
.error a { color: #8a1f11; }
.alert a { color: #8a1f11; }
.notice a { color: #514721; }
.success a { color: #264409; }
.info a { color: #205791; }
</pre>
Thanks. | css | google-chrome | null | null | null | 03/11/2012 14:56:30 | too localized | I think something is wrong with my css in chrome browser
===
My page is nicely viewable in mozilla and ie, but in chrome text is pushed down. Just the text, not background.
This is my page: <http://www.petricec.pondi.hr/index.html>
I tried to find similar problem here. but couldn't. Also tried many things to change in my CSS but couldn't find out where is the problem.
English is not my first language, so sorry for any misspells(I hate them too). Thanks for any help.
Can't post a image because I am new here.
This is CSS code:
<pre>
/* Reset */
html, body { margin: 0; padding: 0; border: 0;
background: transparent; font-size:10px; }
div, span, article, aside, footer, header, hgroup, nav, section,
h1, h2, h3, h4, h5, h6, p, blockquote, a, ol, ul, li,
table, tr, th, td, tbody, tfoot, thead {
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
background: transparent;
}
img { margin:0; padding:0; border:0; }
table, tr, th, td, tbody, tfoot, thead {
margin: 0; padding: 0; border: 0;
vertical-align: baseline;
background: transparent;
}
table { border-collapse: collapse; border-spacing: 0; }
input, select, textarea, form, fieldset {
margin: 0; padding: 0; border: 0;
}
article, aside, dialog, figure, footer, header, hgroup, nav, section {
display:block; }
h1, h2, h3, h4, h5, h6, p, li, blockquote, td, th, a, caption, em, strong, strike {
font-family: Arial, Helvetica, sans-serif;
font-size:100%;
font-weight: normal;
font-style: normal;
line-height: 100%;
text-indent: 0;
text-decoration: none;
text-align: left;
color: #000;
}
ol, ul { list-style: none; }
/* Global */
html { }
body {background-color:#06C; }
/* Headings */
h1, h2, h3, h4, h5, h6 { color: #000; }
h1 {
font-size:20px;
margin-left:45px;
font-weight:bold;
}
h2 {
font-size:16px;
margin-top: 25px;
margin-left:15px;
font-weight:bold;
line-height: 120%;
}
h3 {
font-size:15px;
margin-left:10px;
margin-right: 5px;
margin-top: 25px;
margin-bottom: 20px;
}
h4 {
font-size:12px;
margin-left: 15px;
margin-top: 20px;
font:Arial, Helvetica, sans-serif;
line-height: 135%; }
h5 { font-size:12px; }
h6 { font-size:12px; }
h1 img, h2 img, h3 img, h4 img, h5 img, h6 img { margin: 0; }
/* Text Elements */
p { color:#000; font-size:12px; line-height:150%; }
p .left { margin: 1.5em 1.5em 1.5em 0; padding: 0; }
p .right { margin: 1.5em 0 1.5em 1.5em; padding: 0; }
a { }
a:link {
color: #000;
}
a:visited {
color: #000;
}
a:active { color: #000; }
a:focus { color: #666; }
a:hover { color: #f00; }
blockquote { color:#000; font-size:12px; }
strong { font-weight: bold; }
em { font-style: italic; }
/* Images */
/* Lists */
ul { }
ol { list-style-type:decimal; }
ul li { color:#000; font-size:12px; }
ol li { color:#000; font-size:12px; }
dl { }
dt { }
dd { }
/* Tables */
table { width:100%; }
tr { }
.odd { background-color:#eee; }
.even { background-color:#fff; }
th { font-weight: bold; }
thead, th { background: #ccc; }
tbody { }
th,td,caption { }
caption { }
tfoot { }
.tfooter { background-color:#ccc; text-align:center; font-style:italic; }
caption { background: #efefef; }
/* Miscellaneous */
sup, sub { line-height: 0; }
abbr, acronym { border-bottom: 1px dotted #666; }
address { }
del { background:#FFCECE; color:#f00; }
code, pre { background-color:#FF9; padding:2px 0px; margin:4px 25px;
font-family:"Courier New", Courier, monospace; font-size:12px; font-weight:normal; line-height:150%; }
/* Containers */
#wrapper {
width:960px;
margin:0 auto;
background-color:#CCC;
}
#wrapper-outer {
width:1000px;
margin:0 auto;
background-color:#CCC;
}
#banner {
margin-left: 15px;
}
#logo {
margin:30px 0px;
float:left;
margin-left: 30px;
}
#topnav {
margin-top:30px;
background-image: url(../images/navi_bg.png);
background-repeat: repeat;
height: 55px;
}
#topnav ul {
padding:20px;
}
#topnav ul li {
display:inline;
font-size:16px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
margin-left: 20px;
}
#topnav ul li a {
padding: 0 20px;
font-weight: bold;
}
#topnav a:link {
color: #000;
font-weight:bold;
}
#topnav a:visited {
color: #000;
}
#topnav a:active {
color: #00F;
}
#topnav a:focus { color: #666; }
#pocetna_vijesti a:hover{
background-image: url(../images/menu_over_vijesti.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_sport a:hover{
background-image: url(../images/menu_over_sport.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_scena a:hover{
background-image: url(../images/menu_over_scena.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_kolumne a:hover{
background-image:url(../images/menu_over_kolumne.png);
background-repeat: no-repeat;
background-position: bottom;
}
#pocetna_vrijeme a:hover{
background-image: url(../images/menu_over_vrijeme.png);
background-repeat: no-repeat;
background-position: bottom;
}
#content-wrapper {
clear:both;
width: 961px;
height:auto;
}
#leftside {
width: 664px;
float:left;
height: auto;
position: relative;
}
#rightside {
width:268px;
float:right;
height: auto;
position: relative;
}
#vijesti {
background-image: url(../images/content/vijesti_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 664px;
position: relative;
}
.box_nav {
padding-top: 5px;
position: relative;
}
#box_left1 {
width: 330px;
height:350px;
float:left;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #666;
margin-top: 5px;
position: relative;
}
#box_left2 {
width: 330px;
height:350px;
float:left;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #666;
margin-top: 5px;
position: relative;
}
#box_left3 {
width: 330px;
height:350px;
float:left;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #666;
margin-top: 5px;
position: relative;
}
.text_box {
width: 332px;
height:auto;
float:right;
margin-top: 40px;
position: relative;
}
.text_box ul li {
border-bottom-width: 1px;
border-bottom-style: dashed;
border-bottom-color: #666;
position: relative;
}
#sport {
background-image:url(../images/content/sport_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 664px;
margin-top: 10px;
}
#scena {
background-image:url(../images/content/scena_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 664px;
margin-top: 10px;
}
#vrijeme {
background-image:url(../images/content/vrijeme_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 268px;
margin-bottom: 12px;
padding-top: 7px;
}
#vrijeme a h1 {
margin-left: 35px;
}
#kolumne {
background-image:url(../images/content/kolumne_bg.png);
background-repeat: no-repeat;
height: 390px;
width: 268px;
padding-top: 3px;
}
#kolumne a h1 {
margin-left: 30px;
}
#kolumne_box {
float: left;
height: auto;
width: 67px;
margin-left: 20px;
margin-top: 30px;
margin-right: 40px;
}
#kolumne ul li {
list-style-type: none;
margin-bottom: 50px;
margin-top: 25px;
height: auto;
}
#kolumne ul li a{
font-family: Arial, Helvetica, sans-serif;
text-decoration: none;
font-size: 15px;
color: #000;
}
#fb-live-stream{
float: left;
height:390;
width:267;
margin-top:90px;
}
.img {
border: 1px solid #000;
margin-bottom: 15px;
}
#box_right {
margin-top: 50px;
}
#box_right_img {
margin: 15px 0px 0px 35px;
}
#box_right_text h4 {
margin-top: -15px;
}
#box_left_img1 {
margin-left: 30px;
margin-top: 15px;
width:215px;
height:162px;
border: thin solid #000;
}
#box_left_img2 {
margin-left: 20px;
margin-top: 15px;
width:250px;
height:179px;
border: thin solid #000;
}
#box_left_img3 {
margin-left: 30px;
margin-top: 15px;
width:215px;
height:162px;
border: thin solid #000;
}
#clear {
clear: both;
}
#footer {
margin-top: 20px;
clear:both;
background-image:url(../images/content/footer_bg.png);
height: 54px;
width: 995px;
background-repeat: no-repeat;
}
#footer_text1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
text-decoration: none;
height: auto;
width: 200px;
position: absolute;
margin-top: 10px;
margin-left: 15px;
}
#footer_text3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
text-decoration: underline;
height: auto;
width: 70px;
position: absolute;
margin-top: 20px;
margin-left: 430px;
}
#footer_text2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
text-decoration: none;
height: auto;
width: 160px;
position: absolute;
margin-top: 20px;
margin-left: 790px;
}
/*Layout Extra
Navigation Extra */
Forms
form ol { list-style-type:none; }
form { text-align:left; margin:20px; }
label {
float: left; width: 150px; margin-top:5px;
text-align:right; display:block; background:none; font-weight:bold;
}
submit { background:none; }
input {
width: 280px; margin:0 0 16px 10px;
border:1px #bbb solid; padding:5px; background:none;
}
input:focus, textarea:focus { background-color:#BFEBFF; }
textarea {
width: 280px; height: 150px; margin:0 0 16px 10px;
border:1px #bbb solid; padding:5px; background:none;
}
select { margin-bottom:20px; }
.month { margin-left:155px; }
.submit {
width:90px; height:25px;
margin-left:160px;
font-size:12px;
}
br { clear: left; }
.clear { clear:both; }
Miscellaneous
.copyright-text { font-size:80%; font-style:italic; color:#333; }
.footer-text { font-size:80%; font-style:normal; color:#666; }
.title { font-size:18px; font-weight:bold; color:#333; }
.subtitle { font-size:14px; font-style:italic; color:#333; }
.artist { font-size:16px; font-weight:bold; color:#333; }
.author { font-size:14px font-weight:bold; color:#555; }
.editor { font-size:14px font-style:italic; color:#555; }
.pub-date { font-size:10px font-style:italic; color:#555; }
.article-date { font-size:10px font-style:italic; color:#555; }
.location { font-size:10px font-style:italic; color:#555; }
.float-right { float:right; }
.float-left { float:left; }
.clear { clear:both; }
.hide { display:none; }
.block { display:block; }
.inline { display:inline; }
.first { font-weight:bold; }
.last { font-weight:bold; }
.left { font-weight:bold; text-align:left; }
.right { font-weight:bold; text-align:right; }
.added { background:#D7D7FF; }
.removed { background:#FFCECE; color:#f00; }
.changed { background:#FFB; }
/*Success, info, notice and error/alert boxes - from Blueprint CSS Framework */
.error, .alert, .notice, .success, .info {
padding: 0.8em; margin-bottom: 1em; border: 2px solid #ddd; }
.error, .alert { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; }
.notice { background: #fff6bf; color: #514721; border-color: #ffd324; }
.success { background: #e6efc2; color: #264409; border-color: #c6d880; }
.info { background: #d5edf8; color: #205791; border-color: #92cae4; }
.error a { color: #8a1f11; }
.alert a { color: #8a1f11; }
.notice a { color: #514721; }
.success a { color: #264409; }
.info a { color: #205791; }
</pre>
Thanks. | 3 |
4,727,599 | 01/18/2011 18:23:21 | 566,450 | 01/07/2011 05:22:05 | 1 | 0 | addition of items in a listbox | Bellow pls find the code in VB 2008. I must sum up the numbers in the xlistscorebox
Dim tot As Integer
Dim scoresentered As Integer
For index As Integer = 0 To Me.xListscoreBox.SelectedItems.Count - 1
tot = tot + Val(Me.xListscoreBox.SelectedItems.Count)
For se As Integer = 0 To Me.xListscoreBox.SelectedItems.Count - 1
scoresentered = Me.xListscoreBox.SelectedItems.Count
Next
Next
Me.xscoreave.Text = tot / scoresentered.ToString
Me.xtotalscoreTextBox.Text = tot.ToString
Me.xtotscoreentered.Text = scoresentered.ToString
The issue is that the calculation is giving wrong results.
Any comment will be highly appreciate.
Cecilia | vb | null | null | null | null | null | open | addition of items in a listbox
===
Bellow pls find the code in VB 2008. I must sum up the numbers in the xlistscorebox
Dim tot As Integer
Dim scoresentered As Integer
For index As Integer = 0 To Me.xListscoreBox.SelectedItems.Count - 1
tot = tot + Val(Me.xListscoreBox.SelectedItems.Count)
For se As Integer = 0 To Me.xListscoreBox.SelectedItems.Count - 1
scoresentered = Me.xListscoreBox.SelectedItems.Count
Next
Next
Me.xscoreave.Text = tot / scoresentered.ToString
Me.xtotalscoreTextBox.Text = tot.ToString
Me.xtotscoreentered.Text = scoresentered.ToString
The issue is that the calculation is giving wrong results.
Any comment will be highly appreciate.
Cecilia | 0 |
8,124,839 | 11/14/2011 16:36:55 | 978,995 | 10/04/2011 17:34:19 | 1 | 0 | Size of Program Counter | What would be the size of Program Counter in terms of bits ? Is the size always fixed in all types of system architectures ? | assembly | null | null | null | null | null | open | Size of Program Counter
===
What would be the size of Program Counter in terms of bits ? Is the size always fixed in all types of system architectures ? | 0 |
8,743,892 | 01/05/2012 14:12:18 | 348,851 | 05/24/2010 10:36:13 | 126 | 1 | How to hyperlink a css box | What I want is, a css box which is hyperlinked, so that if anyone clicks on that box s/he will go to that specified link! | html | css | null | null | null | 01/05/2012 23:24:23 | not a real question | How to hyperlink a css box
===
What I want is, a css box which is hyperlinked, so that if anyone clicks on that box s/he will go to that specified link! | 1 |
7,128,663 | 08/20/2011 00:17:14 | 903,282 | 08/20/2011 00:17:14 | 1 | 0 | Upload a file to website? | Hey guys i was just wondering, how do you use PHP to upload a file directly to your website?
for example:
Person uses a browse button to look for file to upload, then once selected file directory comes up in a textbox and when they click and "upload" button it uploads to a directory on the website named "uploads".
Could someone tell me how to do this and maybe explain a little about or link me to a resource which will help me?
Thanks. | php | upload | system | null | null | null | open | Upload a file to website?
===
Hey guys i was just wondering, how do you use PHP to upload a file directly to your website?
for example:
Person uses a browse button to look for file to upload, then once selected file directory comes up in a textbox and when they click and "upload" button it uploads to a directory on the website named "uploads".
Could someone tell me how to do this and maybe explain a little about or link me to a resource which will help me?
Thanks. | 0 |
7,966,074 | 11/01/2011 12:00:35 | 898,552 | 08/17/2011 11:52:43 | 6 | 0 | Is there a good howto for getting MIUI styled tabs (in tabhost) in Android | Is there a good tutorial how to get the "look and feel" of MIUI styled Tabs in AOSP Android? | android | android-layout | android-tabhost | null | null | 11/02/2011 18:22:54 | not constructive | Is there a good howto for getting MIUI styled tabs (in tabhost) in Android
===
Is there a good tutorial how to get the "look and feel" of MIUI styled Tabs in AOSP Android? | 4 |
10,506,710 | 05/08/2012 21:22:10 | 1,195,066 | 02/07/2012 15:52:34 | 19 | 0 | Run app in iOS Simulator using web service through a network with proxy | I need test a iPhone app in the iOS simulator that use a web service. The problem is that I used a local proxy to access internet. This application runs correctly without the proxy in other network.
I use for this app iOS 5 SDK and Xcode 4.2. | ios | xcode | web-services | proxy | ios-simulator | 05/09/2012 12:09:32 | not a real question | Run app in iOS Simulator using web service through a network with proxy
===
I need test a iPhone app in the iOS simulator that use a web service. The problem is that I used a local proxy to access internet. This application runs correctly without the proxy in other network.
I use for this app iOS 5 SDK and Xcode 4.2. | 1 |
8,938,535 | 01/20/2012 08:22:46 | 1,157,952 | 01/19/2012 07:50:44 | 11 | 0 | Why firebug shows some javascript objects in red color? | I am trying to learn and improve my javascript skills.
A very helpful tool is firebug, with which i can inspect different javascript objects.
However, i have some questions:
1. Some object names (like jQuery, $, fn etc.) are displayed in red color. Why?
2. Some other objects has a "prototype" property, which is not in bold. What is that and when is good or not to use/implement it?
3. Most of functions are shown as "function()". But there are also some other functions which are displayed, for example, as "u(M)", "z()", "B(E)". Why they are different?
Thank you | javascript | firebug | null | null | null | null | open | Why firebug shows some javascript objects in red color?
===
I am trying to learn and improve my javascript skills.
A very helpful tool is firebug, with which i can inspect different javascript objects.
However, i have some questions:
1. Some object names (like jQuery, $, fn etc.) are displayed in red color. Why?
2. Some other objects has a "prototype" property, which is not in bold. What is that and when is good or not to use/implement it?
3. Most of functions are shown as "function()". But there are also some other functions which are displayed, for example, as "u(M)", "z()", "B(E)". Why they are different?
Thank you | 0 |
9,112,986 | 02/02/2012 13:15:47 | 1,185,190 | 02/02/2012 13:08:13 | 1 | 0 | PHP mod rewrite can't work correctly | Here my .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1 [L]
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+),([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1&names[]=%2 [L]
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+),([0-9a-zA-Z]+),([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1&names[]=%2&names[]=%3 [L]
this 2 strings doesn't work correctly
RewriteCond %{REQUEST_URI} \/gallery/([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) gallery.php?id[]=%1 [L]
When I go to gallery/hgJ56 , I see the content of first 2 strings
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1 [L]
| php | mod-rewrite | null | null | null | 02/03/2012 22:10:29 | off topic | PHP mod rewrite can't work correctly
===
Here my .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1 [L]
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+),([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1&names[]=%2 [L]
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+),([0-9a-zA-Z]+),([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1&names[]=%2&names[]=%3 [L]
this 2 strings doesn't work correctly
RewriteCond %{REQUEST_URI} \/gallery/([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) gallery.php?id[]=%1 [L]
When I go to gallery/hgJ56 , I see the content of first 2 strings
RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+)$ [NC]
RewriteRule ^(.*) image.php?names[]=%1 [L]
| 2 |
212,481 | 10/17/2008 14:51:23 | 28,950 | 10/17/2008 14:40:38 | 1 | 0 | How do I get output to show up in the Messages pane of the Error List for Visual Studio 2005? | I have a header file like this:
#ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
#define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
#ifdef _DEBUG
// macros for turning a number into a string
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#ifdef TRIAGE_MESG_AS_WARNING
#define TRIAGE_TODO_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE TO-DO: " STRING(description) ))
#define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE FIXTHIS: " STRING(description) ))
#else
#define TRIAGE_TODO_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE TO-DO: " STRING(description) ))
#define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE FIXTHIS: " STRING(description) ))
#endif
#else
#define TRIAGE_TODO_TAG(description)
#define TRIAGE_FIXTHIS_TAG(description)
#endif
#endif // __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
Which outputs notes to the output pane in Visual Studio 2005. When 'TRIAGE_MESG_AS_WARNING' is defined, Visual Studio will harvest these messages and list them as warnings in the Error List. It does this because the text format matches a warning. However, I don't want them to show up as warnings all the time, I would rather they show up in the Messages pane of the Error List.
What do I need to do to get the output to show up in the Messages pane of the Error List? The format I have setup for messages in the above code looks like a message from other output, but does not get harvested in the same way.
Thanks. | visual-studio | c++ | windows | null | null | null | open | How do I get output to show up in the Messages pane of the Error List for Visual Studio 2005?
===
I have a header file like this:
#ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
#define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
#ifdef _DEBUG
// macros for turning a number into a string
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#ifdef TRIAGE_MESG_AS_WARNING
#define TRIAGE_TODO_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE TO-DO: " STRING(description) ))
#define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : warning : TRIAGE FIXTHIS: " STRING(description) ))
#else
#define TRIAGE_TODO_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE TO-DO: " STRING(description) ))
#define TRIAGE_FIXTHIS_TAG(description) __pragma(message(__FILE__"("STRING(__LINE__)") : message : TRIAGE FIXTHIS: " STRING(description) ))
#endif
#else
#define TRIAGE_TODO_TAG(description)
#define TRIAGE_FIXTHIS_TAG(description)
#endif
#endif // __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__
Which outputs notes to the output pane in Visual Studio 2005. When 'TRIAGE_MESG_AS_WARNING' is defined, Visual Studio will harvest these messages and list them as warnings in the Error List. It does this because the text format matches a warning. However, I don't want them to show up as warnings all the time, I would rather they show up in the Messages pane of the Error List.
What do I need to do to get the output to show up in the Messages pane of the Error List? The format I have setup for messages in the above code looks like a message from other output, but does not get harvested in the same way.
Thanks. | 0 |
9,790,284 | 03/20/2012 15:55:50 | 946,789 | 09/15/2011 12:34:12 | 2,051 | 123 | How slow is John Resig's JavaScript Templating Engine? | `with` is so [bad](http://stackoverflow.com/a/1463937/946789) that it is forbidden in ES5 strict mode.
_Function constructor_ is [very slow](http://stackoverflow.com/q/3026089/946789).
Yet,
[John Resig's micro templating][1] is advertised as **light**, uses **both** mentioned bad features of Javascript. (same with another _light_ templating - [underscore's][2], which is a fork of it)
Now a question:
**How seriously should i be concerned about performance impact of using those template engines ?**
[1]: http://ejohn.org/blog/javascript-micro-templating/
[2]: http://documentcloud.github.com/underscore/#template | javascript | templates | underscore.js | null | null | 03/20/2012 16:45:37 | not constructive | How slow is John Resig's JavaScript Templating Engine?
===
`with` is so [bad](http://stackoverflow.com/a/1463937/946789) that it is forbidden in ES5 strict mode.
_Function constructor_ is [very slow](http://stackoverflow.com/q/3026089/946789).
Yet,
[John Resig's micro templating][1] is advertised as **light**, uses **both** mentioned bad features of Javascript. (same with another _light_ templating - [underscore's][2], which is a fork of it)
Now a question:
**How seriously should i be concerned about performance impact of using those template engines ?**
[1]: http://ejohn.org/blog/javascript-micro-templating/
[2]: http://documentcloud.github.com/underscore/#template | 4 |
10,119,471 | 04/12/2012 07:44:35 | 1,300,718 | 03/29/2012 12:15:33 | 11 | 2 | Magento backend - manage products - move qty field in the general tab | I would like to know if there is a way in Magento (1.5) to move the qty field from backend catalog/manage products/inventory tab to catalog/manage products/general tab.
Thank you by advance. | magento | backend | products | stock | null | 04/16/2012 13:59:32 | off topic | Magento backend - manage products - move qty field in the general tab
===
I would like to know if there is a way in Magento (1.5) to move the qty field from backend catalog/manage products/inventory tab to catalog/manage products/general tab.
Thank you by advance. | 2 |
6,966,545 | 08/06/2011 11:38:21 | 478,573 | 10/17/2010 14:54:01 | 1,396 | 30 | What to put into lat/lng db fields if lat/lng are empty? | I have a mysql insert statement that breaks when the system can't get lat/lng for a user.
The sql loos like this:
INSERT INTO users(user_email, first_name , last_name , lat , lng ) values ( 'name'
, 'email' , , );
What should I put into the lat/lng so that it doesn't break the insert statement like this? Should it be nulls? That seems kind of inappropriate to put nulls, no? | mysql | sql | geolocation | null | null | null | open | What to put into lat/lng db fields if lat/lng are empty?
===
I have a mysql insert statement that breaks when the system can't get lat/lng for a user.
The sql loos like this:
INSERT INTO users(user_email, first_name , last_name , lat , lng ) values ( 'name'
, 'email' , , );
What should I put into the lat/lng so that it doesn't break the insert statement like this? Should it be nulls? That seems kind of inappropriate to put nulls, no? | 0 |
11,373,027 | 07/07/2012 07:07:03 | 1,508,381 | 07/07/2012 07:02:29 | 1 | 0 | How to navigate between windows in java? | I am a new comer in java. Currently I am trying to make several small programs. Let me ask you a question: I want to close my present window (Frame) and open a new window when a particular button (say, "Next") is clicked in the present window.
Would you please tell me, how to do it?
Thanks. | java | null | null | null | null | 07/08/2012 13:17:14 | not a real question | How to navigate between windows in java?
===
I am a new comer in java. Currently I am trying to make several small programs. Let me ask you a question: I want to close my present window (Frame) and open a new window when a particular button (say, "Next") is clicked in the present window.
Would you please tell me, how to do it?
Thanks. | 1 |
4,252,441 | 11/23/2010 03:13:58 | 34,400 | 11/04/2008 20:19:20 | 1,002 | 22 | FParsec and a delimiter based syntax | I'm trying to use fparsec to parse a simple todo list language (the data from TaskPaper actually) as a simple parser combinator example. But I've run into a bug I can't seem to puzzle out. I'm new to parser combinators and FParsec seems to rely on me knowing Parsec, but I'm finding the parsec documentation inscrutable.
The rules of the task paper language are simple (I'm ignoring @tags for now)
- Projects end with a ':'
- Tasks are start with '-'
- Any other line of text is a plain text note on either the project or task
So the string "Project 1:\nSome note\nProject 2:" should return from parseFile as [ProjectName("Project 1");NoteText("Some note");ProjectName("Project 2")], but instead, I get [ProjectName("Project 1");ProjectName("Some note\nProject 2")]
Below is my parser code.
open FParsec.Primitives
open FParsec.CharParsers
type ProjectAst = ProjectName of string
| TaskText of string
| NoteText of string
let asString (x:char list) :string =
x
|> List.map (fun y -> y.ToString())
|> String.concat ""
let makeNote x = NoteText(asString x)
let parseProject =
parse { let! s = many (noneOf ":\n\r\c")
do! skipChar ':'
return ProjectName( asString s ) }
let parseTask =
parse { do! skipChar '-'
let! s = many (noneOf "\n\r\c")
return TaskText( asString s) }
let parseNote = many (noneOf "\n\r\c") |>> makeNote
let parseLine = parseTask <|> (attempt parseProject) <|> parseNote
let parseFile = sepBy parseLine (many1 whitespace)
| f# | null | null | null | null | null | open | FParsec and a delimiter based syntax
===
I'm trying to use fparsec to parse a simple todo list language (the data from TaskPaper actually) as a simple parser combinator example. But I've run into a bug I can't seem to puzzle out. I'm new to parser combinators and FParsec seems to rely on me knowing Parsec, but I'm finding the parsec documentation inscrutable.
The rules of the task paper language are simple (I'm ignoring @tags for now)
- Projects end with a ':'
- Tasks are start with '-'
- Any other line of text is a plain text note on either the project or task
So the string "Project 1:\nSome note\nProject 2:" should return from parseFile as [ProjectName("Project 1");NoteText("Some note");ProjectName("Project 2")], but instead, I get [ProjectName("Project 1");ProjectName("Some note\nProject 2")]
Below is my parser code.
open FParsec.Primitives
open FParsec.CharParsers
type ProjectAst = ProjectName of string
| TaskText of string
| NoteText of string
let asString (x:char list) :string =
x
|> List.map (fun y -> y.ToString())
|> String.concat ""
let makeNote x = NoteText(asString x)
let parseProject =
parse { let! s = many (noneOf ":\n\r\c")
do! skipChar ':'
return ProjectName( asString s ) }
let parseTask =
parse { do! skipChar '-'
let! s = many (noneOf "\n\r\c")
return TaskText( asString s) }
let parseNote = many (noneOf "\n\r\c") |>> makeNote
let parseLine = parseTask <|> (attempt parseProject) <|> parseNote
let parseFile = sepBy parseLine (many1 whitespace)
| 0 |
10,647,781 | 05/18/2012 06:29:30 | 519,882 | 11/25/2010 09:03:47 | 1,059 | 4 | Bounding value requirement | Does anyone have any idea what a "bounding value" is?
I haven't found a single definition on the internet and I really don't understand what that could be. I'm really not that much into maths.
I have requirements some thing like as follows which I have to program.
Minimum Retrieve the minimum raw value in the interval with the timestamp of the start of the interval.
Minimum2: Retrieve the minimum value in the interval including the Simple Bounding Values.
How do I program this if I have a data in given interval for example 1 hour?
Thanks!
| math | null | null | null | null | 05/19/2012 01:27:01 | off topic | Bounding value requirement
===
Does anyone have any idea what a "bounding value" is?
I haven't found a single definition on the internet and I really don't understand what that could be. I'm really not that much into maths.
I have requirements some thing like as follows which I have to program.
Minimum Retrieve the minimum raw value in the interval with the timestamp of the start of the interval.
Minimum2: Retrieve the minimum value in the interval including the Simple Bounding Values.
How do I program this if I have a data in given interval for example 1 hour?
Thanks!
| 2 |
6,758,523 | 07/20/2011 07:36:12 | 559,720 | 01/01/2011 09:44:08 | 14 | 1 | How to get hidden data from a website in java | I developing a software in java and I want to get some text from a website. The problem is that it is shown in the browser and hidden when I got though code.
Regards,
Nayef | java | data | null | null | null | 07/22/2011 04:32:09 | not a real question | How to get hidden data from a website in java
===
I developing a software in java and I want to get some text from a website. The problem is that it is shown in the browser and hidden when I got though code.
Regards,
Nayef | 1 |
8,178,217 | 11/18/2011 05:36:46 | 500,595 | 11/08/2010 11:02:16 | 191 | 6 | can i play iTunes song in android device | I am developing an android app for audio file send and receive from iphone,i can't play iTunes music from iPhone.how can i play iTunes music in android,is it possible?please help me friends..
Thanks Friends. | android | null | null | null | null | 11/18/2011 09:01:32 | not a real question | can i play iTunes song in android device
===
I am developing an android app for audio file send and receive from iphone,i can't play iTunes music from iPhone.how can i play iTunes music in android,is it possible?please help me friends..
Thanks Friends. | 1 |
2,729,927 | 04/28/2010 13:42:20 | 220,129 | 11/27/2009 16:11:09 | 242 | 7 | nested ordered ol lists in html | I have a nested ordered list.
<ol>
<li>first</li>
<li>second
<ol>
<li>second nested first element</li>
<li>second nested secondelement</li>
<li>second nested thirdelement</li>
</ol>
</li>
<li>third</li>
<li>fourth</li>
</ol>
Currently the nested elements start back from 1 again, e.g.
1. first
2. second
1. second nested first element
2. second nested second element
3. second nested third element
3. third
4. fourth
What I want is for the second element to be numbered like this:
1. first
2. second
2.1. second nested first element
2.2. second nested second element
2.3. second nested third element
3. third
4. fourth
Is there a way of doing this?
Thanks
| html | html-lists | null | null | null | null | open | nested ordered ol lists in html
===
I have a nested ordered list.
<ol>
<li>first</li>
<li>second
<ol>
<li>second nested first element</li>
<li>second nested secondelement</li>
<li>second nested thirdelement</li>
</ol>
</li>
<li>third</li>
<li>fourth</li>
</ol>
Currently the nested elements start back from 1 again, e.g.
1. first
2. second
1. second nested first element
2. second nested second element
3. second nested third element
3. third
4. fourth
What I want is for the second element to be numbered like this:
1. first
2. second
2.1. second nested first element
2.2. second nested second element
2.3. second nested third element
3. third
4. fourth
Is there a way of doing this?
Thanks
| 0 |
3,824,709 | 09/29/2010 18:29:44 | 173,773 | 09/15/2009 14:58:40 | 175 | 5 | Are questions about video-games valid interview questions (and does anyone actually use them)? | In a recent discussion with a group of like minded software developers, we realized that, amongst other things, we all shared a similar depth of knowledge when it comes to video-games - both in terms of judging quality, and in terms of awareness of the landscape. While we may not agree on our own personal favorites, we were incredibly consistent when it came to knowing of particular games, and being able to identify quality games in a given genre.
Has anyone found it useful to discuss video game experience and knowledge as part of the interview process for a run-of-the-mill (not game related) programming interview? | interview-questions | null | null | null | null | 12/03/2011 05:41:09 | not constructive | Are questions about video-games valid interview questions (and does anyone actually use them)?
===
In a recent discussion with a group of like minded software developers, we realized that, amongst other things, we all shared a similar depth of knowledge when it comes to video-games - both in terms of judging quality, and in terms of awareness of the landscape. While we may not agree on our own personal favorites, we were incredibly consistent when it came to knowing of particular games, and being able to identify quality games in a given genre.
Has anyone found it useful to discuss video game experience and knowledge as part of the interview process for a run-of-the-mill (not game related) programming interview? | 4 |
9,763,346 | 03/18/2012 23:42:07 | 1,277,571 | 03/18/2012 23:38:29 | 1 | 0 | Insert Image into PHP Success | newbie here so hang with me. I'm using this AJAX/PHP [contact form][1] and I'd like to my site, and I'd like to add an image for the success message, instead of just the Thank You! header message. Thanks for any help you can give
[1]: http://tutorialzine.com/2009/09/fancy-contact-form/ | php | jquery | ajax | forms | php-form-processing | 03/20/2012 17:52:51 | not a real question | Insert Image into PHP Success
===
newbie here so hang with me. I'm using this AJAX/PHP [contact form][1] and I'd like to my site, and I'd like to add an image for the success message, instead of just the Thank You! header message. Thanks for any help you can give
[1]: http://tutorialzine.com/2009/09/fancy-contact-form/ | 1 |
6,273,706 | 06/08/2011 02:52:03 | 443,972 | 09/10/2010 02:26:55 | 52 | 1 | Extract just the depot path from perforce output | Already tried a few of the "Extract up to a character" questions here, none work.
example input:
//blah/blah/foo.txt#7 - edit change 12526 (text) by blah@blah
I want to get:
//blah/blah/foo.txt
Right now I am using the regex '/[^#]*/' but I get
//blah/blah/ | regex | perforce | null | null | null | null | open | Extract just the depot path from perforce output
===
Already tried a few of the "Extract up to a character" questions here, none work.
example input:
//blah/blah/foo.txt#7 - edit change 12526 (text) by blah@blah
I want to get:
//blah/blah/foo.txt
Right now I am using the regex '/[^#]*/' but I get
//blah/blah/ | 0 |
6,023,400 | 05/16/2011 21:02:26 | 38,258 | 11/17/2008 15:18:35 | 978 | 56 | OpenGL ES Texture Coordinates Slightly Off | I'm trying to draw a subregion of a texture in OpenGL by specifying the coordinates I want. What's happening though is that, depending on the size of the image, it seems there's a slight offset in the origin of where it selects the texture coordinates. The offset amount seems to be less than the size of a pixel & the output is is blurred combination of neighboring pixels.!
Here's an idea of what I'm describing. In this case I'd want to select the 6x5 green/white region but what OpenGL is rendering includes a slight pink tint to the top & left pixels.
![Offset Illustration][1]
I can fix it by adding an offset to the texture coordinates before passing them to glTexCoordPointer but the problem is that I have no way to calculate what the offset is and it seems different for different textures.
Pseudocode:
float uFactor = regionWidth / textureWidth; // For the example: 0.6f
float vFactor = regionHeight / textureHeight; // For the example: 0.5f
data[0].t[0] = 0.0f * uFactor;
data[0].t[1] = 0.0f * vFactor;
data[1].t[0] = 1.0f * uFactor;
data[1].t[1] = 0.0f * vFactor;
data[2].t[0] = 0.0f * uFactor;
data[2].t[1] = 1.0f * vFactor;
data[3].t[0] = 1.0f * uFactor;
data[3].t[1] = 1.0f * vFactor;
glPushMatrix();
// translate/scale/bind operations
glTexCoordPointer(2, GL_FLOAT, 0, data[0].t);
[1]: http://i.stack.imgur.com/3qQeW.png | c++ | opengl-es | textures | null | null | null | open | OpenGL ES Texture Coordinates Slightly Off
===
I'm trying to draw a subregion of a texture in OpenGL by specifying the coordinates I want. What's happening though is that, depending on the size of the image, it seems there's a slight offset in the origin of where it selects the texture coordinates. The offset amount seems to be less than the size of a pixel & the output is is blurred combination of neighboring pixels.!
Here's an idea of what I'm describing. In this case I'd want to select the 6x5 green/white region but what OpenGL is rendering includes a slight pink tint to the top & left pixels.
![Offset Illustration][1]
I can fix it by adding an offset to the texture coordinates before passing them to glTexCoordPointer but the problem is that I have no way to calculate what the offset is and it seems different for different textures.
Pseudocode:
float uFactor = regionWidth / textureWidth; // For the example: 0.6f
float vFactor = regionHeight / textureHeight; // For the example: 0.5f
data[0].t[0] = 0.0f * uFactor;
data[0].t[1] = 0.0f * vFactor;
data[1].t[0] = 1.0f * uFactor;
data[1].t[1] = 0.0f * vFactor;
data[2].t[0] = 0.0f * uFactor;
data[2].t[1] = 1.0f * vFactor;
data[3].t[0] = 1.0f * uFactor;
data[3].t[1] = 1.0f * vFactor;
glPushMatrix();
// translate/scale/bind operations
glTexCoordPointer(2, GL_FLOAT, 0, data[0].t);
[1]: http://i.stack.imgur.com/3qQeW.png | 0 |
10,957,812 | 06/09/2012 02:02:20 | 1,239,203 | 02/29/2012 01:54:05 | 52 | 0 | How to for loop in reverse? | I'm making a water simulation program, and I need it to do a for loop through y, x. But I need it to check the most bottom y first, then up. This is my lvl:
lvl = [[0, 0, 1, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]]
I need it to check lvl[4] and then lvl[3], lvl[2], etc. Please help!
NB: I'm using nested for loops, so I can check y, x. | python | algorithm | loops | for-loop | simulation | null | open | How to for loop in reverse?
===
I'm making a water simulation program, and I need it to do a for loop through y, x. But I need it to check the most bottom y first, then up. This is my lvl:
lvl = [[0, 0, 1, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]]
I need it to check lvl[4] and then lvl[3], lvl[2], etc. Please help!
NB: I'm using nested for loops, so I can check y, x. | 0 |
6,790,951 | 07/22/2011 13:46:32 | 858,038 | 07/22/2011 13:46:32 | 1 | 0 | Designing for the Cloud | I'm looking to design/code a highly scalable web application. I was going to use the cloud base infrastructure (Amazon EC2) but what I fail to understand is, I need specific users that log on to be directed to a specific VM based on user role.
For instance, I want all users who are 'Managers' to be directed to one VM, all users who are 'Sales' to be directed to another VM. The same application will be deployed to each instance as traffic increases. I wanted the application to use an in-memory database because there will be a lot of write operations that need to be pushed down to all users of that role type. | design | architecture | cloud | null | null | null | open | Designing for the Cloud
===
I'm looking to design/code a highly scalable web application. I was going to use the cloud base infrastructure (Amazon EC2) but what I fail to understand is, I need specific users that log on to be directed to a specific VM based on user role.
For instance, I want all users who are 'Managers' to be directed to one VM, all users who are 'Sales' to be directed to another VM. The same application will be deployed to each instance as traffic increases. I wanted the application to use an in-memory database because there will be a lot of write operations that need to be pushed down to all users of that role type. | 0 |
6,630,985 | 07/08/2011 21:59:09 | 772,502 | 05/27/2011 05:44:18 | 435 | 16 | PHP: Undefined variables warnings | I assign some data to variables in PHP without defining them. For example the `$query`:
$query = $this->db->get();
It works fine, but if there if there is no data returned and assigned to `$query`, I get the PHP warning like: "Undefined variable", which can be fixed by defining the variable like:
$query = NULL;
..
..
$query = $this->db->get();
I want to ask if that is the only solution? eg. define the variable like in above example?
Thanks. | php | error-handling | null | null | null | 07/11/2011 09:52:56 | not constructive | PHP: Undefined variables warnings
===
I assign some data to variables in PHP without defining them. For example the `$query`:
$query = $this->db->get();
It works fine, but if there if there is no data returned and assigned to `$query`, I get the PHP warning like: "Undefined variable", which can be fixed by defining the variable like:
$query = NULL;
..
..
$query = $this->db->get();
I want to ask if that is the only solution? eg. define the variable like in above example?
Thanks. | 4 |
8,182,377 | 11/18/2011 12:24:00 | 10,522 | 09/15/2008 23:42:06 | 1,732 | 31 | Java programmatic ways to get the binary data associated with a class | What are some ways to get the binary data associated with ALL classes at runtime, the java bytecode (I want to write the data to disk).
And I don't want to use JMX.
Basically, I am trying to detect an issue with a class and I want to put the class on disk from the running bytecode.
1. Is there a list of ALL classes that are running from the classloader?
2. How do I get that list?
3. What code can I use to extract the bytecode data once I get a list of classes? | java | bytecode | issues | null | null | null | open | Java programmatic ways to get the binary data associated with a class
===
What are some ways to get the binary data associated with ALL classes at runtime, the java bytecode (I want to write the data to disk).
And I don't want to use JMX.
Basically, I am trying to detect an issue with a class and I want to put the class on disk from the running bytecode.
1. Is there a list of ALL classes that are running from the classloader?
2. How do I get that list?
3. What code can I use to extract the bytecode data once I get a list of classes? | 0 |
11,632,318 | 07/24/2012 13:49:34 | 772,803 | 05/27/2011 09:26:59 | 437 | 14 | Tell Glassfish to Use Existing Zip File | I am using Glassfish 3.1.2 with Dojo 1.7 and would like to shorten the build process, it's taking quite a while for maven to copy the dojo js files each build. I could use the CDN version dojo but I would like to be able to debug when offline. Is there a way to tell Glassfish to use the pre-zipped dojo source file? Just to be clear, I don't want Glassfish to zip the files for me. | glassfish-3 | netbeans-7 | null | null | null | null | open | Tell Glassfish to Use Existing Zip File
===
I am using Glassfish 3.1.2 with Dojo 1.7 and would like to shorten the build process, it's taking quite a while for maven to copy the dojo js files each build. I could use the CDN version dojo but I would like to be able to debug when offline. Is there a way to tell Glassfish to use the pre-zipped dojo source file? Just to be clear, I don't want Glassfish to zip the files for me. | 0 |
1,263,326 | 08/11/2009 22:26:45 | 19,763 | 09/20/2008 20:58:43 | 87 | 0 | Break Long code lines in Visual Studio 2008 | In Visual Studio 2008, if I have a long line of code, how can i get that to breakup into multiple lines?
public static void somemethod(param1, param2, param3, more params etc...)
How can I make this 1 line of code span 2 or 3 lines?
| c# | null | null | null | null | null | open | Break Long code lines in Visual Studio 2008
===
In Visual Studio 2008, if I have a long line of code, how can i get that to breakup into multiple lines?
public static void somemethod(param1, param2, param3, more params etc...)
How can I make this 1 line of code span 2 or 3 lines?
| 0 |
6,742,441 | 07/19/2011 04:54:20 | 194,261 | 10/22/2009 02:07:46 | 427 | 40 | Hardware Programming Career | I have been developing business applications in multiple languages for years now and I'm officially bored with it. I find hardware programming as an area I would like to discover, but I'm not sure where to start.
What is that type of career is it considered?
What type of degree is preferred?
Is there a way to start learning to find out if it is, indeed, of interest for me?
Any help would be greatly appreciated! | development-hardware | null | null | null | null | 07/19/2011 05:14:56 | off topic | Hardware Programming Career
===
I have been developing business applications in multiple languages for years now and I'm officially bored with it. I find hardware programming as an area I would like to discover, but I'm not sure where to start.
What is that type of career is it considered?
What type of degree is preferred?
Is there a way to start learning to find out if it is, indeed, of interest for me?
Any help would be greatly appreciated! | 2 |
4,946,451 | 02/09/2011 14:49:50 | 539,638 | 12/12/2010 15:35:23 | 10 | 0 | InfoPath - Making field required BY CODE | I want to make a field required BY CODE (not by data validation!).
Anyone know how to do it? | infopath | null | null | null | null | 09/27/2011 12:31:44 | not a real question | InfoPath - Making field required BY CODE
===
I want to make a field required BY CODE (not by data validation!).
Anyone know how to do it? | 1 |
8,201,584 | 11/20/2011 12:50:47 | 1,037,851 | 11/09/2011 14:18:02 | 1 | 0 | Setting label in java on clickinb button | >In an applet i am using a button .Can we set three labels on click of a button 3 times ? | java | null | null | null | null | 11/21/2011 12:48:01 | not a real question | Setting label in java on clickinb button
===
>In an applet i am using a button .Can we set three labels on click of a button 3 times ? | 1 |
10,527,612 | 05/10/2012 04:41:45 | 357,261 | 06/03/2010 08:59:33 | 932 | 0 | How to prevent url redirection if user types it manually to the address bar? | I have an aspx page there i have a button that fix on it's click what page to redirect with the if else condition but it fixes it as expected but the prob is that when some one manually type the page URL it goes to there also, while i want to prevent this nature what should i do to stop it, please suggest me, i am using asp.net member ship but i suppose that is not much to so it with membership. | c# | asp.net | null | null | null | 06/04/2012 07:59:01 | not a real question | How to prevent url redirection if user types it manually to the address bar?
===
I have an aspx page there i have a button that fix on it's click what page to redirect with the if else condition but it fixes it as expected but the prob is that when some one manually type the page URL it goes to there also, while i want to prevent this nature what should i do to stop it, please suggest me, i am using asp.net member ship but i suppose that is not much to so it with membership. | 1 |
11,063,380 | 06/16/2012 12:22:22 | 1,460,600 | 06/16/2012 12:17:52 | 1 | 0 | Guide to JS MVC | I am trying to understand MVC, when is good using it and when not. I am trying also to convert some smallapps I made in the past using MVC.
Can please someone suggest me some guide/tutorials where all basics are explained and some "real" examples are shown? I'd really like to see: "without MVC you program like this, using MVC insetad you do the same thing like this".
Can someone help me please?
thanks | javascript | html5 | javascript-framework | null | null | 06/17/2012 13:36:19 | not constructive | Guide to JS MVC
===
I am trying to understand MVC, when is good using it and when not. I am trying also to convert some smallapps I made in the past using MVC.
Can please someone suggest me some guide/tutorials where all basics are explained and some "real" examples are shown? I'd really like to see: "without MVC you program like this, using MVC insetad you do the same thing like this".
Can someone help me please?
thanks | 4 |
4,945,340 | 02/09/2011 13:15:06 | 288,654 | 03/08/2010 10:06:36 | 52 | 3 | HTML HEX Color code tool | I'm looking for a simple desktop tool to show the color of a hex code (#F0F7FF)
So if I have a color #FFFFFF it should show white.
Something lightweight
Thanks | html | colors | desktop | markup | null | 12/17/2011 01:50:01 | not a real question | HTML HEX Color code tool
===
I'm looking for a simple desktop tool to show the color of a hex code (#F0F7FF)
So if I have a color #FFFFFF it should show white.
Something lightweight
Thanks | 1 |
2,364,302 | 03/02/2010 15:33:23 | 214,909 | 11/19/2009 19:38:40 | 48 | 2 | fnmatch for windows in C? | Is there a version of fnmatch for Windows?
I'm trying to have the same functionality (basically using *'s from the command line for the filename) **in C** without having to call FindFirst() etc.
Code is appreciated. | windows | c | null | null | null | null | open | fnmatch for windows in C?
===
Is there a version of fnmatch for Windows?
I'm trying to have the same functionality (basically using *'s from the command line for the filename) **in C** without having to call FindFirst() etc.
Code is appreciated. | 0 |
10,910,623 | 06/06/2012 08:23:58 | 947,790 | 09/15/2011 21:54:47 | 1 | 0 | What can I do with a semi working javascript static analysis program? | I have built a program that crawls a website and extracts the javascript files, the inline javascript and the javascript dom events. Once I have collected all the data, I parse all the javascript using a javascript parser and detect unused pieces of code (functions and variables). Via a web interface, a user can view the result and customize it (mark a function as used even if my program says it's unused). You can then download the new optimized javascript files.
Since javascript is a dynamic language, figuring out where is the unused code is quite hard and I believe my program has around 90% accuracy. My initial goal was to create a subscription based service ($50/year). Are people going to use my service if it's not 100% working? Is this service really useful? Should I keep working on it? | javascript | parsing | optimization | crawler | null | 06/06/2012 08:28:34 | off topic | What can I do with a semi working javascript static analysis program?
===
I have built a program that crawls a website and extracts the javascript files, the inline javascript and the javascript dom events. Once I have collected all the data, I parse all the javascript using a javascript parser and detect unused pieces of code (functions and variables). Via a web interface, a user can view the result and customize it (mark a function as used even if my program says it's unused). You can then download the new optimized javascript files.
Since javascript is a dynamic language, figuring out where is the unused code is quite hard and I believe my program has around 90% accuracy. My initial goal was to create a subscription based service ($50/year). Are people going to use my service if it's not 100% working? Is this service really useful? Should I keep working on it? | 2 |
141,278 | 09/26/2008 18:58:53 | 521 | 08/06/2008 14:16:34 | 763 | 39 | Subqueries vs joins | I refactored a slow section of an application we inherited from another company to use an inner join instead of a subquery like
where id in (select id from ... )
**The refactored query runs about 100x faster.** (~50 seconds to ~0.3) I expected an improvement, but can anyone explain why it was so drastic? The columns used in the where clause were all indexed. Does SQL execute the query in the where clause once per row or something? | mysql | sql | join | optimization | null | null | open | Subqueries vs joins
===
I refactored a slow section of an application we inherited from another company to use an inner join instead of a subquery like
where id in (select id from ... )
**The refactored query runs about 100x faster.** (~50 seconds to ~0.3) I expected an improvement, but can anyone explain why it was so drastic? The columns used in the where clause were all indexed. Does SQL execute the query in the where clause once per row or something? | 0 |
9,034,881 | 01/27/2012 14:35:33 | 1,160,082 | 01/20/2012 06:38:40 | 1 | 0 | How to return an arraylist? | I would like to return an arraylist from a non-class method in java, i have searched around but found nothing so far.
{
int d=e.length();
ArrayList list2 = new ArrayList();
for (int i=0;i<d;i++)
{
list2.add('_');
}
return list2;
}
Thanks alot! | java | arraylist | null | null | null | 01/28/2012 21:22:03 | not a real question | How to return an arraylist?
===
I would like to return an arraylist from a non-class method in java, i have searched around but found nothing so far.
{
int d=e.length();
ArrayList list2 = new ArrayList();
for (int i=0;i<d;i++)
{
list2.add('_');
}
return list2;
}
Thanks alot! | 1 |
1,585,993 | 10/18/2009 20:49:07 | 51 | 08/01/2008 13:31:13 | 3,922 | 105 | Perform Data Analysis on Sql Server or in .Net? | I have some data analysis that needs to perform. On average, it would involve somewhere in between 50K-150K rows. From these rows I need to extract the summation of Sum(X) as well as Count(X) based on five different criteria. There are two ways of going about it:
1. Write 10 different queries, each one designed to aggregate the data from column X using Sum() or Count(). Run each one and retrieve the result using SqlCommand.ExecuteScalar().
2. Create a custom object to contain all of the different parameters that would be needed to evaluate the different conditions. Run one query that will return all of the data needed to make up the superset containing all of the different conditional subsets, using SqlCommand.ExecuteDataReader(). Read each row from the DataReader into a new object, adding each one into a List<CustomObject> collection. One all data is retrieved, use Linq-to-Object to determine the different Sum() and Count() values needed based on different conditions.
I know that I could try each one out to see which is fastest, but I am interested in the community's advice on which one is likely to be faster. Assume Sql Server and Web Server each running on their own machines, each with sufficient memory.
Right now I am leaning towards option 1. Even though there are many more queries to the DB, the DB itself will do all of the aggregation work and very little data will pass in between the Sql Server and the Web Server. With option 2, there is only one query, but it will pass a very large amount of data to .Net, and then .Net will have to do all of the heavy lifting with regards to the aggregate functions (and though I don't have anything to base it on, I suspect that Sql Server is more efficient at running these types of big aggregate functions).
Any thoughts on which way to go (or a third option that I am missing)? | sql-server | aggregate | .net | asp.net | c# | null | open | Perform Data Analysis on Sql Server or in .Net?
===
I have some data analysis that needs to perform. On average, it would involve somewhere in between 50K-150K rows. From these rows I need to extract the summation of Sum(X) as well as Count(X) based on five different criteria. There are two ways of going about it:
1. Write 10 different queries, each one designed to aggregate the data from column X using Sum() or Count(). Run each one and retrieve the result using SqlCommand.ExecuteScalar().
2. Create a custom object to contain all of the different parameters that would be needed to evaluate the different conditions. Run one query that will return all of the data needed to make up the superset containing all of the different conditional subsets, using SqlCommand.ExecuteDataReader(). Read each row from the DataReader into a new object, adding each one into a List<CustomObject> collection. One all data is retrieved, use Linq-to-Object to determine the different Sum() and Count() values needed based on different conditions.
I know that I could try each one out to see which is fastest, but I am interested in the community's advice on which one is likely to be faster. Assume Sql Server and Web Server each running on their own machines, each with sufficient memory.
Right now I am leaning towards option 1. Even though there are many more queries to the DB, the DB itself will do all of the aggregation work and very little data will pass in between the Sql Server and the Web Server. With option 2, there is only one query, but it will pass a very large amount of data to .Net, and then .Net will have to do all of the heavy lifting with regards to the aggregate functions (and though I don't have anything to base it on, I suspect that Sql Server is more efficient at running these types of big aggregate functions).
Any thoughts on which way to go (or a third option that I am missing)? | 0 |
6,515,756 | 06/29/2011 04:28:27 | 809,565 | 06/22/2011 02:37:24 | 11 | 0 | [Java GUI] ComboBox Item is overlapped | Please have a view of the attached image.
I use VLCJ to build this application. However, it is unexpected that the item in combobox is hidden by the Canvas (which is used in VLCJ player).
![enter image description here][1]
How to solve it ,Thank You.
Click this for a enlarged photo: [1]: http://gonow.no-ip.org/overlapped.png
[1]: http://i.stack.imgur.com/2cqGW.png | java | swing | gui | combobox | vlc | null | open | [Java GUI] ComboBox Item is overlapped
===
Please have a view of the attached image.
I use VLCJ to build this application. However, it is unexpected that the item in combobox is hidden by the Canvas (which is used in VLCJ player).
![enter image description here][1]
How to solve it ,Thank You.
Click this for a enlarged photo: [1]: http://gonow.no-ip.org/overlapped.png
[1]: http://i.stack.imgur.com/2cqGW.png | 0 |
11,400,679 | 07/09/2012 18:12:03 | 951,987 | 09/19/2011 05:16:40 | 39 | 2 | Connecting to VPN(Juniper) gives error - "Your browser is executing scripts on this page" | Whenever I open my company's VPN portal, Firefox flashes below error and error disappears. Thereafter if i try enter valid username/password, it says invalid username/password.
> *"Your browser is executino g scripts on this page. If this message persists, please make sure that you are visiting a correct site and
> Java Script support is enabled in your browser, and then try again."*
VPN was working fine few weeks ago. I suspect, latest installed programs are causing this problem. I tried uninstalling all latest programs, enabling Java, trying in IE/Firefox, but no success.
Your help will be highly appreciated.
![VPN Error][1]
[1]: http://i.stack.imgur.com/EMNHP.jpg | javascript | webbrowser | vpn | null | null | 07/10/2012 18:20:41 | off topic | Connecting to VPN(Juniper) gives error - "Your browser is executing scripts on this page"
===
Whenever I open my company's VPN portal, Firefox flashes below error and error disappears. Thereafter if i try enter valid username/password, it says invalid username/password.
> *"Your browser is executino g scripts on this page. If this message persists, please make sure that you are visiting a correct site and
> Java Script support is enabled in your browser, and then try again."*
VPN was working fine few weeks ago. I suspect, latest installed programs are causing this problem. I tried uninstalling all latest programs, enabling Java, trying in IE/Firefox, but no success.
Your help will be highly appreciated.
![VPN Error][1]
[1]: http://i.stack.imgur.com/EMNHP.jpg | 2 |
8,440,368 | 12/09/2011 02:35:54 | 869,996 | 07/29/2011 20:06:57 | 72 | 1 | PHP Word Export | I am trying to export a php file as a word document, and I did my Googling and found:
header('Content-type: application/vnd.ms-word');
header("Content-Disposition: inline; filename=$filename.doc");
header("Content-Disposition: attachment; filename=$filename.doc");
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Pragma: anytextexeptno-cache', true);
header('Cache-control: private');
header('Expires: 0');
but that only works on windows. In OSX it says invalid file type, and in Linux it tries to open in Chrome, and fails.
Can anyone tell me what I am missing? I want the computer to believe it is word, and if it does, the document is valid (I know because of windows working). It seems like I need to do something else to tell Unix like systems that it is a word document, even though it is really an html document.
OH and I saw a couple libraries for it out there, but I'm avoiding doing that because I want to create these on the fly, and they do not need to be fancy. Thanks! | php | linux | osx | unix | word | null | open | PHP Word Export
===
I am trying to export a php file as a word document, and I did my Googling and found:
header('Content-type: application/vnd.ms-word');
header("Content-Disposition: inline; filename=$filename.doc");
header("Content-Disposition: attachment; filename=$filename.doc");
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Pragma: anytextexeptno-cache', true);
header('Cache-control: private');
header('Expires: 0');
but that only works on windows. In OSX it says invalid file type, and in Linux it tries to open in Chrome, and fails.
Can anyone tell me what I am missing? I want the computer to believe it is word, and if it does, the document is valid (I know because of windows working). It seems like I need to do something else to tell Unix like systems that it is a word document, even though it is really an html document.
OH and I saw a couple libraries for it out there, but I'm avoiding doing that because I want to create these on the fly, and they do not need to be fancy. Thanks! | 0 |
989,346 | 06/12/2009 22:24:41 | 84,745 | 03/30/2009 17:53:48 | 220 | 10 | UNIX Domain Sockets and Cocoa | I want to implement IPC in a Cocoa application using UNIX domain sockets, with which I have no experience. I found Apple's [CFLocalServer][1] example project, but it's written in C and looks, well, fairly complicated (and yes, I have read most of it).
Are the techniques demonstrated in CFLocalServer still state-of-the-art, or is there a way to implement UNIX domain sockets in Objective-C with Cocoa/Foundation?
I'm playing with `NSSocketPort`s and `NSFileHandle`s (which provide a healthy amount of abstraction, which is great for this project) and found some very-related code in [Mike Bean's Networking in Cocoa][2], but haven't been able to Make It All Work yet.
Anyone done this before?
[1]: http://developer.apple.com/SampleCode/CFLocalServer/index.html
[2]: http://www.macdevcenter.com/pub/a/mac/2003/05/13/cocoa.html | cocoa | sockets | osx | ipc | null | null | open | UNIX Domain Sockets and Cocoa
===
I want to implement IPC in a Cocoa application using UNIX domain sockets, with which I have no experience. I found Apple's [CFLocalServer][1] example project, but it's written in C and looks, well, fairly complicated (and yes, I have read most of it).
Are the techniques demonstrated in CFLocalServer still state-of-the-art, or is there a way to implement UNIX domain sockets in Objective-C with Cocoa/Foundation?
I'm playing with `NSSocketPort`s and `NSFileHandle`s (which provide a healthy amount of abstraction, which is great for this project) and found some very-related code in [Mike Bean's Networking in Cocoa][2], but haven't been able to Make It All Work yet.
Anyone done this before?
[1]: http://developer.apple.com/SampleCode/CFLocalServer/index.html
[2]: http://www.macdevcenter.com/pub/a/mac/2003/05/13/cocoa.html | 0 |
5,045,965 | 02/18/2011 20:02:43 | 471,016 | 10/09/2010 16:20:12 | 28 | 1 | Get MediaStore content Uri from File path? | I have an application that lists all videos in MediaStore. (I need both internal storage and external storage).
Basically I have two cursors which query MediaStore.Video.Media.EXTERNAL_CONTENT_URI and MediaStore.Video.Media.INTERNAL_CONTENT_URI.
Then I use a MergeCursor to merge these queries and display in a ListView with a CursorAdapter.
The thing is that sometimes I want to delete one of the videos, but I need the "content Uri" for this operation because I don't have a way to determine the storage of the selected video.
I have the full file path of the Video and the ID in MediaStore.
How can I get the "content Uri" from the file path/Uri?
| android | uri | mediastore | null | null | null | open | Get MediaStore content Uri from File path?
===
I have an application that lists all videos in MediaStore. (I need both internal storage and external storage).
Basically I have two cursors which query MediaStore.Video.Media.EXTERNAL_CONTENT_URI and MediaStore.Video.Media.INTERNAL_CONTENT_URI.
Then I use a MergeCursor to merge these queries and display in a ListView with a CursorAdapter.
The thing is that sometimes I want to delete one of the videos, but I need the "content Uri" for this operation because I don't have a way to determine the storage of the selected video.
I have the full file path of the Video and the ID in MediaStore.
How can I get the "content Uri" from the file path/Uri?
| 0 |
6,702,445 | 07/15/2011 03:38:51 | 830,891 | 07/06/2011 04:52:00 | 2 | 0 | XML Parse script | Do anyone here has written any t-sql scrip to parse xml coloumn in text field.
Since i am a new bee in sql server. `Please help!` | xml | tsql | null | null | null | 12/24/2011 15:08:19 | not a real question | XML Parse script
===
Do anyone here has written any t-sql scrip to parse xml coloumn in text field.
Since i am a new bee in sql server. `Please help!` | 1 |
8,302,603 | 11/28/2011 21:30:36 | 1,070,167 | 11/28/2011 21:19:52 | 1 | 0 | Mapping gamemod on each side of a 3d box | Hi guys i wanna map my game mod remix on each side of the 3d box and any help would be appreicated. I am using an internal library called lightGL but i don't know how to map it on the each side. Also how would i go by adding sound each time the ball hits the brick?
/**
* LightsGL.
* Modified from an example by Simon Greenwold.
*
* Display a box with three different kinds of lights.
*/
import processing.opengl.*;
void setup()
{
size(1024, 768, OPENGL);
noStroke();
}
void draw()
{
defineLights();
background(0);
for (int x = 0; x <= width; x += 100) {
for (int y = 0; y <= height; y += 100) {
pushMatrix();
translate(x, y);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(90);
popMatrix();
}
}
}
void defineLights() {
// Orange point light on the right
pointLight(150, 100, 0, // Color
200, -150, 0); // Position
// Blue directional light from the left
directionalLight(0, 102, 255, // Color
1, 0, 0); // The x-, y-, z-axis direction
// Yellow spotlight from the front
spotLight(255, 255, 109, // Color
0, 40, 200, // Position
0, -0.5, -0.5, // Direction
PI / 2, 2); // Angle, concentration
}
/********************GLOBAL VARIABLES********************************************/
// variable of type Rectangle:
//This variable represents the game "board" - a game is played within the gameFrame...
float r = random (0, 255);
float g = random (0, 255);
float b = random (0, 255);
Rectangle gameFrame;
// variable to hold an array of objects of type Brick
Brick[] bricks;
// variable of type Paddle that represents a paddle
Paddle paddle;
// variable to hold an array of objects of type Ball
Ball[] balls;
int frameNum = 0;
// THE SCREEN PROPERTIES :
//int screenWidth = 800;
//int screenHeight = 400;
color backgroundColor = #333F48;
boolean backgroundRefreshes = true;
// THE GAME FRAME PROPERTIES:
int gameFrameWidth = 400;
int gameFrameHeight = 400;
color gameFrameStroke = #333F48;
boolean gameFrameHasStroke = false;
color gameFrameFill = #333F48;
int opacityOfRefresh = 255;
boolean gameFrameRefreshes = true;
float spin = 0.0;
int recX = (800-gameFrameWidth)/2;
int recY = (400-gameFrameHeight)/2;
/********************SET UP FUNCTION********************************************
This function sets up the startup properties for a new game session
- occurs before a new game starts
******************************************************************************/
void setup() {
size(800, 400, P2D,P3D);
background(r, g, b);
frameRate(60);
// Instantiate the necessary objects for a new game
// create a rectanle object to represnt the game frame
gameFrame = new Rectangle(gameFrameWidth, gameFrameHeight, gameFrameHasStroke, gameFrameStroke, true, gameFrameFill);
gameFrame.opacity = opacityOfRefresh;
// call the function to create the Bricks for a new game session
createBricks();
// call the function to create the Balls for a new game session
createBalls();
paddle = new Paddle();
// call the function to refresh the screen
refreshScreen();
}
/********************DRAW FUNCTION*******************************************
void draw() {
// translate(width, height/2, 50);
// rotateY(map(mouseX, 0, width, 0, PI));
// rotateX(map(mouseY, 0, height, 0, PI));
// box(150);
rotateX(radians(35));
rotateZ(radians(10));
translate(50,-170,20);
rotateY(radians(25));
// scale(.9);
// rotateZ(radians(28));
// translate(110, -200);
// call the refreshScreen function
//(will update all the necessary properties, objects and game state)
refreshScreen();
// call saveScreenShots()
saveScreenshots();
}
/********************createBalls() FUNCTION**********************************
void createBalls() {
// Local Variables for Ball Properties
//make changes here to the ball numbers
int numberOfBalls = 30;
int yBalls = 60;
//assign the balls variable to be an array of Ball objects -
//the array will hold "numberOfBalls" = 1 object ( have only 1 ball at the time in a game)
balls = new Ball[numberOfBalls];
for (int i=0; i<numberOfBalls; i++) {
int x = i*20;
/***** This line is fundamental: as it will create a new Ball object with the specified parameters
and will put the instantiated Ball object into our "ball" array.************************************/
balls[i] = new Ball(x, yBalls);
}
}
/********************createBricks() FUNCTION**********************************
This function is called when we want to define and create the bricks
The function takes no arguments and does not return anything
****************************************************************************/
void createBricks() {
// Local Variables for Brick Group Properties
int numberOfBricks = 80;//80 make change here
int bricksPerRow = 6; //6 make change here
int brickWidth = gameFrameWidth/bricksPerRow;
int brickHeight = 20; //60 make change here
boolean brickHasStroke = false;
color brickStroke = #8E8B82; //60 make change here
boolean brickHasFill = true;
color brickFill = #ff0000; //60 make change here
int yBricks = 50;
//make change here
color[] rowsColors = {
#01DAF5, #A6D7DE, #ff9900, #ff9900, #00DAF5, #ff9900, #00DAF5
};
// Create the bricks
//assign the brick variable to be an array of Brick objects - the array will hold "numberOfBricks" =60 objects
bricks = new Brick[numberOfBricks];
// use a for loop to put 60 Brick objects into the array named "brick"
for (int i=0; i<numberOfBricks; i++)
{
// to keep track of the row we are on
int rowNum = i/bricksPerRow;
// coords for creating a brick
int x = brickWidth*i;
x -= rowNum*bricksPerRow*brickWidth;
int y = yBricks+i/bricksPerRow*brickHeight;
// variable used for determination of the colour of a brick
// rowColors = an array of colors
// min() is an inbuilt function which will return the minimum value between its two arguements
int num = min(rowNum, rowsColors.length-1);
// choose a colour based on the value of num
color rowColor = rowsColors[num];
/***** This line is fundamental: as it will create a new Brick object with the specified parameters
and will put the instantiated Brick object into our "bricks" array.************************************/
bricks[i] = new Brick(x, y, brickWidth, brickHeight, brickHasStroke, brickStroke, brickHasFill, rowColor);
}
}
/********************refreshScreen() FUNCTION**********************************
This function is called when we want to refresh the game properties and/or update
the state of the game.
This function takes no arguements and does not return anything
******************************************************************************/
void refreshScreen() {
// condition for refreshing the Background
// check if this (global) boolean is TRUE...
if (backgroundRefreshes) {
background (backgroundColor);
//background(r,g,b);
}
// condition for refreshing the GameFrame
// check if this (global) boolean is TRUE...
if (gameFrameRefreshes) {
// call this function: located in the Rectangle class - because the gameFrame is an object of type Rectangle
gameFrame.drawYourself();
}
// PADDLE
// Update paddle Properties
// call the refresh() function for the Paddle object (the function is in the Paddle class...)
paddle.refresh();
// BRICKS
// Update the bricks array
// within the for loop call the refresh() function for every Brick oject currently within the bricks array
//(the function is within the Bricks class...)
for (int i=0; i<bricks.length; i++) {
bricks[i].refresh();
}
// BALLS
//Update the balls array
// within the for loop call the refresh() function for every Ball oject currently within the balls array
//(the function is within the Ball class...)
for (int i=0; i<balls.length; i++) {
balls[i].refresh();
}
}
/********************saveScreenShots() FUNCTION**********************************
void saveScreenshots() {
frameNum++;
if (keyPressed) {
if (key == 'g' || key == 'G') {
if (frameNum%2==0) {
saveFrame("saved/frame-####.tga");
}
}
}
}
// import the necessary library
import java.awt.geom.*;
/********************************************************************************
public class Ball {
// Define an a local variable "rectangle" to represent an object of type Rectangle
Rectangle rectangle;
// local Variables that represent the properties of a Brick object
int width = 10; // make change here to the ball
int height = 10; // make change here to the ball
boolean hasStroke = true;
color strokeColor = #550F48; //#333F48 make change here
boolean hasFill = true;
color fillColor = #102F48; //#333F48 make change here
// velocity
int velX = 4; //4 make change here
int velY = 2; //4 make change here
// positioning variables
int x;
int y;
int ox;
int oy;
int xcentre;
int ycentre;
/********************************************************************************
Ball Class Default Constructor:
Ball(int newX, int newY) {
x = newX;
y = newY;
// make an instance of the Rectangle object (the ball is a rectangle...)
rectangle = new Rectangle(width, height, hasStroke, strokeColor, hasFill, fillColor);
// call the setPosition() function of the rectangle ( the function is within the Rectangle class...)
rectangle.setPosition(x, y);
}
/********************************************************************************
Function: refresh()
Returns: nothing.
Maintains the state of the given Ball on the Screen.
The refresh() method calls the updatePosition() method, and there after
the setPosition() and finally redraws itself to the screen (with the drawYourself()).
**********************************************************************************/
void refresh() {
// call this function that is local to this class
updatePosition();
rectangle.setPosition(x, y);
rectangle.drawYourself();
// Remember that a Brick has been defined as an object rectangle of type Rectangle.
// Therefore the drawYourself()&setPosition() functions are within the Rectangle Class...
}
/********************************************************************************
Function: updatePosition()
Returns: nothing.
Calculates the "real" time positioing of the Ball. Within this function
are also the calls to the function to check if the ball
has collided with another object.
*********************************************************************************/
void updatePosition() {
// add velocity to position- this simulates the ball movemnet( we update the x and y position of the ball...
x+=velX;
y+=velY;
// collision with limits for "x"
if (x<=0 || x>=gameFrameWidth-width) {
// set the velocity for the x Position
velX = -velX;
// the constrain() will make sure that "x" does not go less than 0 and not greater than (gameFrameWidth-width)
x = constrain(x, 0, gameFrameWidth-width);
}
// collision with limits for "y"
if (y<=0 || y>=gameFrameHeight-height) {
velY = -velY;
y = constrain(y, 0, gameFrameHeight-height);
}
xcentre = x+width/2;
ycentre = y+height/2;
// We check if the ball is colliding with the paddle
// input parameter is the "rectangle" variables defined in the Paddle class
// Remember: the "paddle" is an object of type Paddle - and this class has an instance variable named "rectangle" ...
// This function will return "result"
// collision with paddle
int result = checkCollisionWithRectangle(paddle.rectangle);
// if collides on top, control direction of ball
// if (result == 1){
//if(xcentre < paddle.rectangle.x1+paddle.rectangle.width/2){
// if(velX>0){
// velX = -velX*2;
// }
// }else{
// if(velX<0){
// velX = -velX/3;
//}
//}
// }
//We detect collision with the bricks if the result is "0"
if (result == 0) {
// iterate through the array of Bricks
for (int i=0; i<bricks.length; i++) {
// Check if the brick is alive ( imAlive is a boolean - so if TRUE...)
if (bricks[i].imAlive) {
/*We check if the ball is collidiing with the paddle
Input parameter is the "rectangle" variables defined in the Brick class
Remember: the "bricks[i]" is an object of type Brick - and this class has
an instance variable named "rectangle" (Every brick instance has its own "rectangle" var)*/
// This function will return "res"
int res = checkCollisionWithRectangle(bricks[i].rectangle);
// if the returned "res" s not 0 then kill this brick.
if (res != 0) {
bricks[i].die();
break;
}
}
}
}
// keep track of the current x and y vars (make a copy)
ox = x;
oy = y;
}
/********************************************************************************
Function: checkCollisionWithRectangle()
Input Paramer: A Rectangle "tempRect"
Returns: an integer:
result: 0: no collision 1: top 2: right 3: bottom 4: left 5: couldn't detect which side
*********************************************************************************/
int checkCollisionWithRectangle (Rectangle R) {
// define the result variable
int result = 0;
// check if the rectangle given (ie the paddle) is being touched by the ball
// xcentre, ycentre are ball position variables
// doesPointTouchMe() is located in the Rectangle class...
// if it returns TRUE then execute this clause
if (R.doesPointTouchMe(xcentre, ycentre)) {
//check which side of the tempRect object has the ball touched.
// This line is easier to work with when we want to check how
//the ball has collided with the Rectangle object instead of using the ball itself...
Line2D lineaBola = new Line2D.Float(xcentre, ycentre, ox+width/2, oy+height/2);
// whatSideDoesLineTouch() is located in the Rectangle class...
// if it returns TRUE then execute this clause
result = R.whatSideDoesLineTouch(lineaBola, velX, velY);
// have to perhaps change the position & velocity parameters of the ball
// top
if (result==1) {
velY = -velY;
y = R.y1-height;
// right
}
else if (result==2) {
velX = -velX;
x = R.x2;
// bottom
}
else if (result==3) {
velY = -velY;
y = R.y2;
// left
}
else if (result==4) {
velX = -velX;
x = R.x1-width;
}
else {
result = 20;
}
}
// return the correct result ... also remember
//if this result!=0 then the brick touched will die...
return result;
}
/*********************************************************************************/
}// End of Ball Class Definition
/********************************************************************************
Defintion of the Brick Class:
The Brick Class is used to define a Brick object in the game.
It makes use of the Rectangle Class.
**********************************************************************************/
public class Brick
{
// Define an a local variable "rectangle" to represent an object of type Rectangle
Rectangle rectangle;
// local Variables that represent the properties of a Brick object
boolean hasStroke = true; //make change here
color strokeColor = 0; // make change here
boolean hasFill = true; //make change here
color fillColor = 157; // make change here
//
int x = 500; //make change here
int y = 100; //make change here
//
boolean respawns = true; //make change here
int timeToRespawn = 20; // time is in frames
// time is in frames
int frame;
boolean imAlive;
/********************************************************************************
Brick Class Default Constructor:
In order to create an Instance of a Brick Object, one needs to invoke
the Default Constructor in the following manner:
new Brick(rectX, rectY, rectWidth,rectHeight, hasStroke, strokeDef, hasFill, fillColour).
The Brick Constructor makes an instance of the Rectangle Class.
/********************************************************************************/
Brick(int X, int Y, int W, int H, boolean HASSTROKE, color STROKE, boolean HASFILL, color FILL) {
// make an instance of the Rectangle object
rectangle = new Rectangle(W, H, HASSTROKE, STROKE, HASFILL, FILL);
// call the setPosition() function of the rectangle ( the function is within the Rectangle class...)
rectangle.setPosition(X, Y);
imAlive = false;
}
/********************************************************************************
Function: refresh()
Returns: nothing.
Maintains the state of the given Brick on the Screen.
The refresh() method checks the state of the Brick (alive or dead)
/ if a new one should be created - if it is alive it will call the drawYourself().
**********************************************************************************/
void refresh() {
if (imAlive) {
// Remember that a Brick has been defined as an object rectangle of type Rectangle.
// Therefore the drawYourself() function is within the Rectangle Class...
rectangle.drawYourself();
}
else {
if (respawns) {
frame++;
if (frame>timeToRespawn-10) {
// rise up from your grave, brick
imAlive=true;
}
}
}
}
/********************************************************************************
Function: die()
Returns: nothing.
Maintains the state of a Brick. If a Brick is "dead", it is removed from the screen.
*********************************************************************************/
void die() {
imAlive = false;
frame = 2;
}
}// End of Brick Class Definition
/********************************************************************************
Defintion of the Paddle Class:
The Paddle Class is used to define the Paddle object in the game.
It makes use of the Rectangle Class.
*********************************************************************************/
public class Paddle {
/********************************************************************************
Paddle Class Instance Variables:
These Instance Variables will be initialised(defined)when an Instance of the
Paddle Class is invoked by calling the default constructor new Paddle().
/*********************************************************************************/
// Define an a local variable "rectangle" to represent an object of type Rectangle
Rectangle rectangle;
// Paddle Variables
int width = 200;
int height = 50;
// boolean variables
boolean hasStroke = false;
boolean hasFill = true;
// color variables make change here
//#333F48
color strokeColor = #102F48;
//#333F48
color fillColor = #100F48;
//
int x = gameFrameWidth/2;
int y = 370;
/********************************************************************************
Paddle Class Default Constructor -
In order to create an Instance of a Paddle Object, one needs to invoke
the Default Constructor in the following manner new Paddle().
The Paddle Class makes an instance of the Rectangle Class.
*********************************************************************************/
Paddle() {
rectangle = new Rectangle(width, height, hasStroke, strokeColor, hasFill, fillColor);
rectangle.setPosition(x, y);
}
/********************************************************************************
Function: refresh()
Returns: nothing.
Maintains the Position of the Paddle on the Screen.
The refresh() method call the updatePosition() method, and there after
the setPosition() and redraws itself to the screen (with the drawYourself()).
/******************************************************************************** */
void refresh() {
updatePosition();
// Update the Position of the Rectangle (Paddle) Object
// this function is in THIS class...
rectangle.setPosition(x, y);
// now set the position ...
rectangle.drawYourself();
// Remember that a Paddle has been defined as an object rectangle of type Rectangle.
// Therefore the drawYourself() function is within the Rectangle Class...
}
/********************************************************************************
Function: updatePosition()
Returns: nothing.
Calculates the "real" time positioning of the Paddle.
*********************************************************************************/
void updatePosition() {
x = mouseX-recX-width/2;
x = constrain(x, 0, gameFrameWidth-width);
}
/********************************************************************************/
} // End of Paddle Class Definition
rectangle class
Copy code
// import the necessary library
import java.awt.geom.*;
/********************************************************************************
Defintion of the Rectangle Class:
The Rectangle Class is used to define every visible object in the game
(The game frame, the bricks, the paddle and the ball)
*********************************************************************************/
public class Rectangle {
int width;
int height;
//change here for the color
boolean hasStroke = false;
color strokeColor;
boolean hasFill = true;
color fillColor;
color opacity;
int x1;
int y1;
int x2;
int y2;
/********************************************************************************
Rectangle Class Default Constructor -
Rectangle(int widthOfRect, int heightOfRect, boolean hasStroke, color strokeColor, boolean fillIsHere, color tempFILL) {
// set the values of the instance variables to the given arguements.
width = widthOfRect;
height = heightOfRect;
hasStroke = hasStroke;
strokeColor = strokeColor;
hasFill = fillIsHere;
fillColor = tempFILL;
//change here 205
opacity = 505;
}
/*********************************************************************************
Function: setPosition(int posX, int posY)
void setPosition(int newX, int newY) {
x1 = newX;
y1 = newY;
x2 = x1+width;
y2 = y1+height;
}
/*********************************************************************************
Function: drawYourself()
void drawYourself() {
// Check if this Rectangle has to a stroke property enabled, if so, apply the stroke property.
if (hasStroke) {
stroke(strokeColor);
}
else {
noStroke();
}
// Check if this Rectangle is fill property enabled, if so, apply the fill property.
if (hasFill) {
fill(fillColor, opacity);
}
else {
noFill();
}
// Draw the Rectangle and enabled propoerties. make change here
rect(recX+x1, recY+y1, width/2, height/2);
}
/*********************************************************************************
Function: doesPointTouchMe()
Returns: boolean.
The doesPointTouchMe Method implements a collision detetction algorithm, if the points (pX, pY)
are discovered to be within the bounds of the Rectangle Object(i.e a Brick, Paddle...).
Then the object (ball object) represented by position (pX, pY), indeed touches that Rectangle object.
*********************************************************************************/
boolean doesPointTouchMe (int PX, int PY) {
// Set the return variable to false, assume that the Rectangle is not Touched.
boolean result = false;
// Check the if pX is found inside the x coordinates of the current Rectangle
if (PX >= x1 && PX <= x2) {
// Check if pY is found inside the y coordinates of the current Rectangle
if (PY >= y1 && PY <= y2) {
// If we reach this statement, then the Rectangle has been Touched.
result = true;
}
}
return result;
}
/*********************************************************************************
Function: whatSideDoesLineTouch()
Input Parameters: tempLine (represents the side of the ball that has touched the other Rectangle object)
velX, velY (velocity parameters of the ball)
Returns: an int (represnts the side of the touched Rectangle oject) - touched BY the ball..
This function determines which side of the Rectangle object that called this function (i.e. a Brick)
has been touched by the Ball object
/*********************************************************************************/
int whatSideDoesLineTouch (Line2D LINE, int VELX, int VELY) {
// local variable to represent the side
Line2D side;
// condition check based on velY value
// top touched will return (1) and bottom touched will return(3)
if (VELY>0) {
// create an instance of a 2D Line
side = new Line2D.Float(x1, y1, x2, y1);
// check if our line representing the side of the "ball" intersects the side.
// Note: the function intersectsLine is deined in the Line2D class which is from the
// java.awt.geom library
if (LINE.intersectsLine(side)) {
return 1;
}
}
else if (VELY<0) {
side = new Line2D.Float(x1, y2, x2, y2);
if (LINE.intersectsLine(side)) {
return 3;
}
}
// left touched will return (4) / right touched will return (2)
if (VELX>0) {
side = new Line2D.Float(x1, y1, x1, y2);
if (LINE.intersectsLine(side)) {
return 4;
}
}
else if (VELX<0) {
side = new Line2D.Float(x2, y1, x2, y2);
if (LINE.intersectsLine(side)) {
return 2;
}
}
return 0;
}
} | processing | null | null | null | null | 11/28/2011 21:40:08 | not a real question | Mapping gamemod on each side of a 3d box
===
Hi guys i wanna map my game mod remix on each side of the 3d box and any help would be appreicated. I am using an internal library called lightGL but i don't know how to map it on the each side. Also how would i go by adding sound each time the ball hits the brick?
/**
* LightsGL.
* Modified from an example by Simon Greenwold.
*
* Display a box with three different kinds of lights.
*/
import processing.opengl.*;
void setup()
{
size(1024, 768, OPENGL);
noStroke();
}
void draw()
{
defineLights();
background(0);
for (int x = 0; x <= width; x += 100) {
for (int y = 0; y <= height; y += 100) {
pushMatrix();
translate(x, y);
rotateY(map(mouseX, 0, width, 0, PI));
rotateX(map(mouseY, 0, height, 0, PI));
box(90);
popMatrix();
}
}
}
void defineLights() {
// Orange point light on the right
pointLight(150, 100, 0, // Color
200, -150, 0); // Position
// Blue directional light from the left
directionalLight(0, 102, 255, // Color
1, 0, 0); // The x-, y-, z-axis direction
// Yellow spotlight from the front
spotLight(255, 255, 109, // Color
0, 40, 200, // Position
0, -0.5, -0.5, // Direction
PI / 2, 2); // Angle, concentration
}
/********************GLOBAL VARIABLES********************************************/
// variable of type Rectangle:
//This variable represents the game "board" - a game is played within the gameFrame...
float r = random (0, 255);
float g = random (0, 255);
float b = random (0, 255);
Rectangle gameFrame;
// variable to hold an array of objects of type Brick
Brick[] bricks;
// variable of type Paddle that represents a paddle
Paddle paddle;
// variable to hold an array of objects of type Ball
Ball[] balls;
int frameNum = 0;
// THE SCREEN PROPERTIES :
//int screenWidth = 800;
//int screenHeight = 400;
color backgroundColor = #333F48;
boolean backgroundRefreshes = true;
// THE GAME FRAME PROPERTIES:
int gameFrameWidth = 400;
int gameFrameHeight = 400;
color gameFrameStroke = #333F48;
boolean gameFrameHasStroke = false;
color gameFrameFill = #333F48;
int opacityOfRefresh = 255;
boolean gameFrameRefreshes = true;
float spin = 0.0;
int recX = (800-gameFrameWidth)/2;
int recY = (400-gameFrameHeight)/2;
/********************SET UP FUNCTION********************************************
This function sets up the startup properties for a new game session
- occurs before a new game starts
******************************************************************************/
void setup() {
size(800, 400, P2D,P3D);
background(r, g, b);
frameRate(60);
// Instantiate the necessary objects for a new game
// create a rectanle object to represnt the game frame
gameFrame = new Rectangle(gameFrameWidth, gameFrameHeight, gameFrameHasStroke, gameFrameStroke, true, gameFrameFill);
gameFrame.opacity = opacityOfRefresh;
// call the function to create the Bricks for a new game session
createBricks();
// call the function to create the Balls for a new game session
createBalls();
paddle = new Paddle();
// call the function to refresh the screen
refreshScreen();
}
/********************DRAW FUNCTION*******************************************
void draw() {
// translate(width, height/2, 50);
// rotateY(map(mouseX, 0, width, 0, PI));
// rotateX(map(mouseY, 0, height, 0, PI));
// box(150);
rotateX(radians(35));
rotateZ(radians(10));
translate(50,-170,20);
rotateY(radians(25));
// scale(.9);
// rotateZ(radians(28));
// translate(110, -200);
// call the refreshScreen function
//(will update all the necessary properties, objects and game state)
refreshScreen();
// call saveScreenShots()
saveScreenshots();
}
/********************createBalls() FUNCTION**********************************
void createBalls() {
// Local Variables for Ball Properties
//make changes here to the ball numbers
int numberOfBalls = 30;
int yBalls = 60;
//assign the balls variable to be an array of Ball objects -
//the array will hold "numberOfBalls" = 1 object ( have only 1 ball at the time in a game)
balls = new Ball[numberOfBalls];
for (int i=0; i<numberOfBalls; i++) {
int x = i*20;
/***** This line is fundamental: as it will create a new Ball object with the specified parameters
and will put the instantiated Ball object into our "ball" array.************************************/
balls[i] = new Ball(x, yBalls);
}
}
/********************createBricks() FUNCTION**********************************
This function is called when we want to define and create the bricks
The function takes no arguments and does not return anything
****************************************************************************/
void createBricks() {
// Local Variables for Brick Group Properties
int numberOfBricks = 80;//80 make change here
int bricksPerRow = 6; //6 make change here
int brickWidth = gameFrameWidth/bricksPerRow;
int brickHeight = 20; //60 make change here
boolean brickHasStroke = false;
color brickStroke = #8E8B82; //60 make change here
boolean brickHasFill = true;
color brickFill = #ff0000; //60 make change here
int yBricks = 50;
//make change here
color[] rowsColors = {
#01DAF5, #A6D7DE, #ff9900, #ff9900, #00DAF5, #ff9900, #00DAF5
};
// Create the bricks
//assign the brick variable to be an array of Brick objects - the array will hold "numberOfBricks" =60 objects
bricks = new Brick[numberOfBricks];
// use a for loop to put 60 Brick objects into the array named "brick"
for (int i=0; i<numberOfBricks; i++)
{
// to keep track of the row we are on
int rowNum = i/bricksPerRow;
// coords for creating a brick
int x = brickWidth*i;
x -= rowNum*bricksPerRow*brickWidth;
int y = yBricks+i/bricksPerRow*brickHeight;
// variable used for determination of the colour of a brick
// rowColors = an array of colors
// min() is an inbuilt function which will return the minimum value between its two arguements
int num = min(rowNum, rowsColors.length-1);
// choose a colour based on the value of num
color rowColor = rowsColors[num];
/***** This line is fundamental: as it will create a new Brick object with the specified parameters
and will put the instantiated Brick object into our "bricks" array.************************************/
bricks[i] = new Brick(x, y, brickWidth, brickHeight, brickHasStroke, brickStroke, brickHasFill, rowColor);
}
}
/********************refreshScreen() FUNCTION**********************************
This function is called when we want to refresh the game properties and/or update
the state of the game.
This function takes no arguements and does not return anything
******************************************************************************/
void refreshScreen() {
// condition for refreshing the Background
// check if this (global) boolean is TRUE...
if (backgroundRefreshes) {
background (backgroundColor);
//background(r,g,b);
}
// condition for refreshing the GameFrame
// check if this (global) boolean is TRUE...
if (gameFrameRefreshes) {
// call this function: located in the Rectangle class - because the gameFrame is an object of type Rectangle
gameFrame.drawYourself();
}
// PADDLE
// Update paddle Properties
// call the refresh() function for the Paddle object (the function is in the Paddle class...)
paddle.refresh();
// BRICKS
// Update the bricks array
// within the for loop call the refresh() function for every Brick oject currently within the bricks array
//(the function is within the Bricks class...)
for (int i=0; i<bricks.length; i++) {
bricks[i].refresh();
}
// BALLS
//Update the balls array
// within the for loop call the refresh() function for every Ball oject currently within the balls array
//(the function is within the Ball class...)
for (int i=0; i<balls.length; i++) {
balls[i].refresh();
}
}
/********************saveScreenShots() FUNCTION**********************************
void saveScreenshots() {
frameNum++;
if (keyPressed) {
if (key == 'g' || key == 'G') {
if (frameNum%2==0) {
saveFrame("saved/frame-####.tga");
}
}
}
}
// import the necessary library
import java.awt.geom.*;
/********************************************************************************
public class Ball {
// Define an a local variable "rectangle" to represent an object of type Rectangle
Rectangle rectangle;
// local Variables that represent the properties of a Brick object
int width = 10; // make change here to the ball
int height = 10; // make change here to the ball
boolean hasStroke = true;
color strokeColor = #550F48; //#333F48 make change here
boolean hasFill = true;
color fillColor = #102F48; //#333F48 make change here
// velocity
int velX = 4; //4 make change here
int velY = 2; //4 make change here
// positioning variables
int x;
int y;
int ox;
int oy;
int xcentre;
int ycentre;
/********************************************************************************
Ball Class Default Constructor:
Ball(int newX, int newY) {
x = newX;
y = newY;
// make an instance of the Rectangle object (the ball is a rectangle...)
rectangle = new Rectangle(width, height, hasStroke, strokeColor, hasFill, fillColor);
// call the setPosition() function of the rectangle ( the function is within the Rectangle class...)
rectangle.setPosition(x, y);
}
/********************************************************************************
Function: refresh()
Returns: nothing.
Maintains the state of the given Ball on the Screen.
The refresh() method calls the updatePosition() method, and there after
the setPosition() and finally redraws itself to the screen (with the drawYourself()).
**********************************************************************************/
void refresh() {
// call this function that is local to this class
updatePosition();
rectangle.setPosition(x, y);
rectangle.drawYourself();
// Remember that a Brick has been defined as an object rectangle of type Rectangle.
// Therefore the drawYourself()&setPosition() functions are within the Rectangle Class...
}
/********************************************************************************
Function: updatePosition()
Returns: nothing.
Calculates the "real" time positioing of the Ball. Within this function
are also the calls to the function to check if the ball
has collided with another object.
*********************************************************************************/
void updatePosition() {
// add velocity to position- this simulates the ball movemnet( we update the x and y position of the ball...
x+=velX;
y+=velY;
// collision with limits for "x"
if (x<=0 || x>=gameFrameWidth-width) {
// set the velocity for the x Position
velX = -velX;
// the constrain() will make sure that "x" does not go less than 0 and not greater than (gameFrameWidth-width)
x = constrain(x, 0, gameFrameWidth-width);
}
// collision with limits for "y"
if (y<=0 || y>=gameFrameHeight-height) {
velY = -velY;
y = constrain(y, 0, gameFrameHeight-height);
}
xcentre = x+width/2;
ycentre = y+height/2;
// We check if the ball is colliding with the paddle
// input parameter is the "rectangle" variables defined in the Paddle class
// Remember: the "paddle" is an object of type Paddle - and this class has an instance variable named "rectangle" ...
// This function will return "result"
// collision with paddle
int result = checkCollisionWithRectangle(paddle.rectangle);
// if collides on top, control direction of ball
// if (result == 1){
//if(xcentre < paddle.rectangle.x1+paddle.rectangle.width/2){
// if(velX>0){
// velX = -velX*2;
// }
// }else{
// if(velX<0){
// velX = -velX/3;
//}
//}
// }
//We detect collision with the bricks if the result is "0"
if (result == 0) {
// iterate through the array of Bricks
for (int i=0; i<bricks.length; i++) {
// Check if the brick is alive ( imAlive is a boolean - so if TRUE...)
if (bricks[i].imAlive) {
/*We check if the ball is collidiing with the paddle
Input parameter is the "rectangle" variables defined in the Brick class
Remember: the "bricks[i]" is an object of type Brick - and this class has
an instance variable named "rectangle" (Every brick instance has its own "rectangle" var)*/
// This function will return "res"
int res = checkCollisionWithRectangle(bricks[i].rectangle);
// if the returned "res" s not 0 then kill this brick.
if (res != 0) {
bricks[i].die();
break;
}
}
}
}
// keep track of the current x and y vars (make a copy)
ox = x;
oy = y;
}
/********************************************************************************
Function: checkCollisionWithRectangle()
Input Paramer: A Rectangle "tempRect"
Returns: an integer:
result: 0: no collision 1: top 2: right 3: bottom 4: left 5: couldn't detect which side
*********************************************************************************/
int checkCollisionWithRectangle (Rectangle R) {
// define the result variable
int result = 0;
// check if the rectangle given (ie the paddle) is being touched by the ball
// xcentre, ycentre are ball position variables
// doesPointTouchMe() is located in the Rectangle class...
// if it returns TRUE then execute this clause
if (R.doesPointTouchMe(xcentre, ycentre)) {
//check which side of the tempRect object has the ball touched.
// This line is easier to work with when we want to check how
//the ball has collided with the Rectangle object instead of using the ball itself...
Line2D lineaBola = new Line2D.Float(xcentre, ycentre, ox+width/2, oy+height/2);
// whatSideDoesLineTouch() is located in the Rectangle class...
// if it returns TRUE then execute this clause
result = R.whatSideDoesLineTouch(lineaBola, velX, velY);
// have to perhaps change the position & velocity parameters of the ball
// top
if (result==1) {
velY = -velY;
y = R.y1-height;
// right
}
else if (result==2) {
velX = -velX;
x = R.x2;
// bottom
}
else if (result==3) {
velY = -velY;
y = R.y2;
// left
}
else if (result==4) {
velX = -velX;
x = R.x1-width;
}
else {
result = 20;
}
}
// return the correct result ... also remember
//if this result!=0 then the brick touched will die...
return result;
}
/*********************************************************************************/
}// End of Ball Class Definition
/********************************************************************************
Defintion of the Brick Class:
The Brick Class is used to define a Brick object in the game.
It makes use of the Rectangle Class.
**********************************************************************************/
public class Brick
{
// Define an a local variable "rectangle" to represent an object of type Rectangle
Rectangle rectangle;
// local Variables that represent the properties of a Brick object
boolean hasStroke = true; //make change here
color strokeColor = 0; // make change here
boolean hasFill = true; //make change here
color fillColor = 157; // make change here
//
int x = 500; //make change here
int y = 100; //make change here
//
boolean respawns = true; //make change here
int timeToRespawn = 20; // time is in frames
// time is in frames
int frame;
boolean imAlive;
/********************************************************************************
Brick Class Default Constructor:
In order to create an Instance of a Brick Object, one needs to invoke
the Default Constructor in the following manner:
new Brick(rectX, rectY, rectWidth,rectHeight, hasStroke, strokeDef, hasFill, fillColour).
The Brick Constructor makes an instance of the Rectangle Class.
/********************************************************************************/
Brick(int X, int Y, int W, int H, boolean HASSTROKE, color STROKE, boolean HASFILL, color FILL) {
// make an instance of the Rectangle object
rectangle = new Rectangle(W, H, HASSTROKE, STROKE, HASFILL, FILL);
// call the setPosition() function of the rectangle ( the function is within the Rectangle class...)
rectangle.setPosition(X, Y);
imAlive = false;
}
/********************************************************************************
Function: refresh()
Returns: nothing.
Maintains the state of the given Brick on the Screen.
The refresh() method checks the state of the Brick (alive or dead)
/ if a new one should be created - if it is alive it will call the drawYourself().
**********************************************************************************/
void refresh() {
if (imAlive) {
// Remember that a Brick has been defined as an object rectangle of type Rectangle.
// Therefore the drawYourself() function is within the Rectangle Class...
rectangle.drawYourself();
}
else {
if (respawns) {
frame++;
if (frame>timeToRespawn-10) {
// rise up from your grave, brick
imAlive=true;
}
}
}
}
/********************************************************************************
Function: die()
Returns: nothing.
Maintains the state of a Brick. If a Brick is "dead", it is removed from the screen.
*********************************************************************************/
void die() {
imAlive = false;
frame = 2;
}
}// End of Brick Class Definition
/********************************************************************************
Defintion of the Paddle Class:
The Paddle Class is used to define the Paddle object in the game.
It makes use of the Rectangle Class.
*********************************************************************************/
public class Paddle {
/********************************************************************************
Paddle Class Instance Variables:
These Instance Variables will be initialised(defined)when an Instance of the
Paddle Class is invoked by calling the default constructor new Paddle().
/*********************************************************************************/
// Define an a local variable "rectangle" to represent an object of type Rectangle
Rectangle rectangle;
// Paddle Variables
int width = 200;
int height = 50;
// boolean variables
boolean hasStroke = false;
boolean hasFill = true;
// color variables make change here
//#333F48
color strokeColor = #102F48;
//#333F48
color fillColor = #100F48;
//
int x = gameFrameWidth/2;
int y = 370;
/********************************************************************************
Paddle Class Default Constructor -
In order to create an Instance of a Paddle Object, one needs to invoke
the Default Constructor in the following manner new Paddle().
The Paddle Class makes an instance of the Rectangle Class.
*********************************************************************************/
Paddle() {
rectangle = new Rectangle(width, height, hasStroke, strokeColor, hasFill, fillColor);
rectangle.setPosition(x, y);
}
/********************************************************************************
Function: refresh()
Returns: nothing.
Maintains the Position of the Paddle on the Screen.
The refresh() method call the updatePosition() method, and there after
the setPosition() and redraws itself to the screen (with the drawYourself()).
/******************************************************************************** */
void refresh() {
updatePosition();
// Update the Position of the Rectangle (Paddle) Object
// this function is in THIS class...
rectangle.setPosition(x, y);
// now set the position ...
rectangle.drawYourself();
// Remember that a Paddle has been defined as an object rectangle of type Rectangle.
// Therefore the drawYourself() function is within the Rectangle Class...
}
/********************************************************************************
Function: updatePosition()
Returns: nothing.
Calculates the "real" time positioning of the Paddle.
*********************************************************************************/
void updatePosition() {
x = mouseX-recX-width/2;
x = constrain(x, 0, gameFrameWidth-width);
}
/********************************************************************************/
} // End of Paddle Class Definition
rectangle class
Copy code
// import the necessary library
import java.awt.geom.*;
/********************************************************************************
Defintion of the Rectangle Class:
The Rectangle Class is used to define every visible object in the game
(The game frame, the bricks, the paddle and the ball)
*********************************************************************************/
public class Rectangle {
int width;
int height;
//change here for the color
boolean hasStroke = false;
color strokeColor;
boolean hasFill = true;
color fillColor;
color opacity;
int x1;
int y1;
int x2;
int y2;
/********************************************************************************
Rectangle Class Default Constructor -
Rectangle(int widthOfRect, int heightOfRect, boolean hasStroke, color strokeColor, boolean fillIsHere, color tempFILL) {
// set the values of the instance variables to the given arguements.
width = widthOfRect;
height = heightOfRect;
hasStroke = hasStroke;
strokeColor = strokeColor;
hasFill = fillIsHere;
fillColor = tempFILL;
//change here 205
opacity = 505;
}
/*********************************************************************************
Function: setPosition(int posX, int posY)
void setPosition(int newX, int newY) {
x1 = newX;
y1 = newY;
x2 = x1+width;
y2 = y1+height;
}
/*********************************************************************************
Function: drawYourself()
void drawYourself() {
// Check if this Rectangle has to a stroke property enabled, if so, apply the stroke property.
if (hasStroke) {
stroke(strokeColor);
}
else {
noStroke();
}
// Check if this Rectangle is fill property enabled, if so, apply the fill property.
if (hasFill) {
fill(fillColor, opacity);
}
else {
noFill();
}
// Draw the Rectangle and enabled propoerties. make change here
rect(recX+x1, recY+y1, width/2, height/2);
}
/*********************************************************************************
Function: doesPointTouchMe()
Returns: boolean.
The doesPointTouchMe Method implements a collision detetction algorithm, if the points (pX, pY)
are discovered to be within the bounds of the Rectangle Object(i.e a Brick, Paddle...).
Then the object (ball object) represented by position (pX, pY), indeed touches that Rectangle object.
*********************************************************************************/
boolean doesPointTouchMe (int PX, int PY) {
// Set the return variable to false, assume that the Rectangle is not Touched.
boolean result = false;
// Check the if pX is found inside the x coordinates of the current Rectangle
if (PX >= x1 && PX <= x2) {
// Check if pY is found inside the y coordinates of the current Rectangle
if (PY >= y1 && PY <= y2) {
// If we reach this statement, then the Rectangle has been Touched.
result = true;
}
}
return result;
}
/*********************************************************************************
Function: whatSideDoesLineTouch()
Input Parameters: tempLine (represents the side of the ball that has touched the other Rectangle object)
velX, velY (velocity parameters of the ball)
Returns: an int (represnts the side of the touched Rectangle oject) - touched BY the ball..
This function determines which side of the Rectangle object that called this function (i.e. a Brick)
has been touched by the Ball object
/*********************************************************************************/
int whatSideDoesLineTouch (Line2D LINE, int VELX, int VELY) {
// local variable to represent the side
Line2D side;
// condition check based on velY value
// top touched will return (1) and bottom touched will return(3)
if (VELY>0) {
// create an instance of a 2D Line
side = new Line2D.Float(x1, y1, x2, y1);
// check if our line representing the side of the "ball" intersects the side.
// Note: the function intersectsLine is deined in the Line2D class which is from the
// java.awt.geom library
if (LINE.intersectsLine(side)) {
return 1;
}
}
else if (VELY<0) {
side = new Line2D.Float(x1, y2, x2, y2);
if (LINE.intersectsLine(side)) {
return 3;
}
}
// left touched will return (4) / right touched will return (2)
if (VELX>0) {
side = new Line2D.Float(x1, y1, x1, y2);
if (LINE.intersectsLine(side)) {
return 4;
}
}
else if (VELX<0) {
side = new Line2D.Float(x2, y1, x2, y2);
if (LINE.intersectsLine(side)) {
return 2;
}
}
return 0;
}
} | 1 |
8,522,449 | 12/15/2011 15:26:26 | 935,375 | 09/02/2011 14:30:48 | 72 | 3 | From C to Shell: About "system" instruction. | I´m trying to convert some C/C++ code to UNIX shell. I´ve some conversions but, sometimes, I find the code in C/C++ odd, maybe because I do not understand it in the context. Even more, the client did not give me the input/output files or documentation, so it is terrible difficult for coding in UNIX.
I got this:
int exec_ftpcmd(char *ftpcmd, char *IP_Server, char* icmd)
{
int cmd_st = 0;
FILE *cmd_file;
char *cmd_fname = "ftp_exe.cmd",
*out_fname = "ftp_exe.out",
cmd[100];
printf("ftp_serv: exec_ftpcmd [%s][%s] \n",icmd,ftpcmd);
cmd_file = fopen(cmd_fname,"w");
#ifndef UNIX
fprintf(cmd_file,"user test test1\n"); //just for dos
#endif
if (strlen(icmd)>0) fprintf(cmd_file,"cd %s\n",icmd);
fprintf(cmd_file,"%s\n",ftpcmd);
fprintf(cmd_file,"quit ");
fclose(cmd_file);
memset(cmd,0,sizeof(cmd));
#ifdef UNIX
sprintf(cmd,"more %s | ftp -v %s >> %s",cmd_fname,IP_Server,out_fname); //unix
#else
sprintf(cmd,"ftp -n -s:%s %s >> %s",cmd_fname,IP_Server,out_fname); //dos
#endif
cmd_st = system(cmd);
return cmd_st;
}
I think that I read from a file that has a lot of commands, and test it with "system", to see if they are OK? Could I do the same in UNIX with **exec**?
I read [here](http://pubs.opengroup.org/onlinepubs/009604499/functions/system.html "About the perils of System!") that **system** has some perils. It is safe to use it in this context?
So, which one is good equivalence of **system**? Should I use it? Is there a more elegant way?
| c | shell | null | null | null | null | open | From C to Shell: About "system" instruction.
===
I´m trying to convert some C/C++ code to UNIX shell. I´ve some conversions but, sometimes, I find the code in C/C++ odd, maybe because I do not understand it in the context. Even more, the client did not give me the input/output files or documentation, so it is terrible difficult for coding in UNIX.
I got this:
int exec_ftpcmd(char *ftpcmd, char *IP_Server, char* icmd)
{
int cmd_st = 0;
FILE *cmd_file;
char *cmd_fname = "ftp_exe.cmd",
*out_fname = "ftp_exe.out",
cmd[100];
printf("ftp_serv: exec_ftpcmd [%s][%s] \n",icmd,ftpcmd);
cmd_file = fopen(cmd_fname,"w");
#ifndef UNIX
fprintf(cmd_file,"user test test1\n"); //just for dos
#endif
if (strlen(icmd)>0) fprintf(cmd_file,"cd %s\n",icmd);
fprintf(cmd_file,"%s\n",ftpcmd);
fprintf(cmd_file,"quit ");
fclose(cmd_file);
memset(cmd,0,sizeof(cmd));
#ifdef UNIX
sprintf(cmd,"more %s | ftp -v %s >> %s",cmd_fname,IP_Server,out_fname); //unix
#else
sprintf(cmd,"ftp -n -s:%s %s >> %s",cmd_fname,IP_Server,out_fname); //dos
#endif
cmd_st = system(cmd);
return cmd_st;
}
I think that I read from a file that has a lot of commands, and test it with "system", to see if they are OK? Could I do the same in UNIX with **exec**?
I read [here](http://pubs.opengroup.org/onlinepubs/009604499/functions/system.html "About the perils of System!") that **system** has some perils. It is safe to use it in this context?
So, which one is good equivalence of **system**? Should I use it? Is there a more elegant way?
| 0 |
9,413,977 | 02/23/2012 13:26:31 | 80,911 | 03/21/2009 17:47:45 | 6,944 | 359 | Twitter bootstrap: looking to read some objective reviews | We are currently looking into [Twitter Bootstrap][1].
So far I've heard a lot of people speak with excitement about it. So we're reviewing this, and it's hard to find some founded opinions on why committing to something like bootstrap may also be a bad idea.
This is important for me to get a bit of a clear picture. A lot of frameworks have a bit of a trend to be really useful for rapid development early on, but then get in your way as your application advances.
So I'm not looking to hear why Bootstrap is good or bad, that would instantly close this question I'm sure, but I would love to know if there is some more reading material out there that will help be make an informed decision.
[1]: http://twitter.github.com/bootstrap/ | twitter-bootstrap | null | null | null | null | 02/24/2012 11:16:14 | off topic | Twitter bootstrap: looking to read some objective reviews
===
We are currently looking into [Twitter Bootstrap][1].
So far I've heard a lot of people speak with excitement about it. So we're reviewing this, and it's hard to find some founded opinions on why committing to something like bootstrap may also be a bad idea.
This is important for me to get a bit of a clear picture. A lot of frameworks have a bit of a trend to be really useful for rapid development early on, but then get in your way as your application advances.
So I'm not looking to hear why Bootstrap is good or bad, that would instantly close this question I'm sure, but I would love to know if there is some more reading material out there that will help be make an informed decision.
[1]: http://twitter.github.com/bootstrap/ | 2 |
6,023,915 | 05/16/2011 21:57:37 | 562,972 | 01/04/2011 18:30:13 | 11 | 1 | GWT HTTP Response getText() as Binary | I'm working on a GWT App that makes a REST call for **binary** data. I'm trying to use GWT's RequestBuilder. The problem is that the response only offers a getText() method.
Here's the simplest example that reproduces the problem:
private static void sendRequest()
{
String url = URL.encode("/object/object_id");
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
try
{
requestBuilder.sendRequest("", new RequestCallback()
{
@Override
public void onResponseReceived(Request request, Response response)
{
String data = response.getText(); ///< Need this to be a byte[] array (e.g. getData())
}
@Override
public void onError(Request request, Throwable exception)
{
}
});
}
catch (RequestException RequestException)
{
}
}
The problem is that GWT is encoding the response data as a String in (what I think) is the default platform's encoding. Is there any way to get the data before GWT converts it to a String? | javascript | gwt | get | request | httprequest | null | open | GWT HTTP Response getText() as Binary
===
I'm working on a GWT App that makes a REST call for **binary** data. I'm trying to use GWT's RequestBuilder. The problem is that the response only offers a getText() method.
Here's the simplest example that reproduces the problem:
private static void sendRequest()
{
String url = URL.encode("/object/object_id");
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
try
{
requestBuilder.sendRequest("", new RequestCallback()
{
@Override
public void onResponseReceived(Request request, Response response)
{
String data = response.getText(); ///< Need this to be a byte[] array (e.g. getData())
}
@Override
public void onError(Request request, Throwable exception)
{
}
});
}
catch (RequestException RequestException)
{
}
}
The problem is that GWT is encoding the response data as a String in (what I think) is the default platform's encoding. Is there any way to get the data before GWT converts it to a String? | 0 |
1,180,440 | 07/24/2009 22:14:47 | 115,608 | 06/01/2009 19:31:12 | 85 | 3 | Jquery: Using the attr with made up attributes | Right now I'm doing various insemantic things like:
<span time="50" distance="60"/>
And then grabbing that info with:
var time = $('span').attr('time');
var distance = $('span').attr('time');
And then doing various things with the time and distance in jS/Query
To me, this feels wrong. It's insemantic, but I really can't care less about that (actual data is not time and distance but something quite worthless and page specific, nothing that SEs are interested in). But is there some other reason why this is a bad idea?
I know there's a metadata plugin which does something similar in a more 'official' way, and I thought about using it. But this .attr stuff is suitable for my needs and I don't see any compelling reason to use the plugin.
So basically, is this a decent pattern to use, and if not, why not, and should I be interested in the metadata plugin.
Thanks. | jquery | null | null | null | null | null | open | Jquery: Using the attr with made up attributes
===
Right now I'm doing various insemantic things like:
<span time="50" distance="60"/>
And then grabbing that info with:
var time = $('span').attr('time');
var distance = $('span').attr('time');
And then doing various things with the time and distance in jS/Query
To me, this feels wrong. It's insemantic, but I really can't care less about that (actual data is not time and distance but something quite worthless and page specific, nothing that SEs are interested in). But is there some other reason why this is a bad idea?
I know there's a metadata plugin which does something similar in a more 'official' way, and I thought about using it. But this .attr stuff is suitable for my needs and I don't see any compelling reason to use the plugin.
So basically, is this a decent pattern to use, and if not, why not, and should I be interested in the metadata plugin.
Thanks. | 0 |
10,809,220 | 05/30/2012 02:26:12 | 1,424,127 | 05/29/2012 15:45:10 | 21 | 1 | C# vs C++ pass by reference handling | Here is the question in book:
In functions, what is the difference of passing a parameter by-value and by-reference? State one advantage that c# ha compared with c++ in the way passing by reference is handled.
I know the difference of passing a parameter by-value and by-reference but what advantage have c# compared with c++? | c# | c++ | comparison | pass-by-reference | pass-by-value | 05/30/2012 02:37:50 | not constructive | C# vs C++ pass by reference handling
===
Here is the question in book:
In functions, what is the difference of passing a parameter by-value and by-reference? State one advantage that c# ha compared with c++ in the way passing by reference is handled.
I know the difference of passing a parameter by-value and by-reference but what advantage have c# compared with c++? | 4 |
7,241,792 | 08/30/2011 10:24:09 | 919,493 | 08/30/2011 10:24:09 | 1 | 0 | C# Socket Programming - Connection between two computers | Am new to socket programming.Can you please help me with this issue
I need to connect two computers which is already under some network using C#
After it gets connected I need to know the details of the "Task Manager" - (If any pogram/file is running it should show its status )
I dont know how and where to start. Can you please guide me.
| c# | null | null | null | null | 02/08/2012 14:32:00 | not a real question | C# Socket Programming - Connection between two computers
===
Am new to socket programming.Can you please help me with this issue
I need to connect two computers which is already under some network using C#
After it gets connected I need to know the details of the "Task Manager" - (If any pogram/file is running it should show its status )
I dont know how and where to start. Can you please guide me.
| 1 |
10,786,817 | 05/28/2012 15:10:00 | 864,951 | 07/27/2011 08:21:40 | 254 | 14 | Jquery ajax returning extra information | I want to return a string from a jquery ajax request but its returning my string and also some other stuff. I think its asp webservice information.
Here's my jquery request
jQuery.ajax(
{
type: "GET",
url: "../WebService.asmx/GetProductLink",
data: 'productId=' + productId + '&companyId=' + companyId,
contentType: "application/text; charset=utf-8",
dataType: "text",
success: function (data) {
console.log(data);
}
});
and here's what is returned on success
<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org/">http://www.facebook.com/Soundworkz</string>
The part i want is the http://www.facebook.com/Soundwork part.
Thanks | c# | jquery | web-services | jquery-ajax | null | null | open | Jquery ajax returning extra information
===
I want to return a string from a jquery ajax request but its returning my string and also some other stuff. I think its asp webservice information.
Here's my jquery request
jQuery.ajax(
{
type: "GET",
url: "../WebService.asmx/GetProductLink",
data: 'productId=' + productId + '&companyId=' + companyId,
contentType: "application/text; charset=utf-8",
dataType: "text",
success: function (data) {
console.log(data);
}
});
and here's what is returned on success
<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org/">http://www.facebook.com/Soundworkz</string>
The part i want is the http://www.facebook.com/Soundwork part.
Thanks | 0 |
10,671,486 | 05/20/2012 07:08:40 | 963,725 | 09/25/2011 14:59:34 | 13 | 1 | What is the use of barcode in php? | I have seen a lot of tutorials and articles showing how to generate barcode with Php using Gd library and Pear. But frankly saying i have no idea what is the use of generating them.
Like in retail stores barcodes are printed on a paper to scan and get details of a particular product. But what is the use of barcodes on the web ?
Thanks | php | gd | null | null | null | 05/20/2012 08:01:06 | not constructive | What is the use of barcode in php?
===
I have seen a lot of tutorials and articles showing how to generate barcode with Php using Gd library and Pear. But frankly saying i have no idea what is the use of generating them.
Like in retail stores barcodes are printed on a paper to scan and get details of a particular product. But what is the use of barcodes on the web ?
Thanks | 4 |
10,398,395 | 05/01/2012 13:31:36 | 1,367,729 | 05/01/2012 12:31:48 | 1 | 0 | c# OAuth basic understanding | I am really struggling with the understanding of OAuth. For a project I am trying to create a consumer role that does not utilise tokens.
I have managed to create the required details in the code behind like so
string outUrl = "";
string querystring = "";
string consumerKey = "82ad8188-b949-eff8-c5b1-f801b74cfc89";
string consumerSecret = "c031956b-1916-d1f7-2cf9-aa52aaad4dfa";
Uri uri = new Uri("http://pebblepad.co.uk/sandbox/interop/oauth/login.aspx");
oAuthBase2 oAuth = new oAuthBase2();
string nonce = oAuth.GenerateNonce();
string timeStamp = oAuth.GenerateTimeStamp();
string sig = oAuth.GenerateSignature(uri, consumerKey, consumerSecret, string.Empty, string.Empty,
"POST", timeStamp, nonce, oAuthBase2.SignatureTypes.HMACSHA1, out outUrl,
out querystring);
From here I don't understand what to do next. I am not an experienced programmer and most examples I have found don't even include coding example.
Please help, I am in desperate need :( | c# | .net | oauth | null | null | null | open | c# OAuth basic understanding
===
I am really struggling with the understanding of OAuth. For a project I am trying to create a consumer role that does not utilise tokens.
I have managed to create the required details in the code behind like so
string outUrl = "";
string querystring = "";
string consumerKey = "82ad8188-b949-eff8-c5b1-f801b74cfc89";
string consumerSecret = "c031956b-1916-d1f7-2cf9-aa52aaad4dfa";
Uri uri = new Uri("http://pebblepad.co.uk/sandbox/interop/oauth/login.aspx");
oAuthBase2 oAuth = new oAuthBase2();
string nonce = oAuth.GenerateNonce();
string timeStamp = oAuth.GenerateTimeStamp();
string sig = oAuth.GenerateSignature(uri, consumerKey, consumerSecret, string.Empty, string.Empty,
"POST", timeStamp, nonce, oAuthBase2.SignatureTypes.HMACSHA1, out outUrl,
out querystring);
From here I don't understand what to do next. I am not an experienced programmer and most examples I have found don't even include coding example.
Please help, I am in desperate need :( | 0 |
9,707,338 | 03/14/2012 17:53:22 | 710,137 | 04/15/2011 15:54:11 | 8 | 1 | How to Retain the Styling / Hover Functionality of Image Hyperlinks in a GridView TemplateField using ImageButtons | Within each row of a GridView (using the TemplateField), I would like to display image buttons that will be used to control the data in that row. I would then like to swap out the images of the buttons when a user first hovers over the GridView row and then again when the user hovers over a specific button.
I can easily accomplish this hover functionality using CSS and image hyperlinks, however when using image hyperlinks, I am unable to raise any server-side events to handle editing the particular row.
In the past, I've used ImageButtons instead of image hyperlinks. I added the CommandName parameter to the ImageButtons and then handled the GridView RowCommand in code:
<asp:ImageButton ID="btnSelect" CommandName="select" runat="server" ImageUrl="~/images/iconSelect.png" />
In order to change the ImageButton image on hover, I used Javascript:
<asp:ImageButton ID="btnSelect" onmouseover="this.src='../images/iconSelectOver.png';" onmouseout="this.src='../images/iconSelect.png';" runat="server" ImageUrl="~/images/iconSelect.png" />
However, in this case, I need to also replace the ImageButton image when a user first hovers over the GridView row itself.
To sum up, when a user hovers over a GridView row, the ImageButtons on that row will all swap image1 for image2. Then when a user hovers over a specific ImageButton, its image will switch from image2 to image 3.
Thanks in advance for any suggestions you may have as to the best approach.
| javascript | gridview | hover | imagebutton | templatefield | null | open | How to Retain the Styling / Hover Functionality of Image Hyperlinks in a GridView TemplateField using ImageButtons
===
Within each row of a GridView (using the TemplateField), I would like to display image buttons that will be used to control the data in that row. I would then like to swap out the images of the buttons when a user first hovers over the GridView row and then again when the user hovers over a specific button.
I can easily accomplish this hover functionality using CSS and image hyperlinks, however when using image hyperlinks, I am unable to raise any server-side events to handle editing the particular row.
In the past, I've used ImageButtons instead of image hyperlinks. I added the CommandName parameter to the ImageButtons and then handled the GridView RowCommand in code:
<asp:ImageButton ID="btnSelect" CommandName="select" runat="server" ImageUrl="~/images/iconSelect.png" />
In order to change the ImageButton image on hover, I used Javascript:
<asp:ImageButton ID="btnSelect" onmouseover="this.src='../images/iconSelectOver.png';" onmouseout="this.src='../images/iconSelect.png';" runat="server" ImageUrl="~/images/iconSelect.png" />
However, in this case, I need to also replace the ImageButton image when a user first hovers over the GridView row itself.
To sum up, when a user hovers over a GridView row, the ImageButtons on that row will all swap image1 for image2. Then when a user hovers over a specific ImageButton, its image will switch from image2 to image 3.
Thanks in advance for any suggestions you may have as to the best approach.
| 0 |
11,503,677 | 07/16/2012 11:50:54 | 1,338,488 | 04/17/2012 10:36:55 | 13 | 0 | Bing or Google MAPS to draw a route | i have Lattitudes and longitudes in a database, i want to draw a route using Bing or Google Maps in ASP.NET. Can any body guide me towards some example or web link to get idea how to do it? | asp.net | google-maps | bing-maps | null | null | 07/16/2012 14:26:39 | not a real question | Bing or Google MAPS to draw a route
===
i have Lattitudes and longitudes in a database, i want to draw a route using Bing or Google Maps in ASP.NET. Can any body guide me towards some example or web link to get idea how to do it? | 1 |
538,390 | 02/11/2009 19:32:22 | 53,587 | 01/10/2009 00:09:59 | 64 | 14 | Need recommendation for Bug Tracking and Resource Scheduling software | I am looking to evaluate a two tools. I am looking for a resource scheduling tool, which we need to use to schedule time on different lab equipment, and a bug tracking tool, which is for internal use to track bugs (obviously). I was wondering if there is a tool that combines the two tools. Also, with regards to the bug tracking software, I am looking for a very simple tracking tool. I don't need a million fields and what not. | bug-tracking | resource-scheduling | null | null | null | 09/05/2011 17:45:17 | not constructive | Need recommendation for Bug Tracking and Resource Scheduling software
===
I am looking to evaluate a two tools. I am looking for a resource scheduling tool, which we need to use to schedule time on different lab equipment, and a bug tracking tool, which is for internal use to track bugs (obviously). I was wondering if there is a tool that combines the two tools. Also, with regards to the bug tracking software, I am looking for a very simple tracking tool. I don't need a million fields and what not. | 4 |
8,883,428 | 01/16/2012 16:56:24 | 547,198 | 12/18/2010 18:50:58 | 356 | 7 | Points on a 2D plane |
Given a set of points (x,y) in a 2-d plane, which are guesses of a particular unknown point (x',y'), how do find the best estimate of (x',y') using the set of points given. This is an interview question I found on an online forum. Can somebody please suggest something? My take: take the average of all x values, take the average of all y values. Find the standard deviation for the x values, and the standard deviation for the y values. Then the x is estimated by its mean, and the y by its mean.
Is there a better or more precise or standard way to do this? | algorithm | graph-algorithm | null | null | null | 01/17/2012 03:15:53 | off topic | Points on a 2D plane
===
Given a set of points (x,y) in a 2-d plane, which are guesses of a particular unknown point (x',y'), how do find the best estimate of (x',y') using the set of points given. This is an interview question I found on an online forum. Can somebody please suggest something? My take: take the average of all x values, take the average of all y values. Find the standard deviation for the x values, and the standard deviation for the y values. Then the x is estimated by its mean, and the y by its mean.
Is there a better or more precise or standard way to do this? | 2 |
6,891,782 | 07/31/2011 19:32:32 | 580,621 | 01/18/2011 22:08:50 | 1 | 0 | ImageMagick: How to use "Only Shrink Larger Images" ('>' flag) both on windows and unix | I found this description on website http://www.imagemagick.org/Usage/resize/#shrink :
> Only Shrink Larger Images ('>' flag) Another commonly used option is
> to restrict IM so that it will only shrink images to fit into the size
> given. Never enlarge. This is the '>' resize option.
>
> Example: <pre>convert dragon.gif -resize 64x64\\> shrink_dragon.gif</pre>
>
> The Only Shrink Flag ('>' flag) is a special character in Window batch
> scripts and you will need to escape that character, using '^>', or it
> will not work.
So as I understand this flag ('>') could only work either on windows ^> or unix /> .
Is there any way to create command that will work both on windows and unix?
I use imagemagick with php, so I've got unix on production webserver, but windows on localhost.
Thank you.
| windows | unix | resize | imagemagick | shrink | null | open | ImageMagick: How to use "Only Shrink Larger Images" ('>' flag) both on windows and unix
===
I found this description on website http://www.imagemagick.org/Usage/resize/#shrink :
> Only Shrink Larger Images ('>' flag) Another commonly used option is
> to restrict IM so that it will only shrink images to fit into the size
> given. Never enlarge. This is the '>' resize option.
>
> Example: <pre>convert dragon.gif -resize 64x64\\> shrink_dragon.gif</pre>
>
> The Only Shrink Flag ('>' flag) is a special character in Window batch
> scripts and you will need to escape that character, using '^>', or it
> will not work.
So as I understand this flag ('>') could only work either on windows ^> or unix /> .
Is there any way to create command that will work both on windows and unix?
I use imagemagick with php, so I've got unix on production webserver, but windows on localhost.
Thank you.
| 0 |
175,876 | 10/06/2008 19:46:11 | 23,486 | 09/29/2008 15:26:21 | 11 | 0 | how do i fix my virtual machine network connection if it seems to be running ok from the host | I have a virtual machine (made with vmware) with a linux ubuntu os installed on it (i have a series of them), with NAT network connection - i am running vmware on Windows XP (my host system); the virtual machine can't connect to the internet. All the vmware services seem to be working fine from windows point of view, but inside the machine i can't connect to the internet. What is strange is that the virtual machine was able to use the internet some time ago, but all of a sudden, i just can't use my internet on the virtual machine - i have made no changes to the settings, nor in windows, nor in the virtual machine - so i don't understand. | virtual-machine | vmware | null | null | null | 02/08/2012 15:08:18 | off topic | how do i fix my virtual machine network connection if it seems to be running ok from the host
===
I have a virtual machine (made with vmware) with a linux ubuntu os installed on it (i have a series of them), with NAT network connection - i am running vmware on Windows XP (my host system); the virtual machine can't connect to the internet. All the vmware services seem to be working fine from windows point of view, but inside the machine i can't connect to the internet. What is strange is that the virtual machine was able to use the internet some time ago, but all of a sudden, i just can't use my internet on the virtual machine - i have made no changes to the settings, nor in windows, nor in the virtual machine - so i don't understand. | 2 |
11,048,379 | 06/15/2012 09:49:51 | 1,113,009 | 12/23/2011 07:36:24 | 80 | 5 | vss pulgin in jenkins | I installed jenkins in windows 64bit version(with java version 64bit)
Downloaded latest VSS Plugin and i am getting this error
Started by user anonymous
FATAL: D:\java\build\hudson\plugins\vss\WEB-INF\lib\com4j.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
java.lang.UnsatisfiedLinkError: D:\java\build\hudson\plugins\vss\WEB-INF\lib\com4j.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
i installed java 32 bit version still i am getting above error.
please help me..
| jenkins | visual-sourcesafe | null | null | null | null | open | vss pulgin in jenkins
===
I installed jenkins in windows 64bit version(with java version 64bit)
Downloaded latest VSS Plugin and i am getting this error
Started by user anonymous
FATAL: D:\java\build\hudson\plugins\vss\WEB-INF\lib\com4j.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
java.lang.UnsatisfiedLinkError: D:\java\build\hudson\plugins\vss\WEB-INF\lib\com4j.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
i installed java 32 bit version still i am getting above error.
please help me..
| 0 |
3,804,262 | 09/27/2010 13:32:01 | 275,390 | 02/17/2010 16:09:58 | 440 | 28 | css help, displaying image with div | below is the code that i am using to display div with image but whats happening that, when the page loads i see the image first and than after i save the image i see the div msg and than image and div disappears (as it suppose to)
<div id="divStatus"></div>
<style type="text/css">
#divStatus {
background:transparent url(../images/ico_confirmation_sml.gif) no-repeat scroll 0 0;
padding-left: 22px;
min-height: 27px;
}
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), key, "$(function() { $('#divStatus').html('" + msg + "').show().fadeIn(800).fadeOut(9000); });", true);
| asp.net | css | null | null | null | null | open | css help, displaying image with div
===
below is the code that i am using to display div with image but whats happening that, when the page loads i see the image first and than after i save the image i see the div msg and than image and div disappears (as it suppose to)
<div id="divStatus"></div>
<style type="text/css">
#divStatus {
background:transparent url(../images/ico_confirmation_sml.gif) no-repeat scroll 0 0;
padding-left: 22px;
min-height: 27px;
}
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), key, "$(function() { $('#divStatus').html('" + msg + "').show().fadeIn(800).fadeOut(9000); });", true);
| 0 |
2,826,720 | 05/13/2010 12:30:48 | 340,018 | 05/13/2010 07:17:48 | 3 | 0 | How do I use the Zend Youtube API correctly? | I am trying to access the YouTube API with the Zend libraries that I have included like this (the full path to the Zend library is components/lib/Zend/Gdata.php):
<pre>
//Include Zend Gdata
set_include_path('components/lib');
include("Zend/Gdata.php");
</pre>
I now try to use the framework thus:
<pre>
//Access video data via Zend library
$yt = new Zend_Gdata_YouTube();
</pre>
However when running the script it returns:
<pre>
Fatal error: Class 'Zend_Gdata_YouTube' not found in E:\inetpub\students\fit3060\20712510\ass2\results.php on line 48
</pre>
I think I have not included the Zend library properly or declared the include path correctly? | zend-framework | php | youtube | include | null | null | open | How do I use the Zend Youtube API correctly?
===
I am trying to access the YouTube API with the Zend libraries that I have included like this (the full path to the Zend library is components/lib/Zend/Gdata.php):
<pre>
//Include Zend Gdata
set_include_path('components/lib');
include("Zend/Gdata.php");
</pre>
I now try to use the framework thus:
<pre>
//Access video data via Zend library
$yt = new Zend_Gdata_YouTube();
</pre>
However when running the script it returns:
<pre>
Fatal error: Class 'Zend_Gdata_YouTube' not found in E:\inetpub\students\fit3060\20712510\ass2\results.php on line 48
</pre>
I think I have not included the Zend library properly or declared the include path correctly? | 0 |
5,429,194 | 03/25/2011 06:17:50 | 676,205 | 03/25/2011 06:03:58 | 1 | 0 | unresolved external symbol _NPN_MemAlloc referenced in function | i develop extension for Chrome using XPCOM and i try communicate my dll with JS all fine ! but if i try return value ( string ) from my cpp code i have crash my browser ((( me need allocate memory through NPN_MemAlloc ! but i can't because my VC2008 show me subj error !
i include on my stdafx.h
npapi.h
npfunctions.h
npruntime.h
but not result
next i add
pragma comment(lib,"xpcom.lib");
and nothing ((( Link error (((
i search on web answer for my question - and NOTHING (((
how i can fix Link error ?
i download Gecko-sdk1.9 from - mozila site and add settings to my progect
include
"C:\xulrunner-sdk\include";"C:\xulrunner-sdk\include\nspr";"C:\xulrunner-sdk\include\mozilla\plugins"
dll include in link settings
"C:\xulrunner-sdk\lib"
any can help me ? | c++ | memory | extension | xpcom | mozilla-plugin | null | open | unresolved external symbol _NPN_MemAlloc referenced in function
===
i develop extension for Chrome using XPCOM and i try communicate my dll with JS all fine ! but if i try return value ( string ) from my cpp code i have crash my browser ((( me need allocate memory through NPN_MemAlloc ! but i can't because my VC2008 show me subj error !
i include on my stdafx.h
npapi.h
npfunctions.h
npruntime.h
but not result
next i add
pragma comment(lib,"xpcom.lib");
and nothing ((( Link error (((
i search on web answer for my question - and NOTHING (((
how i can fix Link error ?
i download Gecko-sdk1.9 from - mozila site and add settings to my progect
include
"C:\xulrunner-sdk\include";"C:\xulrunner-sdk\include\nspr";"C:\xulrunner-sdk\include\mozilla\plugins"
dll include in link settings
"C:\xulrunner-sdk\lib"
any can help me ? | 0 |
9,452,339 | 02/26/2012 10:26:21 | 553,823 | 12/25/2010 13:07:29 | 484 | 7 | Delayed_jobs - clear memory between jobs | Is there a way to force DJ to "clean" the memory between jobs? its seems that currently its just accumulates memory until it exceeds the amount we gave him.
Im also working on spotting the area on the code which eats most of the memory but still would love to have the option on cleaning the memory between jobs.
any ideas? | ruby-on-rails | delayed-job | null | null | null | null | open | Delayed_jobs - clear memory between jobs
===
Is there a way to force DJ to "clean" the memory between jobs? its seems that currently its just accumulates memory until it exceeds the amount we gave him.
Im also working on spotting the area on the code which eats most of the memory but still would love to have the option on cleaning the memory between jobs.
any ideas? | 0 |
10,897,004 | 06/05/2012 12:05:42 | 1,398,391 | 05/16/2012 10:41:22 | 3 | 0 | i written a form which is visulaize to all people but | when they click on submit button checking wheather user logged in or not and then login form comes what is the way. I am new to php | php | null | null | null | null | 06/06/2012 10:07:24 | not a real question | i written a form which is visulaize to all people but
===
when they click on submit button checking wheather user logged in or not and then login form comes what is the way. I am new to php | 1 |
6,435,375 | 06/22/2011 05:37:07 | 385,251 | 07/07/2010 07:21:47 | 57 | 3 | Need some advice on reading material regarding spatial databases | I am interested to know about some reading materials(books) regarding
1)Spatial Database Systems
2)Spatial Query optimization
3)Spatial Indexing
4)Distributed Databases
Can anyone help me on this regard? | database | query | relational-database | spatial | spatial-query | 06/22/2011 17:23:22 | off topic | Need some advice on reading material regarding spatial databases
===
I am interested to know about some reading materials(books) regarding
1)Spatial Database Systems
2)Spatial Query optimization
3)Spatial Indexing
4)Distributed Databases
Can anyone help me on this regard? | 2 |
1,809,007 | 11/27/2009 14:10:44 | 177,161 | 09/22/2009 13:25:19 | 373 | 22 | Best way to detect if a stream is zipped in Java | What is the best way to find out i `java.io.InputStream` contains zipped data? | java | zip | inputstream | null | null | null | open | Best way to detect if a stream is zipped in Java
===
What is the best way to find out i `java.io.InputStream` contains zipped data? | 0 |
10,791,829 | 05/29/2012 00:38:58 | 647,405 | 03/06/2011 23:20:09 | 613 | 0 | Regex Boolean Function in PHP | I have a string that I would like to test to see if it is in the following format.
exactly seven alphabetical OR numerical characters, followed by a '_', followed by
exactly five alphabetical OR numerical characters, followed by a '_', followed by
exactly seven alphabetical OR numerical characters, followed by a '_', followed by
exactly nine alphabetical OR numerical characters.
No other characters should exist other then the above mentioned characters.
I would like a function that returns true if it matches the description or false if it does not match. | php | regex | null | null | null | 05/29/2012 10:18:57 | too localized | Regex Boolean Function in PHP
===
I have a string that I would like to test to see if it is in the following format.
exactly seven alphabetical OR numerical characters, followed by a '_', followed by
exactly five alphabetical OR numerical characters, followed by a '_', followed by
exactly seven alphabetical OR numerical characters, followed by a '_', followed by
exactly nine alphabetical OR numerical characters.
No other characters should exist other then the above mentioned characters.
I would like a function that returns true if it matches the description or false if it does not match. | 3 |
5,505,343 | 03/31/2011 19:38:58 | 618,554 | 02/15/2011 20:47:35 | 20 | 2 | what is ALT + v | in IOS when you push "Alt + v" it makes a check mark. Does anyone have any idea for the purpose of this character? | iphone | xcode | null | null | null | 04/05/2011 09:35:16 | off topic | what is ALT + v
===
in IOS when you push "Alt + v" it makes a check mark. Does anyone have any idea for the purpose of this character? | 2 |
2,067,522 | 01/14/2010 21:00:59 | 46,439 | 12/15/2008 18:30:04 | 1,783 | 52 | How to cast 1 and 0 to true and false in Ruby. | I need to index into a hash that I have defined in terms of "true" and "false"
colorHash = Hash.new { |hash, key| hash[key] = {} }
colorHash["answers"][true] = "#00CC00"
colorHash["answers"][false] = "#FFFFFF"
For testing purposes, I am indexing with rand(2) and that fails. If I index with **true** it works.
I was looking for something like
rand(2).logical
but find nothing. | ruby | null | null | null | null | null | open | How to cast 1 and 0 to true and false in Ruby.
===
I need to index into a hash that I have defined in terms of "true" and "false"
colorHash = Hash.new { |hash, key| hash[key] = {} }
colorHash["answers"][true] = "#00CC00"
colorHash["answers"][false] = "#FFFFFF"
For testing purposes, I am indexing with rand(2) and that fails. If I index with **true** it works.
I was looking for something like
rand(2).logical
but find nothing. | 0 |
11,643,126 | 07/25/2012 05:12:20 | 1,166,137 | 01/24/2012 01:45:59 | 27 | 0 | php more than 5 items create new div | I am using PHP and MYSQL.
here is my code
<?php
$result = mysql_query("SELECT * FROM `item` order by `ID` limit 0, 5");
$rows = mysql_num_rows ($result);
$item = 0 ;
while ($item < $rows){
$title = mysql_result($result,$list,"name");
$id = mysql_result($result,$list,"ID");
echo "<div id="new"> $id . $title </div> ";
$item++;
}
?>
My question is that, is it possible if the items are more than 5 (as you can see I limited items), then create a new div id=new to display the rest items?
many thanks in advance | php | null | null | null | null | null | open | php more than 5 items create new div
===
I am using PHP and MYSQL.
here is my code
<?php
$result = mysql_query("SELECT * FROM `item` order by `ID` limit 0, 5");
$rows = mysql_num_rows ($result);
$item = 0 ;
while ($item < $rows){
$title = mysql_result($result,$list,"name");
$id = mysql_result($result,$list,"ID");
echo "<div id="new"> $id . $title </div> ";
$item++;
}
?>
My question is that, is it possible if the items are more than 5 (as you can see I limited items), then create a new div id=new to display the rest items?
many thanks in advance | 0 |
7,980,705 | 11/02/2011 12:58:43 | 373,266 | 06/22/2010 14:13:46 | 102 | 0 | is there any full version of Microsoft sql server management studio | search with keyword `Microsoft sql server management studio` (without `express`) I only can find *link to download the Express Version*, so is there any full version of **management studio** ?
I'm finding some *advanced* feature like a search box to quick navigate to a table/column which Microsoft SSMSE don't support, or something like MySQL Workbench....
----------
p/s: I don't find [a free version like Hardbone][1] and I need to make my developer's life easier, so *I don't need Full Version of Server*, **I need Full Version of studio**
Thanks and best regards!
[1]: http://stackoverflow.com/questions/6787377/is-there-an-alternative-tool-to-microsoft-sql-server-management-studio | sql-server | ssms | null | null | null | 11/02/2011 16:08:25 | too localized | is there any full version of Microsoft sql server management studio
===
search with keyword `Microsoft sql server management studio` (without `express`) I only can find *link to download the Express Version*, so is there any full version of **management studio** ?
I'm finding some *advanced* feature like a search box to quick navigate to a table/column which Microsoft SSMSE don't support, or something like MySQL Workbench....
----------
p/s: I don't find [a free version like Hardbone][1] and I need to make my developer's life easier, so *I don't need Full Version of Server*, **I need Full Version of studio**
Thanks and best regards!
[1]: http://stackoverflow.com/questions/6787377/is-there-an-alternative-tool-to-microsoft-sql-server-management-studio | 3 |
6,653,791 | 07/11/2011 17:08:52 | 780,415 | 06/02/2011 02:07:49 | 1 | 0 | Would Python and Django be the best tool for a news website with a forum, or is that something better for that? | I need a website that has
- An easy to update news page
- forum
- calender
Should I use Django and Python with this? I know python pretty well, and just a little Django. I have a large time frame so I could learn a new language if necessary. | python | django | programming-languages | web-frameworks | null | 07/11/2011 17:25:17 | not constructive | Would Python and Django be the best tool for a news website with a forum, or is that something better for that?
===
I need a website that has
- An easy to update news page
- forum
- calender
Should I use Django and Python with this? I know python pretty well, and just a little Django. I have a large time frame so I could learn a new language if necessary. | 4 |
4,906,215 | 02/05/2011 10:00:28 | 372,306 | 06/21/2010 15:27:26 | 638 | 51 | Good class name needed for wrapper class that contains initialisation and configuration data for other class | Basically I'm just looking for a word that means something like "initialisation and configuration data".
(It should not be "configuration" because that would cause confusion with one of the parts of the whole). | design | name | naming | null | null | 05/06/2012 19:50:47 | off topic | Good class name needed for wrapper class that contains initialisation and configuration data for other class
===
Basically I'm just looking for a word that means something like "initialisation and configuration data".
(It should not be "configuration" because that would cause confusion with one of the parts of the whole). | 2 |
10,399,043 | 05/01/2012 14:20:49 | 574,412 | 01/13/2011 15:02:26 | 1 | 0 | what can be deleted from facebook user profile using the graph api? | Just got a shock that an app cannot delete a picture from a user profile even after getting proper permissions and valid access token. I was wondering what objects/actions can be deleted from a user profile using graph API? | facebook | application | graph | delete | profile | null | open | what can be deleted from facebook user profile using the graph api?
===
Just got a shock that an app cannot delete a picture from a user profile even after getting proper permissions and valid access token. I was wondering what objects/actions can be deleted from a user profile using graph API? | 0 |
11,692,104 | 07/27/2012 16:41:32 | 1,320,812 | 04/08/2012 21:19:31 | 8 | 1 | Contoso U tutorial: enrolling a student in a course and then adding the subsequent grade | Where in the Contoso University MVC tutorial do we get to enroll a student in a course, and then add the subsequent grade? | entity-framework | mvc | null | null | null | 07/29/2012 00:55:46 | not a real question | Contoso U tutorial: enrolling a student in a course and then adding the subsequent grade
===
Where in the Contoso University MVC tutorial do we get to enroll a student in a course, and then add the subsequent grade? | 1 |
7,723,655 | 10/11/2011 09:04:03 | 750,239 | 05/12/2011 08:52:13 | 1 | 0 | restricting sms to go into inbox | I need to restrict sms not to save in inbox. and it should be saved in some user given folder.For that im using bellow code. i can able to restrict sms notification. by using this.abortBroadCast() in my receiver clas.. But SMS is showing in Inbox.
I need restrict it entering into INBOX. And it shoulb shown in some other folder.
public class SmsReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
//this stops notifications to others
this.abortBroadcast();
//---get the SMS message passed in---
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
boolean checksomething =true ;
if (bundle != null)
{
//---retrieve the SMS message received---
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
str += "SMS from " + msgs[i].getOriginatingAddress();
str += " :";
str += msgs[i].getMessageBody().toString();
str += "\n";
}
}
if(checksomething){
Toast.makeText(context, "Broad Cast Cancelled", Toast.LENGTH_SHORT).show();
}else{
this.clearAbortBroadcast();
//---display the new SMS message---
Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
}
}
} | sms | receiver | null | null | null | null | open | restricting sms to go into inbox
===
I need to restrict sms not to save in inbox. and it should be saved in some user given folder.For that im using bellow code. i can able to restrict sms notification. by using this.abortBroadCast() in my receiver clas.. But SMS is showing in Inbox.
I need restrict it entering into INBOX. And it shoulb shown in some other folder.
public class SmsReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
//this stops notifications to others
this.abortBroadcast();
//---get the SMS message passed in---
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
boolean checksomething =true ;
if (bundle != null)
{
//---retrieve the SMS message received---
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
str += "SMS from " + msgs[i].getOriginatingAddress();
str += " :";
str += msgs[i].getMessageBody().toString();
str += "\n";
}
}
if(checksomething){
Toast.makeText(context, "Broad Cast Cancelled", Toast.LENGTH_SHORT).show();
}else{
this.clearAbortBroadcast();
//---display the new SMS message---
Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
}
}
} | 0 |
11,710,327 | 07/29/2012 15:11:12 | 1,561,121 | 07/29/2012 15:03:15 | 1 | 0 | In above ios 5.1, there is a new thing --soft HOME key. How to implement it and can we do the samething ourself? | soft HOME key. How to implement it and can we do the samething ourself ? | ios | home | null | null | null | 07/31/2012 03:50:22 | not a real question | In above ios 5.1, there is a new thing --soft HOME key. How to implement it and can we do the samething ourself?
===
soft HOME key. How to implement it and can we do the samething ourself ? | 1 |
9,820,561 | 03/22/2012 10:35:27 | 1,005,030 | 10/20/2011 10:55:08 | 344 | 8 | WCF Authentication doesn't prompt for credentials | I've created a test WCF app in which I'm trying to get Authentication to work, but it just runs my method and doesn't ask me to login / authenticate. Below is code snippets in my web.config in my WCF app:
<bindings>
<wsHttpBinding>
<binding name="Binding1">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyAPI.Authorization, App_Code" />
</serviceCredentials>
My Authorization class:
public class Authorization : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (null == userName || null == password)
{
throw new ArgumentNullException();
}
if (!(userName == "test1" && password == "1tset") && !(userName == "test2" && password == "2tset"))
{
// This throws an informative fault to the client.
throw new FaultException("Unknown Username or Incorrect Password");
// When you do not want to throw an infomative fault to the client,
// throw the following exception.
// throw new SecurityTokenException("Unknown Username or Incorrect Password");
}
}
}
My Service.svc.cs Class
public string Hello(string message)
{
return "You typed: " + message;
}
Am I supposed to put some attribute above this method to require authentication or above the class?
I have then created a Test Console Application, here is the code:
public static Test.Service1Client client = new Test.Service1Client();
static void Main(string[] args)
{
Console.WriteLine(client.Hello("hello"));
Console.ReadLine();
}
This just outputs "You typed: hello" without asking for authentication. Here is snippets of my app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://MyServer/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="Test.IService1"
name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
I would expect to have to set the login credentials before calling `client.Hello("hello")` by doing:
client.ClientCredentials.UserName.UserName = "test1";
client.ClientCredentials.UserName.Password = "1tset";
But obviously not | c# | wcf | wcf-security | null | null | null | open | WCF Authentication doesn't prompt for credentials
===
I've created a test WCF app in which I'm trying to get Authentication to work, but it just runs my method and doesn't ask me to login / authenticate. Below is code snippets in my web.config in my WCF app:
<bindings>
<wsHttpBinding>
<binding name="Binding1">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyAPI.Authorization, App_Code" />
</serviceCredentials>
My Authorization class:
public class Authorization : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (null == userName || null == password)
{
throw new ArgumentNullException();
}
if (!(userName == "test1" && password == "1tset") && !(userName == "test2" && password == "2tset"))
{
// This throws an informative fault to the client.
throw new FaultException("Unknown Username or Incorrect Password");
// When you do not want to throw an infomative fault to the client,
// throw the following exception.
// throw new SecurityTokenException("Unknown Username or Incorrect Password");
}
}
}
My Service.svc.cs Class
public string Hello(string message)
{
return "You typed: " + message;
}
Am I supposed to put some attribute above this method to require authentication or above the class?
I have then created a Test Console Application, here is the code:
public static Test.Service1Client client = new Test.Service1Client();
static void Main(string[] args)
{
Console.WriteLine(client.Hello("hello"));
Console.ReadLine();
}
This just outputs "You typed: hello" without asking for authentication. Here is snippets of my app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://MyServer/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="Test.IService1"
name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
I would expect to have to set the login credentials before calling `client.Hello("hello")` by doing:
client.ClientCredentials.UserName.UserName = "test1";
client.ClientCredentials.UserName.Password = "1tset";
But obviously not | 0 |
481,023 | 01/26/2009 19:30:19 | 32,892 | 10/30/2008 20:51:01 | 1,049 | 62 | LinqToSQL Select and SelectMany vs Join | Are Select and SelectMany preferrable to Joins?
The reason I'm wondering is because I use LinqPad and in one section there are comments that say:
// Note: before delving into this section, make sure you've read the preceding two
// sections: Select and SelectMany. The Join operators are actually unnecessary
// in LINQ to SQL, and the equivalent of SQL inner and outer joins is most easily
// achieved in LINQ to SQL using Select/SelectMany and subqueries!
Yet, in other sections it clearly shows that joins are faster (at least for the examples given in LinqPad) and to me they are easier to visualize in my head.
Perhaps I'm misunderstanding since I'm only looking through the code samples and not the book, but I've seen other people recommend Select and SelectMany over Joins as well. | linq-to-sql | null | null | null | null | 05/04/2012 13:18:43 | not a real question | LinqToSQL Select and SelectMany vs Join
===
Are Select and SelectMany preferrable to Joins?
The reason I'm wondering is because I use LinqPad and in one section there are comments that say:
// Note: before delving into this section, make sure you've read the preceding two
// sections: Select and SelectMany. The Join operators are actually unnecessary
// in LINQ to SQL, and the equivalent of SQL inner and outer joins is most easily
// achieved in LINQ to SQL using Select/SelectMany and subqueries!
Yet, in other sections it clearly shows that joins are faster (at least for the examples given in LinqPad) and to me they are easier to visualize in my head.
Perhaps I'm misunderstanding since I'm only looking through the code samples and not the book, but I've seen other people recommend Select and SelectMany over Joins as well. | 1 |
9,456,486 | 02/26/2012 19:40:20 | 385,291 | 07/07/2010 08:04:51 | 145 | 8 | Improve separation of view and logic | I'm designing some web app, I went for some _layout.cshtml, which fragment:
//some html
<h4>Your account</h4>
@{ Html.RenderPartial("UserMenu"); }
is responsible for rendering menu views. It has 3 possible states - logged in as admin, logged in as mere user, not logged. I made this partial view like this:
@if (User.IsInRole("Admin"))
{
@:Admin menu
}
else
{
if (User.Identity.IsAuthenticated)
{
@:Normal menu
}
else
{
@Html.ActionLink("Login", "Logon", "Account");
}
}
But I'm not satisfied with this solution as it has poor separation of logic and view. How do you suggest to improve it? | c# | asp.net-mvc | asp.net-mvc-3 | razor | partial-views | null | open | Improve separation of view and logic
===
I'm designing some web app, I went for some _layout.cshtml, which fragment:
//some html
<h4>Your account</h4>
@{ Html.RenderPartial("UserMenu"); }
is responsible for rendering menu views. It has 3 possible states - logged in as admin, logged in as mere user, not logged. I made this partial view like this:
@if (User.IsInRole("Admin"))
{
@:Admin menu
}
else
{
if (User.Identity.IsAuthenticated)
{
@:Normal menu
}
else
{
@Html.ActionLink("Login", "Logon", "Account");
}
}
But I'm not satisfied with this solution as it has poor separation of logic and view. How do you suggest to improve it? | 0 |
8,507,030 | 12/14/2011 15:24:42 | 847,763 | 07/16/2011 12:52:55 | 110 | 6 | Outputting many strings in intel assembly nasm | I'm trying to output many strings. I've found this simple hello world program on the internet which outputs one string which is stored in memory:
; hello.asm a first program for nasm for Linux, Intel, gcc
;
; assemble: nasm -f elf -l hello.lst hello.asm
; link: gcc -o hello hello.o
; run: hello
; output is: Hello World
SECTION .data ; data section
msg: db "Hello World",10 ; the string to print, 10=cr
len: equ $-msg ; "$" means "here"
; len is a value, not an address
SECTION .text ; code section
global main ; make label available to linker
main: ; standard gcc entry point
mov edx,len ; arg3, length of string to print
mov ecx,msg ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
mov ebx,0 ; exit code, 0=normal
mov eax,1 ; exit command to kernel
int 0x80 ; interrupt 80 hex, call kernel
This works.
Now I've modified it to put two strings in.
SECTION .data ; data section
msg: db "Hello World",10 ; the string to print, 10=cr
len: equ $-msg ; "$" means "here"
msg2: db "Hello World2",10 ; the string to print, 10=cr
len2: equ $-msg2 ; "$" means "here"
mov edx,len ; arg3, length of string to print
mov ecx,msg ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write sysout command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
mov edx,len2 ; arg3, length of string to print
mov ecx,msg2 ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write sysout command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
This doesn't work, as it outputs the second string twice.
| assembly | nasm | null | null | null | null | open | Outputting many strings in intel assembly nasm
===
I'm trying to output many strings. I've found this simple hello world program on the internet which outputs one string which is stored in memory:
; hello.asm a first program for nasm for Linux, Intel, gcc
;
; assemble: nasm -f elf -l hello.lst hello.asm
; link: gcc -o hello hello.o
; run: hello
; output is: Hello World
SECTION .data ; data section
msg: db "Hello World",10 ; the string to print, 10=cr
len: equ $-msg ; "$" means "here"
; len is a value, not an address
SECTION .text ; code section
global main ; make label available to linker
main: ; standard gcc entry point
mov edx,len ; arg3, length of string to print
mov ecx,msg ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
mov ebx,0 ; exit code, 0=normal
mov eax,1 ; exit command to kernel
int 0x80 ; interrupt 80 hex, call kernel
This works.
Now I've modified it to put two strings in.
SECTION .data ; data section
msg: db "Hello World",10 ; the string to print, 10=cr
len: equ $-msg ; "$" means "here"
msg2: db "Hello World2",10 ; the string to print, 10=cr
len2: equ $-msg2 ; "$" means "here"
mov edx,len ; arg3, length of string to print
mov ecx,msg ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write sysout command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
mov edx,len2 ; arg3, length of string to print
mov ecx,msg2 ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write sysout command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
This doesn't work, as it outputs the second string twice.
| 0 |
8,040,654 | 11/07/2011 18:07:53 | 223,478 | 12/03/2009 02:46:33 | 961 | 80 | Inception: Can I host a java web browser inside a page on my site inside a normal browser? | You might be wondering why someone would want to do that, and hey, it's a good question.
Is there a Java web browser (that can handle some basic forms and css) that I can embed in a web page? Preferably it would be scriptable, such that I could fill in the form fields...If so, what is an acceptable one?
Any issues I need to be aware of?
Thanks! | java | browser | null | null | null | 11/07/2011 20:22:26 | not constructive | Inception: Can I host a java web browser inside a page on my site inside a normal browser?
===
You might be wondering why someone would want to do that, and hey, it's a good question.
Is there a Java web browser (that can handle some basic forms and css) that I can embed in a web page? Preferably it would be scriptable, such that I could fill in the form fields...If so, what is an acceptable one?
Any issues I need to be aware of?
Thanks! | 4 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.