I wrote up some instructions for freezing a non-native gem in a Rails app today:
install the gem
sudo gem install fastercsv
put the reference in the environment.rb (I think this is only necessary to do unpack with no GEM specified)
config.gem "fastercsv"
unpack the gem
rake gems:unpack GEM=fastercsv
uninstall the gem
sudo gem uninstall fastercsv
I know this must be the long way around: how can I unpack the gem without installing it first?
Also: What's the difference between rake gems:unpack GEM=fastercsv and gem unpack fastercsv?
In the below code i get an error saying Error #2007: Parameter url must be non-null on Ineternet explorer only.What am i doing wrong here
html
<OBJECT
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="50"
HEIGHT="50"
id="myMovieName">
<PARAM NAME="movie" VALUE="/media/players/testsound.swf" />
<PARAM NAME="quality" VALUE="high" />
<PARAM NAME="bgcolor" VALUE="#FFFFFF" />
<EMBED
href="/media/players/testsound.swf"
src="/media/players/testsound.swf"
flashvars="soundUrl=sound.mp3"
quality=high
bgcolor=#FFFFFF
NAME="myMovieName"
ALIGN=""
TYPE="application/x-shockwave-flash">
</EMBED>
</OBJECT>
mxml
;
import flash.net.;
import mx.controls.Alert;
import mx.controls.Button;
import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;
private function clickhandler(event:Event):void
{
var musicfile:String;
var s:Sound = new Sound();
s.addEventListener(Event.COMPLETE, onSoundLoaded);
var req:URLRequest = new URLRequest("/opt/cloodon/site/media/players/sound.mp3");
//musicfile = stage.loaderInfo.parameters["soundUrl"];
//var req:URLRequest = new URLRequest(musicfile);
s.load(req);
}
private function onSoundLoaded(event:Event):void
{
//Alert.show("1");
//var localSound:Sound = event.currentTarget as Sound;
var localSound:Sound = event.target as Sound;
localSound.play();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<!--<mx:Button id="play" label="PLAY" click="clickhandler(event)" />-->
<mx:Image id="loader1" source="@Embed(source='/opt/cloodon/site/media/img/speaker.gif')" click="clickhandler(event)" />
</s:Application>
Hi.
Could you suggest a fast, deterministic method that is usable in practice, for testing if a large number is prime or not?
Also, I would like to know how to use non-deterministic primality tests correctly. For example, if I'm using such a method, I can be sure that a number is not prime if the output is "no", but what about the other case, when the output is "probably"? Do I have to test for primality manually in this case?
Thanks in advance.
Hi still stuck with the ugly scheme
the problem this time is to get the median of three values (easy)
I did all these :
(define (med x y z) (car(cdr(x y z)))
and it was accepted but when testing it
(med 3 4 5)
I will get this error
Error: attempt to call a non-procedure
(2 3 4)
and when entering letters inetead of number i got
(md x y z)
Error: undefined varia
y
(package user)
using somthin else than x y z i got
(md d l m)
Error: undefined variable
d
(package user)
so what is wronge ?!
I'm looking for independent implementation of boost/tr1 shared_ptr, weak_ptr and enable_shared_from_this.
I need:
Boost independent very small implementation of these features.
I need support of only modern compilers like GCC-4.x, MSVC-2008, Intel not things like MSVC6 or gcc-3.3
I need it to be licensed under non-copyleft LGPL compatible license like Boost/Mit/3-clause BSD.
So I can include it in my library.
Note - it is quite hard to extract shared_ptr from boost, at least BCP gives about 324 files...
I have an owner-drawn list control in my Windows program. I use CListCtrl::GetBkColor to get the background color, and for a selected item I use GetSysColor(COLOR_HIGHLIGHT). This matches what Windows uses for non owner drawn list controls, except for the case where the control doesn't have focus - then the background is replaced with gray.
Does Windows use one of the GetSysColor constants for the selected but unfocused background? If so, which one?
Question:
Is there any such thing as a programming language (other than an esoteric language such as BrainF@#$, or the languages PHP or VB) that you can "compile" into non-obfuscated PHP source code?
Rationale:
Swip wants to generate ordinary PHP code because it is so ubiquitous for the types of projects swip wants to do. Unfortunately swip would like to actually avoid writing PHP -- strange but true! Swip is crazy enough to want to generate PHP source code without having to type any PHP into Swip's editor.
When I do something like the following:
$site = ORM::factory('site')->where('name', '=', 'Test Site')->find();
$users = $site->users;
$deletedusers = $users->where('deleted', '=', '1')->find_all();
$nondeletedusers = $users->where('deleted', '=', '0')->find_all();
The contents of $deletedusers is correct, but the $nondeletedusers contains every non-deleted user, not just the ones in the loaded $site.
What am I doing wrong?
Using this function in my C# exe, I try to pass a Unicode string to my C++ DLL:
[DllImport("Test.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
public static extern int xSetTestString(StringBuilder xmlSettings);
This is the function on the C++ DLL side:
__declspec(dllexport) int xSetTestString(char* pSettingsXML);
Before calling the function in C#, I do a MessageBox.Show(string) and it displays all characters properly. On the C++ side, I do: OutputDebugStringW((wchar_t*)pString);, but that shows that the non-ASCII characters were replaced by '?'.
I have set up each document with a date field. (keyword)
Values stored in it are in this format; 20100511
Each time I try to perform a ranged query, I get the following error:
date:[10000000 TO 20000000]
At least one range query boundary term
must be non-empty term
Anyone got a clue?
Understanding that passing Datasets through web services is a bit heavy (and almost if not completely unconsumable to non .NET clients) what is the best way to prep database query results that don't map to known types for transport through web services in c#?
The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device.
This was the only suggestion which didn't depend on non-commodity-class hardware.
Subsequently nobody would put their reputation on the line to argue definitively for or against it.
Anyone care to make a stand for or against. If so, how about a mention as to a possible implementation?
There are identical classes of java WebServices API & IMPL in those packages groups, only package names are different.
http://mvnrepository.com/artifact/javax.xml
http://mvnrepository.com/artifact/com.sun.xml
Which ones should I use in my code? I would prefer NON-com.sun.* as per java conventions, but still my dependencies ( e.g. Spring ) are using implementations from com.sun.* OR I can't find an implementation package in javax.xml
Does anyone have any experience on this?
Hi, i want to have pre-made list of most common OSes in my DB and all non default to be listed as other. Problem is i don't know what OSes called in Request.Browser object.
List i want to have WinXP, Vista, Win7, Linux, MacOS and other...
Do any of you know what are exact names of these OSes in Request.Browser.Platform or where i can get list of values from ?
Hi
I was wondering what the best and easiest way was to ensure that the value a user enters into an input box is numeric in a web page? either notify them they are not allowed to when they edit it or not allow them to enter in non numeric values to begin with.
any ideas?
thanks
Hi,
I have a library from which I'd like to create two RPM packages.
While I found several links on how to create a basic RPM package, I can't find how to create a devel package (see this question if you wonder what a devel package is).
What do I have to do to generate both devel and non-devel versions of my RPM package ?
Thanks.
I have a table defined by the following SQL:
CREATE TABLE test (
id integer PRIMARY KEY NOT NULL UNIQUE,
status text NOT NULL,
enddate date,
/* Checks */
CHECK (status IN ("Current", "Complete"))
);
I'd like to add a constraint that requires enddate to be non-null if the status is "Complete".
Is this possible? I am using SQLite v3.6.16.
As I understand it, you can enter any non-structured information into a document-oriented database. Let's imagine a document like this:
{
name: 'John Blank',
yearOfBirth: 1960
}
Later, in a new version, this structure is refactored to
{
firstname: 'John',
lastname: 'Blank',
yearOfBirth: 1960
}
How do you do this with Document-Oriented databases? Do you have to prepare merge-scripts, that alter all your entries in the database? Or are there better ways you can handle changes in the structure?
I thought java.math.BigDecimal is supposed to be The Answer™ to the need of performing infinite precision arithmetic with decimal numbers.
Consider the following snippet:
import java.math.BigDecimal;
//...
final BigDecimal one = BigDecimal.ONE;
final BigDecimal three = BigDecimal.valueOf(3);
final BigDecimal third = one.divide(three);
assert third.multiply(three).equals(one); // this should pass, right?
I expect the assert to pass, but in fact the execution doesn't even get there: one.divide(three) causes ArithmeticException to be thrown!
Exception in thread "main" java.lang.ArithmeticException:
Non-terminating decimal expansion; no exact representable decimal result.
at java.math.BigDecimal.divide
It turns out that this behavior is explicitly documented in the API:
In the case of divide, the exact quotient could have an infinitely long decimal expansion; for example, 1 divided by 3. If the quotient has a non-terminating decimal expansion and the operation is specified to return an exact result, an ArithmeticException is thrown. Otherwise, the exact result of the division is returned, as done for other operations.
Browsing around the API further, one finds that in fact there are various overloads of divide that performs inexact division, i.e.:
final BigDecimal third = one.divide(three, 33, RoundingMode.DOWN);
System.out.println(three.multiply(third));
// prints "0.999999999999999999999999999999999"
Of course, the obvious question now is "What's the point???". I thought BigDecimal is the solution when we need exact arithmetic, e.g. for financial calculations. If we can't even divide exactly, then how useful can this be? Does it actually serve a general purpose, or is it only useful in a very niche application where you fortunately just don't need to divide at all?
If this is not the right answer, what CAN we use for exact division in financial calculation? (I mean, I don't have a finance major, but they still use division, right???).
Hi,
I've read from a non reliable source that purchasing VS2010 Upgrade Edition (As opposed to full retail) is a valid licensing route when 'upgrading' from VS Express (free) - Can anyone confirm or refute this?
Thank you
I like the algorithm mentioned in this question: "How does this work? Weird Towers of Hanoi Solution"
http://stackoverflow.com/questions/2209860/how-does-this-work-weird-towers-of-hanoi-solution
Is there any way to scale that non-recursive solution of Towers of Hanoi to use X disks and Y towers, with towers represented as stacks?
At the end of my DirectX application I get "The Direct3D device has a non-zero reference count, meaning some objects were not released.". The application is large and not written by me, how can I go about debugging what resources are not being released?
I am using both JQuery UI Dialog and JQuery UI autocomplete both have the same erroneous behavior when they popup, the position is always 0,0! I have tried some different position arguments when popping up the dialog but non seems to help.
Any clues? Is this a bug in the position calculation in JQuery? Or is this some css bug?
Versions are 1.4.2 and 1.8.0