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,122,608
06/20/2012 15:12:13
795,319
06/13/2011 02:49:32
2,138
77
Why is `goog.Disposable.call(this);` necessary?
In this snippet of Google Closure javascript code involving a constructor, why is `goog.Disposable.call(this);` necessary? Doesn't `Foo` already inherit from Disposable with `goog.inherits(foo, goog.Disposable);`? goog.provide('foo'); /** * @constructor */ foo = function(){ goog.Disposable.call(this); } goog.inherits(foo, goog.Disposable); foo.prototype.doSomething = function(){ ... } foo.prototype.disposeInternal = function(){ ... }
javascript
google-closure-library
null
null
null
null
open
Why is `goog.Disposable.call(this);` necessary? === In this snippet of Google Closure javascript code involving a constructor, why is `goog.Disposable.call(this);` necessary? Doesn't `Foo` already inherit from Disposable with `goog.inherits(foo, goog.Disposable);`? goog.provide('foo'); /** * @constructor */ foo = function(){ goog.Disposable.call(this); } goog.inherits(foo, goog.Disposable); foo.prototype.doSomething = function(){ ... } foo.prototype.disposeInternal = function(){ ... }
0
10,184,374
04/17/2012 02:41:18
1,337,670
04/17/2012 02:38:03
1
0
PowerShell how can I search for files by size
In PowerShell how can I search for files that are larger than 20 bytes in a directory?
powershell
null
null
null
null
04/17/2012 06:21:57
not constructive
PowerShell how can I search for files by size === In PowerShell how can I search for files that are larger than 20 bytes in a directory?
4
7,394,397
09/12/2011 21:40:30
810,032
06/22/2011 09:12:38
26
0
infinite loop,java.lang.StackOverflowError
i'm having this error while trying to run my application The server side component of the HTTP Monitor has detected a java.lang.StackOverflowError. This happens when there is an infinite loop in the web module. Correct the cause of the infinite loop before running the web module again. 12 sept. 2011 12:01:54 org.apache.catalina.core.ApplicationDispatcher invoke GRAVE: "Servlet.service ()" Faces Servlet for servlet launched a exceptionjava.lang.StackOverflowError i don't have no idea about the source of this error. thanks
java
java-ee
tomcat
stackoverflow
null
09/12/2011 22:02:36
not a real question
infinite loop,java.lang.StackOverflowError === i'm having this error while trying to run my application The server side component of the HTTP Monitor has detected a java.lang.StackOverflowError. This happens when there is an infinite loop in the web module. Correct the cause of the infinite loop before running the web module again. 12 sept. 2011 12:01:54 org.apache.catalina.core.ApplicationDispatcher invoke GRAVE: "Servlet.service ()" Faces Servlet for servlet launched a exceptionjava.lang.StackOverflowError i don't have no idea about the source of this error. thanks
1
3,388,915
08/02/2010 14:53:25
270,511
02/10/2010 18:10:57
104
6
tar --files-from complains "Cannot stat: No such file or directory"
When I type " tar -cvf ~/changeset.tar --files-from ~/changeset.txt", It responds with this output: http://pastie.org/1071080. Here is the contents of ~/changeset.txt: http://pastie.org/1071084 . In other words, a bunch of relative paths. As a sanity check, $ ls admin/memberinformation.php admin/memberinformation.php Why can't tar find any of these files even though they are clearly reachable from the current directory with the relative paths given? FYI: $ tar --version tar (GNU tar) 1.15.1
linux
tar
stat
null
null
08/02/2010 15:24:34
off topic
tar --files-from complains "Cannot stat: No such file or directory" === When I type " tar -cvf ~/changeset.tar --files-from ~/changeset.txt", It responds with this output: http://pastie.org/1071080. Here is the contents of ~/changeset.txt: http://pastie.org/1071084 . In other words, a bunch of relative paths. As a sanity check, $ ls admin/memberinformation.php admin/memberinformation.php Why can't tar find any of these files even though they are clearly reachable from the current directory with the relative paths given? FYI: $ tar --version tar (GNU tar) 1.15.1
2
6,922,830
08/03/2011 07:09:08
844,589
07/14/2011 12:47:24
7
0
Need jquery help
I have set of divs and styled display none. i need some click function, it perform show one corresponding div others are hide. when i click another function that perform corresponding div will show instead previous div.
jquery
null
null
null
null
08/03/2011 07:29:16
not a real question
Need jquery help === I have set of divs and styled display none. i need some click function, it perform show one corresponding div others are hide. when i click another function that perform corresponding div will show instead previous div.
1
10,782,279
05/28/2012 09:27:48
1,421,339
05/28/2012 09:03:17
1
0
How to change screen orientation in Android for all apps
how can i set the screen orientation using settings.system user_rotation? This is what i get when i try : USER_ROTATION cannot be resolved or is not a field; And this is the code: android.provider.Settings.System.putInt(getContentResolver(), android.provider.Settings.System.USER_ROTATION, 1);
java
android
screen-orientation
null
null
05/31/2012 21:29:48
not a real question
How to change screen orientation in Android for all apps === how can i set the screen orientation using settings.system user_rotation? This is what i get when i try : USER_ROTATION cannot be resolved or is not a field; And this is the code: android.provider.Settings.System.putInt(getContentResolver(), android.provider.Settings.System.USER_ROTATION, 1);
1
9,864,469
03/25/2012 21:57:52
863,771
07/26/2011 15:29:02
18
0
How did you learn Codeigniter & working with RESTful services?
My goal is to build a mobile social network and its looking like the next logical step is to build a RESTful API via Codeigniter ( at least thats what appears to be my best option for building such a RESTful API. I know PHP, but ive never worked with Codeigniter and I dont know much at all about RESTful API's. How did you guys learn CodeIgniter and REST and what are some of the best resources to learn such ? ( Books, links, Videos ect...) As a secondary question how important is it that I know CodeIgniter in and out?Ive done a few tuts and it seems almost deceptively easy to work with, but Should I spend a while just working with the framework before I dive into turning it into a RESTful API ?
php
web-services
api
codeigniter
rest
03/26/2012 00:28:40
not constructive
How did you learn Codeigniter & working with RESTful services? === My goal is to build a mobile social network and its looking like the next logical step is to build a RESTful API via Codeigniter ( at least thats what appears to be my best option for building such a RESTful API. I know PHP, but ive never worked with Codeigniter and I dont know much at all about RESTful API's. How did you guys learn CodeIgniter and REST and what are some of the best resources to learn such ? ( Books, links, Videos ect...) As a secondary question how important is it that I know CodeIgniter in and out?Ive done a few tuts and it seems almost deceptively easy to work with, but Should I spend a while just working with the framework before I dive into turning it into a RESTful API ?
4
5,658,447
04/14/2011 04:14:13
691,029
04/04/2011 11:58:46
1
1
Escape sequence in JSONValue
I have a function which calls a JSON API. The string contains some escape sequence eg. "\\u0092" "\\u0027" for ' The problem is that I can't find any function to convert these directly back to their character equivalent. It is almost like I am looking for a reverse function of [NSRegularExpression escapedPatternForString:] Any help? Thanks.
iphone
null
null
null
null
null
open
Escape sequence in JSONValue === I have a function which calls a JSON API. The string contains some escape sequence eg. "\\u0092" "\\u0027" for ' The problem is that I can't find any function to convert these directly back to their character equivalent. It is almost like I am looking for a reverse function of [NSRegularExpression escapedPatternForString:] Any help? Thanks.
0
5,352,299
03/18/2011 12:58:21
665,988
03/18/2011 12:02:19
1
0
how to know color code in actionscript
i don't know color code , if you know anybody please ans
actionscript-3
null
null
null
null
03/18/2011 13:10:36
not a real question
how to know color code in actionscript === i don't know color code , if you know anybody please ans
1
9,486,976
02/28/2012 17:41:10
1,017,513
10/28/2011 00:02:44
244
27
Is there a PHP editor that could do intellisense of your own variables?
Which PHP editor ( for MAC OS/X ) would you recommend free/premium that would not only allow you to do all the basic jazz such as auto-ftp, intellisense, syntax highlighting, and of course step-thru debugging BUT ALSO the auto-complete of your own variables? so, if you do; $my_name = "ABC"; and later on down the page, when you type `$my_n`, you get the `"ame"` is auto suggested.
php
osx
editor
null
null
02/28/2012 23:44:06
not constructive
Is there a PHP editor that could do intellisense of your own variables? === Which PHP editor ( for MAC OS/X ) would you recommend free/premium that would not only allow you to do all the basic jazz such as auto-ftp, intellisense, syntax highlighting, and of course step-thru debugging BUT ALSO the auto-complete of your own variables? so, if you do; $my_name = "ABC"; and later on down the page, when you type `$my_n`, you get the `"ame"` is auto suggested.
4
4,427,547
12/13/2010 09:47:39
26,444
10/09/2008 09:45:06
438
19
MVContrib Portable Areas with Razor
MVCContrib Portable Areas use WebForms engine to extract views embedded as resources from different assemblies. It would be a lot more natural with Razor, which is totally decoupled from the web runtime. So, is there any work done to replace WebForms View Engine with Razor for Portable Areas? Haven't looked at the source yet, would it be easy to implement?
asp.net-mvc
razor
mvccontrib
null
null
null
open
MVContrib Portable Areas with Razor === MVCContrib Portable Areas use WebForms engine to extract views embedded as resources from different assemblies. It would be a lot more natural with Razor, which is totally decoupled from the web runtime. So, is there any work done to replace WebForms View Engine with Razor for Portable Areas? Haven't looked at the source yet, would it be easy to implement?
0
9,584,916
03/06/2012 13:46:06
1,112,934
12/23/2011 06:27:16
69
0
Ajax tab in zii tab widget
Below i have an ajax tab example: $this->widget('zii.widgets.jui.CJuiTabs', array( 'tabs' => array( 'StaticTab 1' => 'Content for tab 1', 'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'), // panel 3 contains the content rendered by a partial view 'AjaxTab' => array('ajax' => $this->createUrl('/AjaxModule/ajax/reqTest01')), ), // additional javascript options for the tabs plugin 'options' => array( 'collapsible' => true, ), )); but i don't know what happens in /AjaxModule/ajax/reqTest01. There is a missing part in this example, the rendering view, and i don't know how to design it so that the ajax call to work. Thanks.
php
yii
null
null
null
null
open
Ajax tab in zii tab widget === Below i have an ajax tab example: $this->widget('zii.widgets.jui.CJuiTabs', array( 'tabs' => array( 'StaticTab 1' => 'Content for tab 1', 'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'), // panel 3 contains the content rendered by a partial view 'AjaxTab' => array('ajax' => $this->createUrl('/AjaxModule/ajax/reqTest01')), ), // additional javascript options for the tabs plugin 'options' => array( 'collapsible' => true, ), )); but i don't know what happens in /AjaxModule/ajax/reqTest01. There is a missing part in this example, the rendering view, and i don't know how to design it so that the ajax call to work. Thanks.
0
10,324,031
04/25/2012 21:24:47
1,297,039
03/28/2012 02:59:47
5
0
Wordpress File edit in dreamhost
I used the one click install in dreamhost for my Wordpress sit that I'm building on my sub-domain. When I look for the WP php files in my FTP I can't find them in the directory. Idk where dreamhost places the files? It's my first time not using local host for developing. Thx
php
wordpress
ftp
dreamhost
null
04/26/2012 11:20:20
off topic
Wordpress File edit in dreamhost === I used the one click install in dreamhost for my Wordpress sit that I'm building on my sub-domain. When I look for the WP php files in my FTP I can't find them in the directory. Idk where dreamhost places the files? It's my first time not using local host for developing. Thx
2
8,460,060
12/10/2011 21:34:51
727,429
03/23/2011 20:06:13
819
29
Java, convert object to softreference
I need to put a data object into my weakhashmap containing softreferences. How do I convert my "Drawable" object into a softreference? WeakHashMap <String, SoftReference<Drawable>> tempPulled = new WeakHashMap<String, SoftReference<Drawable>>(); Drawable pulled = BitmapDrawable.createFromResourceStream(null, null, conn.getInputStream(), "galleryImage", options); SoftReference<Drawable> sPulled; tempPulled.put(id, pulled); tempPulled should be putting "sPulled" , the softreference
java
memory-management
soft-references
weakhashmap
null
null
open
Java, convert object to softreference === I need to put a data object into my weakhashmap containing softreferences. How do I convert my "Drawable" object into a softreference? WeakHashMap <String, SoftReference<Drawable>> tempPulled = new WeakHashMap<String, SoftReference<Drawable>>(); Drawable pulled = BitmapDrawable.createFromResourceStream(null, null, conn.getInputStream(), "galleryImage", options); SoftReference<Drawable> sPulled; tempPulled.put(id, pulled); tempPulled should be putting "sPulled" , the softreference
0
2,492,274
03/22/2010 12:50:10
288,574
03/08/2010 07:21:32
20
2
User registration for postfix w/ mysql
I would like to create a user registrations(using PHP) page for my postfix (w/ mysql), any one could lead me, how this can be done?
postfix
mysql
php
null
null
null
open
User registration for postfix w/ mysql === I would like to create a user registrations(using PHP) page for my postfix (w/ mysql), any one could lead me, how this can be done?
0
6,506,381
06/28/2011 12:28:56
795,752
06/13/2011 10:23:58
1
0
Trying to open an input in PortMidi
I'm trying to open a midi port to read events from a midi keyboard in C++ using PortMidi. I have found the device id for the keyboard using GetDeviceInfo but can't open the input. The function looks like this: Pm_OpenInput ( PortMidiStream ** stream, PmDeviceID inputDevice, void * inputDriverInfo, long bufferSize, PmTimeProcPtr time_proc, void * time_info ) The full documentation behind that function is [here][1] And my implementation... PortMidiStream **stream; Pm_OpenInput(stream, 12, NULL, 128, NULL, NULL); ..gives the error > Run-Time Check Failure #3 - The variable 'stream' is being used without being initialized. ..which is true enough, as I haven't initialized it. I've looked through PortMidi.h and most of the internet trying to find PortMidiStream and how to initialize it with no success. The header file just has a typedef for it and a comment saying > A single PortMidiStream is a > descriptor for an open MIDI device which didn't help much. Any ideas appreciated Jordan P.S- Here's the PortMidi download page http://sourceforge.net/apps/trac/portmedia/wiki/portmidi [1]: http://portmedia.sourceforge.net/portmidi/doxygen/group__grp__device.html
c++
audio
midi
null
null
null
open
Trying to open an input in PortMidi === I'm trying to open a midi port to read events from a midi keyboard in C++ using PortMidi. I have found the device id for the keyboard using GetDeviceInfo but can't open the input. The function looks like this: Pm_OpenInput ( PortMidiStream ** stream, PmDeviceID inputDevice, void * inputDriverInfo, long bufferSize, PmTimeProcPtr time_proc, void * time_info ) The full documentation behind that function is [here][1] And my implementation... PortMidiStream **stream; Pm_OpenInput(stream, 12, NULL, 128, NULL, NULL); ..gives the error > Run-Time Check Failure #3 - The variable 'stream' is being used without being initialized. ..which is true enough, as I haven't initialized it. I've looked through PortMidi.h and most of the internet trying to find PortMidiStream and how to initialize it with no success. The header file just has a typedef for it and a comment saying > A single PortMidiStream is a > descriptor for an open MIDI device which didn't help much. Any ideas appreciated Jordan P.S- Here's the PortMidi download page http://sourceforge.net/apps/trac/portmedia/wiki/portmidi [1]: http://portmedia.sourceforge.net/portmidi/doxygen/group__grp__device.html
0
10,567,293
05/12/2012 20:46:09
1,391,499
05/12/2012 20:39:11
1
0
How can I select file path in c3 consol application?
I don't want to put the hardcoded path.. I want the user Itself Select the path of the file wherever he put he put his file... c# console application.
c#
console
user
console-application
filepath
05/13/2012 09:17:43
not a real question
How can I select file path in c3 consol application? === I don't want to put the hardcoded path.. I want the user Itself Select the path of the file wherever he put he put his file... c# console application.
1
184,435
10/08/2008 19:24:08
2,884
08/25/2008 17:51:51
275
11
Tax Service Recommendation for a Rails App?
I'm developing a cart that needs to calculate tax and am looking for a 3rd party tax service to handle the calculations. I've used Avalara in another app, but it's somewhat miserable since I have to use the Rjb gem with their java library. Does anyone have a recommendation for a tax service that works well with rails?
ruby
ruby-on-rails
tax
null
null
05/03/2012 13:17:41
off topic
Tax Service Recommendation for a Rails App? === I'm developing a cart that needs to calculate tax and am looking for a 3rd party tax service to handle the calculations. I've used Avalara in another app, but it's somewhat miserable since I have to use the Rjb gem with their java library. Does anyone have a recommendation for a tax service that works well with rails?
2
10,696,674
05/22/2012 06:16:53
943,787
09/14/2011 03:35:06
1
1
magento - nominal product show zero in subtotal shipping fee
I have written a recurring payment module with asiapay payment, however when i was in checkout progress, **the shipping fee and subtotal is zero**, although the actual fee will show up in the section below subtotal which is called "nominal item total", it is still confusing for customer that the shipping fee is zero but it appears some value again in the last step. ----------------------------------------------------------------------------------- Also , i am **using table rate (price VS destintaion)**.... at the step 3 SHipping method, it becomes worse that it did not find any shipping method...i am not allowed to move the step4! So i would like to know how can i **hardcode set the subtotal and shipping fee** for nominal item checkout?
magento
shipping
recurring
null
null
null
open
magento - nominal product show zero in subtotal shipping fee === I have written a recurring payment module with asiapay payment, however when i was in checkout progress, **the shipping fee and subtotal is zero**, although the actual fee will show up in the section below subtotal which is called "nominal item total", it is still confusing for customer that the shipping fee is zero but it appears some value again in the last step. ----------------------------------------------------------------------------------- Also , i am **using table rate (price VS destintaion)**.... at the step 3 SHipping method, it becomes worse that it did not find any shipping method...i am not allowed to move the step4! So i would like to know how can i **hardcode set the subtotal and shipping fee** for nominal item checkout?
0
8,238,356
11/23/2011 06:59:37
669,388
03/19/2010 12:33:40
687
12
How to open and list contents of a zip file using windows command prompt?
In svn lot of image zip folders are there. Recently we added lot of new images. But some images are missed in some zip files. So from command prompt how I will check whether that image is available inside zil folder or not. I can check zip file exist or not using this command. `svn info svn://ip/test/101.zip` Due to lot of files. Repo browser taking long time to load. So how I will check that image is available or not inside zip file using commands. Please help. Thanks
windows
svn
command-line
zip
open
null
open
How to open and list contents of a zip file using windows command prompt? === In svn lot of image zip folders are there. Recently we added lot of new images. But some images are missed in some zip files. So from command prompt how I will check whether that image is available inside zil folder or not. I can check zip file exist or not using this command. `svn info svn://ip/test/101.zip` Due to lot of files. Repo browser taking long time to load. So how I will check that image is available or not inside zip file using commands. Please help. Thanks
0
5,199,541
03/04/2011 21:35:21
275,390
02/17/2010 16:09:58
914
42
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.`
i have just created a new wcf services and when i hit f5 from VS and i get this error in WCF Test Client window : `Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.` `Error: Cannot obtain Metadata from http://localhost:3696/MobileService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:3696/MyService.svc Metadata contains a reference that cannot be resolved: 'http://localhost:3696/MyService.svc'. There was no endpoint listening at http://localhost:3696/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:3696HTTP GET Error URI: http://localhost:3696/MyService.svc There was an error downloading 'http://localhost:3696/MyService.svc'. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:3696` <behaviors> <endpointBehaviors> <behavior name="MyService.MyService"> <webHttp/> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="metadataBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:2812/MyService.svc" /> </behavior> </serviceBehaviors> </behaviors> <services> <service name="MyService.MyService" behaviorConfiguration="metadataBehavior"> <endpoint address="http://localhost/MyService.svc" binding="customBinding" bindingConfiguration="jsonpBinding" behaviorConfiguration="MyService.MyService" contract="MyService.IMyService"/> </service> </services> <bindings> <customBinding> <binding name="jsonpBinding"> <jsonpMessageEncoding/> <httpTransport manualAddressing="true"/> </binding> </customBinding> </bindings> <extensions> <bindingElementExtensions> <add name="jsonpMessageEncoding" type="Microsoft.Ajax.Samples.JsonpBindingExtension, MyService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/> </bindingElementExtensions> </extensions> </system.serviceModel>
web-services
wcf
null
null
null
null
open
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.` === i have just created a new wcf services and when i hit f5 from VS and i get this error in WCF Test Client window : `Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.` `Error: Cannot obtain Metadata from http://localhost:3696/MobileService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:3696/MyService.svc Metadata contains a reference that cannot be resolved: 'http://localhost:3696/MyService.svc'. There was no endpoint listening at http://localhost:3696/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:3696HTTP GET Error URI: http://localhost:3696/MyService.svc There was an error downloading 'http://localhost:3696/MyService.svc'. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:3696` <behaviors> <endpointBehaviors> <behavior name="MyService.MyService"> <webHttp/> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="metadataBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:2812/MyService.svc" /> </behavior> </serviceBehaviors> </behaviors> <services> <service name="MyService.MyService" behaviorConfiguration="metadataBehavior"> <endpoint address="http://localhost/MyService.svc" binding="customBinding" bindingConfiguration="jsonpBinding" behaviorConfiguration="MyService.MyService" contract="MyService.IMyService"/> </service> </services> <bindings> <customBinding> <binding name="jsonpBinding"> <jsonpMessageEncoding/> <httpTransport manualAddressing="true"/> </binding> </customBinding> </bindings> <extensions> <bindingElementExtensions> <add name="jsonpMessageEncoding" type="Microsoft.Ajax.Samples.JsonpBindingExtension, MyService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/> </bindingElementExtensions> </extensions> </system.serviceModel>
0
8,871,019
01/15/2012 15:52:27
913,073
08/25/2011 22:35:32
10
0
Simple account system
I have been working on this small accounting thing, having some problems with the withdrawal section. I need help. public class Account { private double balance; public Account (double initialBalance){ if(initialBalance > 0){ balance = initialBalance; } } public double getDeposit(){ return balance; } public void credit (double amount){ balance += amount; } public double withdraw(double amount2){ //double amount1; //double with; if (balance > initialBalance){ balance - amount2; }
java
null
null
null
null
01/15/2012 17:28:07
not a real question
Simple account system === I have been working on this small accounting thing, having some problems with the withdrawal section. I need help. public class Account { private double balance; public Account (double initialBalance){ if(initialBalance > 0){ balance = initialBalance; } } public double getDeposit(){ return balance; } public void credit (double amount){ balance += amount; } public double withdraw(double amount2){ //double amount1; //double with; if (balance > initialBalance){ balance - amount2; }
1
7,699,939
10/08/2011 21:39:14
508,377
11/15/2010 14:47:43
647
4
How to copy PHP files from windows to ubuntu?
How to copy PHP files from windows to ubuntu without causing problems ?(because of \r and \n) as when enter code here I have copied them directly , and trying to browse the files , nothing response on ubuntu ! The question is: - why when I am copying files from windows to ubuntu and trying to browse the php files , I don't get any result in the page despite it shows result when browsing them on windows ?!
php
windows
ubuntu
copy
null
null
open
How to copy PHP files from windows to ubuntu? === How to copy PHP files from windows to ubuntu without causing problems ?(because of \r and \n) as when enter code here I have copied them directly , and trying to browse the files , nothing response on ubuntu ! The question is: - why when I am copying files from windows to ubuntu and trying to browse the php files , I don't get any result in the page despite it shows result when browsing them on windows ?!
0
4,702,913
01/16/2011 00:04:11
389,823
07/12/2010 20:02:54
176
19
Turbo Assembler
Why was Turbo Assembler development abandoned by Borland?
tasm
null
null
null
null
01/16/2011 00:11:10
off topic
Turbo Assembler === Why was Turbo Assembler development abandoned by Borland?
2
1,156,886
07/21/2009 01:35:13
34,991
11/06/2008 08:19:12
354
8
What Are The Advantages/Disadvantages of Using Both VB.Net and C# In The Workplace?
At a colleague's workplace, a decision is trying to be made about whether to use both languages in the workplace or to standardize on one? There are some VB.Net developers and some C# developers. What advantages or disadvantages would there be to using both or to using one?
c#
vb.net
.net
null
null
null
open
What Are The Advantages/Disadvantages of Using Both VB.Net and C# In The Workplace? === At a colleague's workplace, a decision is trying to be made about whether to use both languages in the workplace or to standardize on one? There are some VB.Net developers and some C# developers. What advantages or disadvantages would there be to using both or to using one?
0
11,384,781
07/08/2012 16:35:52
347,635
05/22/2010 04:38:14
106
4
Rebuilding Indexes, DB now 10x the size
I have an MS SQL Server database (2008 R2 SP1) that was about 15 gigs. It turns out maintenance hadn't been running in a while, so I created a maintenance plan to rebuild all the indexes, they were very fragmented. The job finished and the fragmentation is gone, but now the database is over 120 gigs! I understand that it would have used extra space to do all the rebuilds, but now that the job is done, I would think all that space would be free space, but the free space only shows as 3 gigs, so 117 gigs is being used even though the index rebuild job is finished. I'm very confused and could use some guidance, I have the get the db back to a reasonable size, we don't have the disk space for this. Thanks in advance!
sql-server
sql-server-2008
sql-server-2008-r2
null
null
07/08/2012 22:39:13
off topic
Rebuilding Indexes, DB now 10x the size === I have an MS SQL Server database (2008 R2 SP1) that was about 15 gigs. It turns out maintenance hadn't been running in a while, so I created a maintenance plan to rebuild all the indexes, they were very fragmented. The job finished and the fragmentation is gone, but now the database is over 120 gigs! I understand that it would have used extra space to do all the rebuilds, but now that the job is done, I would think all that space would be free space, but the free space only shows as 3 gigs, so 117 gigs is being used even though the index rebuild job is finished. I'm very confused and could use some guidance, I have the get the db back to a reasonable size, we don't have the disk space for this. Thanks in advance!
2
6,728,745
07/18/2011 04:55:19
1,909
08/19/2008 14:04:34
1,103
30
Difference between typical Windows and .NET binaries
What is the difference between typical Windows (WIn32? COM? Not sure what they are called.) DLLs and the DLLs that are compiled using .NET? I know they are different, but I do not know the inner workings in detail. I would love to know what the exact difference is.
c#
.net
winapi
microsoft
null
07/20/2011 00:13:26
not a real question
Difference between typical Windows and .NET binaries === What is the difference between typical Windows (WIn32? COM? Not sure what they are called.) DLLs and the DLLs that are compiled using .NET? I know they are different, but I do not know the inner workings in detail. I would love to know what the exact difference is.
1
4,067,064
11/01/2010 06:40:18
487,511
10/26/2010 10:42:57
1
0
.Net Remoting server connection limit
Is there a limit on the number of connection a .Net Remoting server can handle?
.net
.net-remoting
null
null
null
null
open
.Net Remoting server connection limit === Is there a limit on the number of connection a .Net Remoting server can handle?
0
8,098,870
11/11/2011 19:22:48
603,840
02/04/2011 21:34:17
441
6
Debugbar in IE HTTP color code
IF anyone has used debugbar for IE can they please let me know the meaning of the color codes used in HTTP(s). does black mean loaded, gray not loaded and red some form of errors in them. Right now my page has all 3 colors on each line of http call
debugging
internet-explorer-7
null
null
null
null
open
Debugbar in IE HTTP color code === IF anyone has used debugbar for IE can they please let me know the meaning of the color codes used in HTTP(s). does black mean loaded, gray not loaded and red some form of errors in them. Right now my page has all 3 colors on each line of http call
0
4,632,620
01/08/2011 05:56:38
563,292
01/04/2011 23:43:34
64
0
javaserver pages on linux server
I want to install and use java on a linux server. specifically, for creating large web applications, so I want to use JavaServer pages technology My question: is this possible? and how do I get started? thanks, av
java
linux
jsp
null
null
01/08/2011 11:36:43
off topic
javaserver pages on linux server === I want to install and use java on a linux server. specifically, for creating large web applications, so I want to use JavaServer pages technology My question: is this possible? and how do I get started? thanks, av
2
4,049,059
10/29/2010 04:49:40
316,233
04/14/2010 06:58:22
36
0
Unable to access https sites
Unable to access https sites on any of my browsers in Ubuntu 10.04 :(
browser
https
ubuntu-10.04
null
null
10/29/2010 10:13:56
off topic
Unable to access https sites === Unable to access https sites on any of my browsers in Ubuntu 10.04 :(
2
3,748,855
09/20/2010 05:15:41
17,891
09/18/2008 15:51:24
445
23
How do I specify a range of unicode characters in a regular-expression in python?
I am trying to match a range of Unicode characters and I am wondering how to do it. I can match simple ranges like [a-zA-Z] but how do I specify a range of Unicode characters. I've tried [#xD8-#xF6] without any luck. Any ideas?
python
regex
null
null
null
null
open
How do I specify a range of unicode characters in a regular-expression in python? === I am trying to match a range of Unicode characters and I am wondering how to do it. I can match simple ranges like [a-zA-Z] but how do I specify a range of Unicode characters. I've tried [#xD8-#xF6] without any luck. Any ideas?
0
5,132,613
02/27/2011 10:18:31
631,914
02/24/2011 08:04:30
6
0
Break lines in XSL
I've tried to use XSL to output the liste of the customer in a XML file but there is no break lines between values <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="ISO-8859-1" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" indent="yes" /> <xsl:template match="/"> <xsl:apply-templates select="//client"/> </xsl:template> <xsl:template match="//client"> <xsl:value-of select="./nom/." /> </xsl:template> </xsl:stylesheet> The output is DoeNampelluro Normallly I want to get Doe Nam Pelluro I've let indent="yes" but that does not do the job
xml
xslt
null
null
null
null
open
Break lines in XSL === I've tried to use XSL to output the liste of the customer in a XML file but there is no break lines between values <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="ISO-8859-1" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" indent="yes" /> <xsl:template match="/"> <xsl:apply-templates select="//client"/> </xsl:template> <xsl:template match="//client"> <xsl:value-of select="./nom/." /> </xsl:template> </xsl:stylesheet> The output is DoeNampelluro Normallly I want to get Doe Nam Pelluro I've let indent="yes" but that does not do the job
0
11,482,027
07/14/2012 07:52:14
1,525,237
07/14/2012 07:35:52
1
0
Trouble parsing array of hashes for rails app --- nothing working, have tried 4-6 methods for several hours
here is an example hash (maximum 10 per query) parsed_response = [{"id"=>3, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/mobile-4", "name"=>"Mobile", "type"=>"MarketTag"}, {"id"=>12, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/enterprise-software", "name"=>"Enterprise Software", "type"=>"MarketTag"}, {"id"=>10, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/saas", "name"=>"SaaS", "type"=>"MarketTag"}, {"id"=>841, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/software", "name"=>"Software", "type"=>"MarketTag"}, {"id"=>263, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/restaurants-2", "name"=>"Restaurants", "type"=>"MarketTag"}, {"id"=>376, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/productivity-software", "name"=>"Productivity Software", "type"=>"MarketTag"}, {"id"=>942, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/embedded-hardware-and-software", "name"=>"Embedded Hardware and Software", "type"=>"MarketTag"}, {"id"=>291, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/meeting-software", "name"=>"Meeting Software", "type"=>"MarketTag"}, {"id"=>13764, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/hardware-software", "name"=>"Hardware + Software", "type"=>"MarketTag"}, {"id"=>2983, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/software-compliance", "name"=>"Software Compliance", "type"=>"MarketTag"}] I've tried many methods inside of the gem I've been creating... the first method was to create a special class and map each array element to that class class IDSearch attr_accessor :id, :thumbnail, :url, :name, :type def initialize(the_hash) @id = the_hash['id'] @url = the_hash['url'] @pic = the_hash['pic'] @name = the_hash['name'] @type = the_hash['type'] end end I'll list them according to attempt Attempt 1: IDSearch.new(parsed_response) Attempt 2: parsed_response.map {|t| IDSearch.new(t)} Attempt 3: parsed_response.each do |hsh| SimpleAngel::IDSearch.new(hsh) end Attempt 4: 10.times do |i| instance_variable_set "@response_#{i}", parsed_response[i] end Attempt 5 (getting desperate) @response0 = parsed_response[0 @response1 = parsed_response[1] @response2 = parsed_response[2] @response3 = parsed_response[3] @response4 = parsed_response[4] @response5 = parsed_response[5] @response6 = parsed_response[6] @response7 = parsed_response[7] @response8 = parsed_response[8] @response9 = parsed_response[9] None of these methods has produced a predictable, coherent, workable response... More than an actual solution, I'm looking for a clue as to how my thinking has been flawed.
ruby-on-rails
ruby
parsing
hash
gem
null
open
Trouble parsing array of hashes for rails app --- nothing working, have tried 4-6 methods for several hours === here is an example hash (maximum 10 per query) parsed_response = [{"id"=>3, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/mobile-4", "name"=>"Mobile", "type"=>"MarketTag"}, {"id"=>12, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/enterprise-software", "name"=>"Enterprise Software", "type"=>"MarketTag"}, {"id"=>10, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/saas", "name"=>"SaaS", "type"=>"MarketTag"}, {"id"=>841, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/software", "name"=>"Software", "type"=>"MarketTag"}, {"id"=>263, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/restaurants-2", "name"=>"Restaurants", "type"=>"MarketTag"}, {"id"=>376, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/productivity-software", "name"=>"Productivity Software", "type"=>"MarketTag"}, {"id"=>942, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/embedded-hardware-and-software", "name"=>"Embedded Hardware and Software", "type"=>"MarketTag"}, {"id"=>291, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/meeting-software", "name"=>"Meeting Software", "type"=>"MarketTag"}, {"id"=>13764, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/hardware-software", "name"=>"Hardware + Software", "type"=>"MarketTag"}, {"id"=>2983, "pic"=>"/images/icons/market.png", "url"=>"https://angel.co/software-compliance", "name"=>"Software Compliance", "type"=>"MarketTag"}] I've tried many methods inside of the gem I've been creating... the first method was to create a special class and map each array element to that class class IDSearch attr_accessor :id, :thumbnail, :url, :name, :type def initialize(the_hash) @id = the_hash['id'] @url = the_hash['url'] @pic = the_hash['pic'] @name = the_hash['name'] @type = the_hash['type'] end end I'll list them according to attempt Attempt 1: IDSearch.new(parsed_response) Attempt 2: parsed_response.map {|t| IDSearch.new(t)} Attempt 3: parsed_response.each do |hsh| SimpleAngel::IDSearch.new(hsh) end Attempt 4: 10.times do |i| instance_variable_set "@response_#{i}", parsed_response[i] end Attempt 5 (getting desperate) @response0 = parsed_response[0 @response1 = parsed_response[1] @response2 = parsed_response[2] @response3 = parsed_response[3] @response4 = parsed_response[4] @response5 = parsed_response[5] @response6 = parsed_response[6] @response7 = parsed_response[7] @response8 = parsed_response[8] @response9 = parsed_response[9] None of these methods has produced a predictable, coherent, workable response... More than an actual solution, I'm looking for a clue as to how my thinking has been flawed.
0
2,680,667
04/21/2010 06:00:07
262,325
01/30/2010 04:38:58
108
1
remove ViewController from memory
I hope to load an ViewController and do something then unload (viewDidUnload) it from memory. if (self.vViewController5.view.superview==nil) { ViewController5 *blueController = [[ViewController5 alloc] initWithNibName:@"View5" bundle:nil]; self.vViewController5 = blueController; [self.vViewController5 setDelegate:self]; [blueController release]; } [self presentModalViewController:vViewController5 animated:YES]; later, call [self dismissModalViewControllerAnimated:YES]; but I found that dismissModalViewControllerAnimated does not trigger the event viewDidUnload of Viewcontroller5. I try function release but it caused program collapse. I also try removeFromSuperView but it does not trigger the event ViewDidUnload neither. Welcome any comment Thanks interdev
iphone
null
null
null
null
null
open
remove ViewController from memory === I hope to load an ViewController and do something then unload (viewDidUnload) it from memory. if (self.vViewController5.view.superview==nil) { ViewController5 *blueController = [[ViewController5 alloc] initWithNibName:@"View5" bundle:nil]; self.vViewController5 = blueController; [self.vViewController5 setDelegate:self]; [blueController release]; } [self presentModalViewController:vViewController5 animated:YES]; later, call [self dismissModalViewControllerAnimated:YES]; but I found that dismissModalViewControllerAnimated does not trigger the event viewDidUnload of Viewcontroller5. I try function release but it caused program collapse. I also try removeFromSuperView but it does not trigger the event ViewDidUnload neither. Welcome any comment Thanks interdev
0
10,617,525
05/16/2012 11:25:23
1,398,455
05/16/2012 11:07:12
1
0
How to "fail" a scrapy spider process if number of errors too high
I have a few scrapy scripts that regularly scrape data from different medium sized websites. They are run from a shell script, the scraped data is dumped into a json file where a separate process picks it up from, removes the old data from the database and loads the new one. scrapy->output.json->delete old data from db->load output.json into the database There are always some small numbers of scraping errors, due to a couple of pages having a slightly different html format or broken links on the website, and that's ok. What I am trying to figure out is what the best strategy to "fail" the process is, if the number of scraping errors gets too high? That would probably indicate a major change to the website or the problem with the website at that moment. In that case I would want to keep the old data in the database until the new data can be scraped again. Either the scrapy process returning a different system exit code or maybe generating an empty json file?
python
scrapy
null
null
null
null
open
How to "fail" a scrapy spider process if number of errors too high === I have a few scrapy scripts that regularly scrape data from different medium sized websites. They are run from a shell script, the scraped data is dumped into a json file where a separate process picks it up from, removes the old data from the database and loads the new one. scrapy->output.json->delete old data from db->load output.json into the database There are always some small numbers of scraping errors, due to a couple of pages having a slightly different html format or broken links on the website, and that's ok. What I am trying to figure out is what the best strategy to "fail" the process is, if the number of scraping errors gets too high? That would probably indicate a major change to the website or the problem with the website at that moment. In that case I would want to keep the old data in the database until the new data can be scraped again. Either the scrapy process returning a different system exit code or maybe generating an empty json file?
0
6,128,977
05/25/2011 18:20:21
770,111
05/25/2011 18:20:21
1
0
sql command for Insert data in Descending Order
I want to insert data in daabase in descending order of date. i am using code is; insert into table name values (column(s) ) order by date DESC. But it not run.please help me.
c#
sql
null
null
null
null
open
sql command for Insert data in Descending Order === I want to insert data in daabase in descending order of date. i am using code is; insert into table name values (column(s) ) order by date DESC. But it not run.please help me.
0
3,950,015
10/16/2010 17:40:10
382,252
07/02/2010 17:08:02
111
6
Passing a cursor to an activity?
Is this possible? I am trying to open a SQLite database cursor in one activity, and pass it to another activity.
android
cursor
null
null
null
null
open
Passing a cursor to an activity? === Is this possible? I am trying to open a SQLite database cursor in one activity, and pass it to another activity.
0
9,820,737
03/22/2012 10:46:40
349,026
05/24/2010 14:18:18
1,234
49
Splunk - Searching capabilities how powerful is it?
I am new to splunk. Just 3 odd days at it. I have been using Lucene for indexing and searching raw data in forms of fielded and un-fielded data. I am very much impressed with lucenes performance for searching. I was wondering if the experience community can guide me here on a few capabilities of splunk. Specifically in comparison of splunk with respect to what I already know about Lucene. Not just limited to search. - How does splunk handle stop words? Words that are very common such a a,the,is... which we can provide manually to lucene. - Does splunk peform wildcard searches, proximity searches, regex searches? I know it can do fielded searches. - Optimizations on indices. Specially compression. - Is it possible to do Fuzzy, synonym based searches on splunk? I know this must be a length question but definitely would like to know some points from experienced people on splunk and hope not off track to rules of SO. Thank you.
search
splunk
capability
null
null
null
open
Splunk - Searching capabilities how powerful is it? === I am new to splunk. Just 3 odd days at it. I have been using Lucene for indexing and searching raw data in forms of fielded and un-fielded data. I am very much impressed with lucenes performance for searching. I was wondering if the experience community can guide me here on a few capabilities of splunk. Specifically in comparison of splunk with respect to what I already know about Lucene. Not just limited to search. - How does splunk handle stop words? Words that are very common such a a,the,is... which we can provide manually to lucene. - Does splunk peform wildcard searches, proximity searches, regex searches? I know it can do fielded searches. - Optimizations on indices. Specially compression. - Is it possible to do Fuzzy, synonym based searches on splunk? I know this must be a length question but definitely would like to know some points from experienced people on splunk and hope not off track to rules of SO. Thank you.
0
22,117
08/22/2008 11:36:45
1,709
08/18/2008 07:05:30
266
29
How do you organize your (online) resources and researched data?
Reading up on some of the answers to <a href="http://stackoverflow.com/questions/1831/what-can-someone-do-to-get-organized-around-here">another question</a> I found a tip about <a href="http://www.amazon.com/dp/0142000280/">a book I wanted to take a closer look at</a>. The provided link goes to <a href="http://www.amazon.com">amazon.com</a>, but for historical reasons I have my wish lists at <a href="http://www.amazon.co.uk">amazon.co.uk</a>. I have quite a few titles on my various lists, so I prefer to add all new books to the same site, making it easier to keep track of what I plan to buy. However, sometimes I will find a book that is not available on the UK site, so I have to maintain a separate list on the US site anyway. I would like to have my book lists on a different site, ideally stored alongside other resources I want to keep track of. So far I have come up with the following types of information that I need to organize: * Books I plan on buying or researching further. * Events, courses and conferences I plan to attend or find out more about * Articles I want to read or keep for future reference. * Various URLs. * Movies I want to see (i.e. IMDB links). * Music (albums, songs) I want to check out. * Various thoughts, notes and ideas (possibly related to a current or future project) Today I use a combination of browser bookmarks, <a href="http://www.evernote.com">Evernote</a> notes, Amazon wish lists, blog drafts and files stored on <a href="http://www.jungledisk.com">JungleDisk</a> drives too keep track of all this information. If something is specific to a given project, I will store the information in the project's Subversion repository. Common for all these types of information is that many of them would benefit from some integration with a third-party provider (i.e. links to book information on Amazon, links to music/band information on <a href="http://www.allmusic.com">allmusic.com</a> or Wikipedia, links to movie reviews on IMDB, etc.). I would also like to be able to organize everything in one place, ideally with tags and folders. I know I can make everything into links and organize them on delicious or make everything into notes and put them on Evernote, but maybe there exists a better site with direct support for many of these information types already? How do people here organize their (online) resources, notes and ideas? Note: Some of you may wonder what this has to do with programming, but since programming is a natural part of my everyday life, I don't really see any significant difference between organizing articles on functional programming or reviews of the latest Batman movie. I would still like to have it all accessible&mdash;and searchable&mdash;in one place. Also note that I'm not looking for yet another social bookmarking web site. I only need the information to be accessible to me, and sharing them with other people or adding friends on the site is of no importance. I guess a desktop application would do the job, but a web site would be more convenient to access from anywhere.
self-improvement
organizing
research
online-resources
null
01/28/2012 01:09:04
off topic
How do you organize your (online) resources and researched data? === Reading up on some of the answers to <a href="http://stackoverflow.com/questions/1831/what-can-someone-do-to-get-organized-around-here">another question</a> I found a tip about <a href="http://www.amazon.com/dp/0142000280/">a book I wanted to take a closer look at</a>. The provided link goes to <a href="http://www.amazon.com">amazon.com</a>, but for historical reasons I have my wish lists at <a href="http://www.amazon.co.uk">amazon.co.uk</a>. I have quite a few titles on my various lists, so I prefer to add all new books to the same site, making it easier to keep track of what I plan to buy. However, sometimes I will find a book that is not available on the UK site, so I have to maintain a separate list on the US site anyway. I would like to have my book lists on a different site, ideally stored alongside other resources I want to keep track of. So far I have come up with the following types of information that I need to organize: * Books I plan on buying or researching further. * Events, courses and conferences I plan to attend or find out more about * Articles I want to read or keep for future reference. * Various URLs. * Movies I want to see (i.e. IMDB links). * Music (albums, songs) I want to check out. * Various thoughts, notes and ideas (possibly related to a current or future project) Today I use a combination of browser bookmarks, <a href="http://www.evernote.com">Evernote</a> notes, Amazon wish lists, blog drafts and files stored on <a href="http://www.jungledisk.com">JungleDisk</a> drives too keep track of all this information. If something is specific to a given project, I will store the information in the project's Subversion repository. Common for all these types of information is that many of them would benefit from some integration with a third-party provider (i.e. links to book information on Amazon, links to music/band information on <a href="http://www.allmusic.com">allmusic.com</a> or Wikipedia, links to movie reviews on IMDB, etc.). I would also like to be able to organize everything in one place, ideally with tags and folders. I know I can make everything into links and organize them on delicious or make everything into notes and put them on Evernote, but maybe there exists a better site with direct support for many of these information types already? How do people here organize their (online) resources, notes and ideas? Note: Some of you may wonder what this has to do with programming, but since programming is a natural part of my everyday life, I don't really see any significant difference between organizing articles on functional programming or reviews of the latest Batman movie. I would still like to have it all accessible&mdash;and searchable&mdash;in one place. Also note that I'm not looking for yet another social bookmarking web site. I only need the information to be accessible to me, and sharing them with other people or adding friends on the site is of no importance. I guess a desktop application would do the job, but a web site would be more convenient to access from anywhere.
2
6,472,883
06/24/2011 19:34:40
475,993
10/14/2010 16:01:41
4,037
329
Using list elements and indices together
I've always found it awkward to have a function or expression that requires use of the values, as well as indices, of a list (or array, applies just the same) in Haskell. I wrote `validQueens` below while experimenting with the N-queens problem <a href="http://stackoverflow.com/questions/6470412/extent-of-ghcs-optimization"> here </a>... validQueens x = and [abs (x!!i - x!!j) /= j-i | i<-[0..length x - 2], j<-[i+1..length x - 1]] I didn't care for the use of indexing, all the plus and minuses, etc. It feels sloppy. I came up with the following: enumerate x = zip [0..length x - 1] x validQueens' :: [Int] -> Bool validQueens' x = and [abs (snd j - snd i) /= fst j - fst i | i<-l, j<-l, fst j > fst i] where l = enumerate x being inspired by Python's `enumerate` (not that borrowing imperative concepts is necessarily a great idea). Seems better in concept, but `snd` and `fst` all over the place kinda sucks. It's also, at least at first glance, costlier both in time and space. I'm not sure whether or not I like it any better. So in short, I am not really satisfied with either 1. Iterating thru by index bounded by lengths, or even worse, off-by-ones and twos 2. Index-element tuples Has anyone found a pattern they find more elegant than either of the above? If not, is there any compelling reason one of the above methods is superior?
arrays
list
haskell
indices
null
null
open
Using list elements and indices together === I've always found it awkward to have a function or expression that requires use of the values, as well as indices, of a list (or array, applies just the same) in Haskell. I wrote `validQueens` below while experimenting with the N-queens problem <a href="http://stackoverflow.com/questions/6470412/extent-of-ghcs-optimization"> here </a>... validQueens x = and [abs (x!!i - x!!j) /= j-i | i<-[0..length x - 2], j<-[i+1..length x - 1]] I didn't care for the use of indexing, all the plus and minuses, etc. It feels sloppy. I came up with the following: enumerate x = zip [0..length x - 1] x validQueens' :: [Int] -> Bool validQueens' x = and [abs (snd j - snd i) /= fst j - fst i | i<-l, j<-l, fst j > fst i] where l = enumerate x being inspired by Python's `enumerate` (not that borrowing imperative concepts is necessarily a great idea). Seems better in concept, but `snd` and `fst` all over the place kinda sucks. It's also, at least at first glance, costlier both in time and space. I'm not sure whether or not I like it any better. So in short, I am not really satisfied with either 1. Iterating thru by index bounded by lengths, or even worse, off-by-ones and twos 2. Index-element tuples Has anyone found a pattern they find more elegant than either of the above? If not, is there any compelling reason one of the above methods is superior?
0
8,258,861
11/24/2011 14:47:58
1,064,136
11/24/2011 14:26:34
1
0
Access violation with Ctypes Python <> Fortran DLL
I'm trying to make Python use a Fortran DLL (call by referance). When running Fortran 90 code, it works fine, but will not work in Python; it only gives "access violation" errors or "called with not enough arguments". The python code: from ctypes import * mydll = cdll.LoadLibrary("test.dll") # This function works. print mydll.XIT() # prints 0 mydll.GetInfo.argtypes = [POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_char_p)] rm = c_int() rf = c_int() vm = (c_int * 5)() vf = (c_int * 5)() np = c_int(14) p = (c_int * 14)() filename = "test" fn = c_char_p(filename) nc = c_int(len(filename)) # length of string. (Hidden argument in Fortran) # throws insufucient arguments print mydll.GetInfo(rm,rf,vm,vf,np,p,fn,nc) # throws access violation print mydll.GetInfo(byref(rm),byref(rf),byref(vm),byref(vf),byref(np),byref(p),byref(fn),byref(nc)) The fortran90 code: program test implicit none integer, parameter :: np = 14 integer :: rm, rf integer, dimension(5) :: vm, vf integer, dimension(np) :: p character(len=80) :: fn interface integer function GetInfo(rm, rf, vm, vf, np, p, fn) !dec$ attributes dllimport, stdcall, reference, decorate, alias:'GetInfo' :: GetInfo implicit none character(len=*), intent(in) :: fn integer, intent(in) :: np integer, intent(out) :: rm,rf integer, intent(out), dimension(5) :: vm,vf integer, intent(out), dimension(np) :: p end function GetInfo end interface fn = "test" print *, GetInfo(rm, rf, vm, vf, np, p, fn) end program test
python
dll
fortran
ctypes
null
null
open
Access violation with Ctypes Python <> Fortran DLL === I'm trying to make Python use a Fortran DLL (call by referance). When running Fortran 90 code, it works fine, but will not work in Python; it only gives "access violation" errors or "called with not enough arguments". The python code: from ctypes import * mydll = cdll.LoadLibrary("test.dll") # This function works. print mydll.XIT() # prints 0 mydll.GetInfo.argtypes = [POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_int),POINTER(c_char_p)] rm = c_int() rf = c_int() vm = (c_int * 5)() vf = (c_int * 5)() np = c_int(14) p = (c_int * 14)() filename = "test" fn = c_char_p(filename) nc = c_int(len(filename)) # length of string. (Hidden argument in Fortran) # throws insufucient arguments print mydll.GetInfo(rm,rf,vm,vf,np,p,fn,nc) # throws access violation print mydll.GetInfo(byref(rm),byref(rf),byref(vm),byref(vf),byref(np),byref(p),byref(fn),byref(nc)) The fortran90 code: program test implicit none integer, parameter :: np = 14 integer :: rm, rf integer, dimension(5) :: vm, vf integer, dimension(np) :: p character(len=80) :: fn interface integer function GetInfo(rm, rf, vm, vf, np, p, fn) !dec$ attributes dllimport, stdcall, reference, decorate, alias:'GetInfo' :: GetInfo implicit none character(len=*), intent(in) :: fn integer, intent(in) :: np integer, intent(out) :: rm,rf integer, intent(out), dimension(5) :: vm,vf integer, intent(out), dimension(np) :: p end function GetInfo end interface fn = "test" print *, GetInfo(rm, rf, vm, vf, np, p, fn) end program test
0
951,141
06/04/2009 15:02:10
81,085
03/22/2009 15:23:13
67
3
Best javascript libraries to work with rails?
I want to develop an application with simple Quiz-like games (think of a question , answer, a timer, high-scores/ranking, not much more) For that I want to use Rails and some javascript library that let me have some modern effects on the GUI (being a GUI the least you can ask is for an atractive interface) I first considered ExtJS but now I think is too serious for this. Also there are millions of extensions for prototype(http://stickmanlabs.com/lightwindow/ http://underwhelm.net/pinwheel/ etc) that looks more casual but dont know if they will play well with rails So what is in general the best Javascript gui/widgets library out there when the backend is going to be Rails? And in my particular case what would you recommend?
ruby
javascript
widgets
ruby-on-rails
null
09/15/2011 12:28:38
not constructive
Best javascript libraries to work with rails? === I want to develop an application with simple Quiz-like games (think of a question , answer, a timer, high-scores/ranking, not much more) For that I want to use Rails and some javascript library that let me have some modern effects on the GUI (being a GUI the least you can ask is for an atractive interface) I first considered ExtJS but now I think is too serious for this. Also there are millions of extensions for prototype(http://stickmanlabs.com/lightwindow/ http://underwhelm.net/pinwheel/ etc) that looks more casual but dont know if they will play well with rails So what is in general the best Javascript gui/widgets library out there when the backend is going to be Rails? And in my particular case what would you recommend?
4
4,927,482
02/07/2011 22:37:57
606,894
02/07/2011 18:13:31
6
0
custom text passed to ACTION_CALL activity
On Android 2.1+ I am calling a number that is not in the contacts database using the activity started by startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + ptn))) Since the number is not in the contacts database there is no name associated with the call. I want to display a name with the called number so the user can verify the number the application is calling. I tried using a LabeledIntent, but couldn't get it to work with ACTION_CALL. Is there a way to make a call using the ACTION_CALL intent or through some other means where I can pass a name that will be displayed during the call?
android
null
null
null
null
null
open
custom text passed to ACTION_CALL activity === On Android 2.1+ I am calling a number that is not in the contacts database using the activity started by startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + ptn))) Since the number is not in the contacts database there is no name associated with the call. I want to display a name with the called number so the user can verify the number the application is calling. I tried using a LabeledIntent, but couldn't get it to work with ACTION_CALL. Is there a way to make a call using the ACTION_CALL intent or through some other means where I can pass a name that will be displayed during the call?
0
4,274,479
11/25/2010 07:04:00
62,536
02/04/2009 17:50:08
57
2
JQuery can't focus on form fields if Cufon is loaded
I've got the following site: http://www.peterandbethany.com/ There is a simple jQuery line that should set focus on a particular field. When I use <a href="http://cufon.shoqolate.com/">Cufon</a>, it simply won't set the focus. If I disable Cufon or disable stylesheets (in Firefox, View->Page Style->No Style), it works. None of the following approaches via jQuery work: $('#name').focus(); $("input[type='text']:first").focus() $("input:text:visible:enabled:first").focus(); $('#name').trigger('focus'); Any ideas on how I can make this work? Thank you!
jquery
forms
focus
cufon
null
null
open
JQuery can't focus on form fields if Cufon is loaded === I've got the following site: http://www.peterandbethany.com/ There is a simple jQuery line that should set focus on a particular field. When I use <a href="http://cufon.shoqolate.com/">Cufon</a>, it simply won't set the focus. If I disable Cufon or disable stylesheets (in Firefox, View->Page Style->No Style), it works. None of the following approaches via jQuery work: $('#name').focus(); $("input[type='text']:first").focus() $("input:text:visible:enabled:first").focus(); $('#name').trigger('focus'); Any ideas on how I can make this work? Thank you!
0
1,163,225
07/22/2009 05:34:27
141,810
07/21/2009 06:43:14
11
0
Build J2EE Web Application
I have a lot of experience with HTML, SQL. Also a lot of experience in Java. But I don't know how to build a Database driven J2EE Web Application. From what I understand I'll be needing Spring, Hibernate, EJB 3 as a good foundation of technology to get started. I'll need a MVC framework (JSF, Spring MVC, Struts, etc.). I have gone through tutorials for several of these technologies but I just don't know how I would go about building my own web app from scratch. Does anyone know a good book or resource that will kind of walk me through good design and best practices?
java-ee
web-applications
tutorials
null
null
11/13/2011 15:56:28
not constructive
Build J2EE Web Application === I have a lot of experience with HTML, SQL. Also a lot of experience in Java. But I don't know how to build a Database driven J2EE Web Application. From what I understand I'll be needing Spring, Hibernate, EJB 3 as a good foundation of technology to get started. I'll need a MVC framework (JSF, Spring MVC, Struts, etc.). I have gone through tutorials for several of these technologies but I just don't know how I would go about building my own web app from scratch. Does anyone know a good book or resource that will kind of walk me through good design and best practices?
4
4,090,950
11/03/2010 19:37:59
75,612
03/09/2009 13:11:21
40
2
Google maps static displaying in Firefox but not in Google Chrome ???
I have this html code that I use to display location using Google chrome static API <img src="http://maps.google.com/staticmap?center=45.49558919270833,15.543660481770834&amp;zoom=14&amp;size=475x390&amp;maptype=mobile&amp;markers=45.49558919270833,15.543660481770834,blue&amp;key=ABQIAAAAdco5_H7LOM9g_zpERCDbTRRjR6gPnoGgGJLZeHh5-ndhggJYMxRqh1xqSx3d-C6qdRvNoh0KewGWLw"> But it displays in firefox but not in Chrome ???
google
maps
null
null
null
null
open
Google maps static displaying in Firefox but not in Google Chrome ??? === I have this html code that I use to display location using Google chrome static API <img src="http://maps.google.com/staticmap?center=45.49558919270833,15.543660481770834&amp;zoom=14&amp;size=475x390&amp;maptype=mobile&amp;markers=45.49558919270833,15.543660481770834,blue&amp;key=ABQIAAAAdco5_H7LOM9g_zpERCDbTRRjR6gPnoGgGJLZeHh5-ndhggJYMxRqh1xqSx3d-C6qdRvNoh0KewGWLw"> But it displays in firefox but not in Chrome ???
0
11,197,780
06/25/2012 21:42:01
1,336,983
04/16/2012 18:13:26
29
1
How to insert data from dat to sql table?
I want to insert data from a .dat file to an sql table. But I dont want to use bulk insert. The dat file looks like this: dd qwe 3 ss asd 3 How can I do this? Thanks..
sql
null
null
null
null
06/26/2012 11:45:56
not a real question
How to insert data from dat to sql table? === I want to insert data from a .dat file to an sql table. But I dont want to use bulk insert. The dat file looks like this: dd qwe 3 ss asd 3 How can I do this? Thanks..
1
8,896,466
01/17/2012 14:38:58
261,139
01/28/2010 16:09:45
43
1
is there an open source commenting system available?
I'd like to enable a commenting mechanism through the system, I've done some googling and found some SaaS like [disqus](http://disqus.com/) and [gentlesource](http://www.gentlesource.com/comment-script/) but I'm looking for more like self-hosted / open source apps. and I like to understand the architecture of such a systems in case I wanted to implement it myself.
java
commenting
null
null
null
01/17/2012 21:29:07
off topic
is there an open source commenting system available? === I'd like to enable a commenting mechanism through the system, I've done some googling and found some SaaS like [disqus](http://disqus.com/) and [gentlesource](http://www.gentlesource.com/comment-script/) but I'm looking for more like self-hosted / open source apps. and I like to understand the architecture of such a systems in case I wanted to implement it myself.
2
11,018,120
06/13/2012 15:19:52
1,415,325
05/24/2012 14:39:39
8
0
Bug in resampling with pandas 0.8?
I am currently fighting to work with the reasmpling function from pandas 0.8.0b1. For example, when I try to aggregate (using 'mean') 10min values to monthly values, the function seems to use the last day of data from one month in the mean of the next month... Here is an example with a simple time serie of 3 month of 10 minutes data with - january 2012 : all values = 1 - february 2012 : all values = 2 - march 2012 : all values = 3 The monthly means I get using df.resample('M',how='mean') are : Out[454]: 0 2012-01-31 1.000000 2012-02-29 1.965757 2012-03-31 2.967966 2012-04-30 3.000000 but I would like to get something like: 0 2012-02-01 1.000000 2012-03-01 2.000000 2012-04-01 3.000000 Here is the code: january = pd.date_range(pd.datetime(2012,1,1),pd.datetime(2012,1,31,23,50),freq='10min') february = pd.date_range(pd.datetime(2012,2,1),pd.datetime(2012,2,29,23,50),freq='10min') march = pd.date_range(pd.datetime(2012,3,1),pd.datetime(2012,3,31,23,50),freq='10min') data_jan = np.zeros(size(january))+1 data_feb = np.zeros(size(february))+2 data_march = np.zeros(size(march))+3 df1 = pd.DataFrame(data_jan,index=january) df2 = pd.DataFrame(data_feb,index=february) df3 = pd.DataFrame(data_march,index=march) df = pd.concat([df1,df2,df3]) df.resample('M',how='mean') If now, I remove the last day by : january = pd.date_range(pd.datetime(2012,1,1),pd.datetime(2012,1,31,00,00),freq='10min') february = pd.date_range(pd.datetime(2012,2,1),pd.datetime(2012,2,29,00,00),freq='10min') march = pd.date_range(pd.datetime(2012,3,1),pd.datetime(2012,3,31,00,00),freq='10min') I get (nearly) what I want: Out[474]: 0 2012-01-31 1 2012-02-29 2 2012-03-31 3 Could you help me ???? Is it a bug ???
python
pandas
resampling
null
null
null
open
Bug in resampling with pandas 0.8? === I am currently fighting to work with the reasmpling function from pandas 0.8.0b1. For example, when I try to aggregate (using 'mean') 10min values to monthly values, the function seems to use the last day of data from one month in the mean of the next month... Here is an example with a simple time serie of 3 month of 10 minutes data with - january 2012 : all values = 1 - february 2012 : all values = 2 - march 2012 : all values = 3 The monthly means I get using df.resample('M',how='mean') are : Out[454]: 0 2012-01-31 1.000000 2012-02-29 1.965757 2012-03-31 2.967966 2012-04-30 3.000000 but I would like to get something like: 0 2012-02-01 1.000000 2012-03-01 2.000000 2012-04-01 3.000000 Here is the code: january = pd.date_range(pd.datetime(2012,1,1),pd.datetime(2012,1,31,23,50),freq='10min') february = pd.date_range(pd.datetime(2012,2,1),pd.datetime(2012,2,29,23,50),freq='10min') march = pd.date_range(pd.datetime(2012,3,1),pd.datetime(2012,3,31,23,50),freq='10min') data_jan = np.zeros(size(january))+1 data_feb = np.zeros(size(february))+2 data_march = np.zeros(size(march))+3 df1 = pd.DataFrame(data_jan,index=january) df2 = pd.DataFrame(data_feb,index=february) df3 = pd.DataFrame(data_march,index=march) df = pd.concat([df1,df2,df3]) df.resample('M',how='mean') If now, I remove the last day by : january = pd.date_range(pd.datetime(2012,1,1),pd.datetime(2012,1,31,00,00),freq='10min') february = pd.date_range(pd.datetime(2012,2,1),pd.datetime(2012,2,29,00,00),freq='10min') march = pd.date_range(pd.datetime(2012,3,1),pd.datetime(2012,3,31,00,00),freq='10min') I get (nearly) what I want: Out[474]: 0 2012-01-31 1 2012-02-29 2 2012-03-31 3 Could you help me ???? Is it a bug ???
0
8,213,985
11/21/2011 15:14:28
909,071
08/24/2011 07:08:45
100
2
Getting full image from link on photosharing services
I want to do script, that can get direct link to the image from photo-services (flickr, instagram, picasa, deviantart & dribbble) User adds link into the form: http://www.flickr.com/photos/peterbaker/3045862811/ script makes direct link to the image: http://farm4.staticflickr.com/3179/3045862811_dd27f77e3a_b.jpg How to make it? I want to know exactly how to get a direct link to the image on these services.
php
api
flickr
null
null
null
open
Getting full image from link on photosharing services === I want to do script, that can get direct link to the image from photo-services (flickr, instagram, picasa, deviantart & dribbble) User adds link into the form: http://www.flickr.com/photos/peterbaker/3045862811/ script makes direct link to the image: http://farm4.staticflickr.com/3179/3045862811_dd27f77e3a_b.jpg How to make it? I want to know exactly how to get a direct link to the image on these services.
0
11,727,727
07/30/2012 18:51:04
759,549
05/18/2011 16:05:10
549
17
sql query returning multiple dates, only need latest date
I have a query that returns users by first name, last name, user id and a date they've completed an event. I want the query to only return one row per user, but some users have completed the same event on multiple dates. I can't use a distinct becuase the dates are distinct, and I can't use a group by for the same reason. how can I have the query return only the latest date on which the event was completed?
sql
sql-server
tsql
null
null
null
open
sql query returning multiple dates, only need latest date === I have a query that returns users by first name, last name, user id and a date they've completed an event. I want the query to only return one row per user, but some users have completed the same event on multiple dates. I can't use a distinct becuase the dates are distinct, and I can't use a group by for the same reason. how can I have the query return only the latest date on which the event was completed?
0
9,487,356
02/28/2012 18:07:22
584,862
01/21/2011 18:18:56
12,819
369
How to uninstall JavaFx from Windows machine if previously deleted Oracle install directory?
Before going to the Add or Remove Programs dialog to properly uninstall JavaFx, I accidentally deleted the Oracle install directory and removed it from the Recycle Bin (*cue laugh-track*). Now, when I go to remove JavaFx, I get the following error dialog, ![enter image description here][1] [1]: http://i.stack.imgur.com/szgIC.png And after I click "OK", it rolls back the uninstall. Ut-oh! So, how do I uninstall JavaFx now?
java
windows
javafx
uninstall
null
02/29/2012 19:07:43
off topic
How to uninstall JavaFx from Windows machine if previously deleted Oracle install directory? === Before going to the Add or Remove Programs dialog to properly uninstall JavaFx, I accidentally deleted the Oracle install directory and removed it from the Recycle Bin (*cue laugh-track*). Now, when I go to remove JavaFx, I get the following error dialog, ![enter image description here][1] [1]: http://i.stack.imgur.com/szgIC.png And after I click "OK", it rolls back the uninstall. Ut-oh! So, how do I uninstall JavaFx now?
2
205,893
10/15/2008 18:38:17
1,909
08/19/2008 14:04:34
186
7
sharepoint interview questions
Let's have a list of some good interview questions for SharePoint developers. Please provide one question per entry, and if possible, the answers. Also, please feel free to suggest corrections if the provided answers are wrong. I will go first: Q: How does SharePoint store pages? A: [How-to-locate-sharepoint-document-library-source-page-on-the-server?][1] [1]: http://stackoverflow.com/questions/125805/how-to-locate-sharepoint-document-library-source-page-on-the-server#127138
sharepoint
moss
interview-questions
wss
null
11/29/2011 02:43:29
not constructive
sharepoint interview questions === Let's have a list of some good interview questions for SharePoint developers. Please provide one question per entry, and if possible, the answers. Also, please feel free to suggest corrections if the provided answers are wrong. I will go first: Q: How does SharePoint store pages? A: [How-to-locate-sharepoint-document-library-source-page-on-the-server?][1] [1]: http://stackoverflow.com/questions/125805/how-to-locate-sharepoint-document-library-source-page-on-the-server#127138
4
6,178,276
05/30/2011 15:43:34
776,475
05/30/2011 15:28:57
1
0
What is The Memory Address of Character Table In Dos ?
please help me! i want to know what is the address of character table in dos where we can create new fonts and symbols by manipulating the pixels of the each character . i now how can i change it with BIOS interrupts but i only need the memory address of the character table in dos for direct access . thanks.
c
memory
assembly
dos
null
06/04/2011 02:40:32
not a real question
What is The Memory Address of Character Table In Dos ? === please help me! i want to know what is the address of character table in dos where we can create new fonts and symbols by manipulating the pixels of the each character . i now how can i change it with BIOS interrupts but i only need the memory address of the character table in dos for direct access . thanks.
1
682,636
03/25/2009 17:32:44
34,956
11/06/2008 04:26:17
135
12
Learning multiple programming languages
I have been reading about the need to learn multiple programming languages and have become quite convinced that it is important to understand multiple languages. Once a developer becomes familiar with one language, it is easier to learn another language by mapping common concepts and differences. I have tried to list some generic questions which might help in mapping programming concepts to the way they are implemented in the language. Are there any more questions which can be asked for a programming language? I think if we can answer these questions for a language, it will give a good grasp of it's strengths, weaknesses, and how to work with it. 1. What constructs does the language offer for modularity (namespaces, objects, functions, modules)? 2. What are the first class citizens (types... including primitives) of this language? 3. What type of access control features does the language offer? 4. What kind of abstraction, and encapsulation does this language offer? 5. What constructs does this language offer for managing program flow? 6. How does one interact with files in this language? 7. How does one hold object (collections)? 8. How do we manage exceptional conditions? 9. Does the language have any in-built security features? 10. What concurrency model does the language support? 11. How does this language manage cleanup of resources and memory? 12. What are the important API classes in this language? 13. What are the main features of the languages runtime? 14. Does the language offer meta-programming support? 15. Are there any features unique to this language? I came up with this list of questions which I am hoping will help me learn other languages from my base of Java development. Is making such a list a good approach to learning another language? Can we add more questions? Is it possible to create a list of such questions, which will be sufficient to approach any language, or will the list always fall short for at least some languages?
language
null
null
null
null
03/25/2009 21:58:47
not a real question
Learning multiple programming languages === I have been reading about the need to learn multiple programming languages and have become quite convinced that it is important to understand multiple languages. Once a developer becomes familiar with one language, it is easier to learn another language by mapping common concepts and differences. I have tried to list some generic questions which might help in mapping programming concepts to the way they are implemented in the language. Are there any more questions which can be asked for a programming language? I think if we can answer these questions for a language, it will give a good grasp of it's strengths, weaknesses, and how to work with it. 1. What constructs does the language offer for modularity (namespaces, objects, functions, modules)? 2. What are the first class citizens (types... including primitives) of this language? 3. What type of access control features does the language offer? 4. What kind of abstraction, and encapsulation does this language offer? 5. What constructs does this language offer for managing program flow? 6. How does one interact with files in this language? 7. How does one hold object (collections)? 8. How do we manage exceptional conditions? 9. Does the language have any in-built security features? 10. What concurrency model does the language support? 11. How does this language manage cleanup of resources and memory? 12. What are the important API classes in this language? 13. What are the main features of the languages runtime? 14. Does the language offer meta-programming support? 15. Are there any features unique to this language? I came up with this list of questions which I am hoping will help me learn other languages from my base of Java development. Is making such a list a good approach to learning another language? Can we add more questions? Is it possible to create a list of such questions, which will be sufficient to approach any language, or will the list always fall short for at least some languages?
1
3,079,229
06/20/2010 12:32:26
353,542
05/29/2010 11:21:06
107
4
Comparing date("Y-m-d h:i:s");
how can I make a conditional statement like if date("Y-m-d h:i:s"); is more than 30 seconds after date("Y-m-d h:i:s");. I've previously used something like date("Y-m-d h:i:s"); < date("Y-m-d h:i:s"); + 30, however this doesn't seem to work. Help?
php
time
conditional-statements
null
null
null
open
Comparing date("Y-m-d h:i:s"); === how can I make a conditional statement like if date("Y-m-d h:i:s"); is more than 30 seconds after date("Y-m-d h:i:s");. I've previously used something like date("Y-m-d h:i:s"); < date("Y-m-d h:i:s"); + 30, however this doesn't seem to work. Help?
0
11,628,294
07/24/2012 09:50:14
1,143,563
01/11/2012 15:57:52
16
0
Using Excel Macro to connect to website
Does anyone know how i can connect to a website using Excel Macros? - e.g. www.yahoo.com I would like to create accounts on the website with this macros. But first I would like to connect to the website, get the list of accounts (spreadsheet) and then upload these accounts in mass. Please advise. Thanks
macros
null
null
null
null
07/24/2012 16:35:21
not a real question
Using Excel Macro to connect to website === Does anyone know how i can connect to a website using Excel Macros? - e.g. www.yahoo.com I would like to create accounts on the website with this macros. But first I would like to connect to the website, get the list of accounts (spreadsheet) and then upload these accounts in mass. Please advise. Thanks
1
9,123,835
02/03/2012 04:51:02
1,129,764
01/04/2012 10:58:26
1
0
How to use open source java swing component?
Well I know this might sound really silly ! I am doing a project (MySQL with a Java GUI), I have downloaded source code of a java swing component (http://sourceforge.net/projects/jdatepicker/). I added it to the project file. Can anyone please tell me how can I implement it or use it ??
java
gui
components
source
open
02/03/2012 06:19:45
not a real question
How to use open source java swing component? === Well I know this might sound really silly ! I am doing a project (MySQL with a Java GUI), I have downloaded source code of a java swing component (http://sourceforge.net/projects/jdatepicker/). I added it to the project file. Can anyone please tell me how can I implement it or use it ??
1
341,813
12/04/2008 19:50:24
34,183
11/04/2008 14:32:27
251
13
Would Little Man Computer Programming be a good Interview Project?
In my college we used Little Man Computer projects to discover how processors and simple commands work. We try to give unique "homework assignments" to our interviewees between their initial and their second interviews. These projects are designed to discover things about their programming personality. I'm sure I can find [places online][1] who provide some kind of usuable LMC model. My primary concern with a Little Man Computer problem, is whether or not people know about it. If someone doesn't know it, if it would be hard to learn. It seems that 2/5 of my co-workers have not heard of LMC. Would a simple program on LMC be too "hard" of a project to assign for a 4-5 day task? We try to assign something that should only take 3-4 hours to write (Fibonacci Sequence, Binary Tree Sorting, etc). Would the learning curve on this be too high? Could those of you who have not heard of LMC, look it over and tell me if you think it would be hard to figure out (I have a biased opinion. I love LMC). Thanks in advance! http://en.wikipedia.org/wiki/Little_man_computer [1]: http://www.engineers-excel.com/Tools/Little%20Man%20Computer/Description.htm
interview-questions
null
null
null
null
12/04/2011 02:18:38
off topic
Would Little Man Computer Programming be a good Interview Project? === In my college we used Little Man Computer projects to discover how processors and simple commands work. We try to give unique "homework assignments" to our interviewees between their initial and their second interviews. These projects are designed to discover things about their programming personality. I'm sure I can find [places online][1] who provide some kind of usuable LMC model. My primary concern with a Little Man Computer problem, is whether or not people know about it. If someone doesn't know it, if it would be hard to learn. It seems that 2/5 of my co-workers have not heard of LMC. Would a simple program on LMC be too "hard" of a project to assign for a 4-5 day task? We try to assign something that should only take 3-4 hours to write (Fibonacci Sequence, Binary Tree Sorting, etc). Would the learning curve on this be too high? Could those of you who have not heard of LMC, look it over and tell me if you think it would be hard to figure out (I have a biased opinion. I love LMC). Thanks in advance! http://en.wikipedia.org/wiki/Little_man_computer [1]: http://www.engineers-excel.com/Tools/Little%20Man%20Computer/Description.htm
2
11,358,051
07/06/2012 07:51:35
1,386,579
05/10/2012 08:35:09
15
1
The connection inside function not called
this is my snippet , please help me why the con .open is not working inside the function tabledel [link][1] [1]: http://codepad.org/KmNlj83n#comment-zZzdSRrf
c#
forms
null
null
null
07/07/2012 07:12:30
not a real question
The connection inside function not called === this is my snippet , please help me why the con .open is not working inside the function tabledel [link][1] [1]: http://codepad.org/KmNlj83n#comment-zZzdSRrf
1
9,140,116
02/04/2012 10:21:31
1,167,550
01/24/2012 17:09:15
8
0
How to set acpi=off permanently in ubuntu 10.04
Every time when i boot ubuntu I have to set acpi=off otherwise it will show the error "kernel-thread-result 0X7/0X10" and pause there... Is there any way to permanently set acpi to off... please help!!!!!
ubuntu
null
null
null
null
02/04/2012 11:55:30
off topic
How to set acpi=off permanently in ubuntu 10.04 === Every time when i boot ubuntu I have to set acpi=off otherwise it will show the error "kernel-thread-result 0X7/0X10" and pause there... Is there any way to permanently set acpi to off... please help!!!!!
2
8,420,970
12/07/2011 19:03:38
959,833
09/22/2011 19:02:36
26
2
Is ruby quiz still alive?
A google search brings up 3 retired versions: www.rubyquiz.com (v1), http://www.splatbang.com/rubyquiz/ (v2), http://rubyquiz.strd6.com/ (v3). It looks like that last quiz posted to v3 was in 2010. Is there a Ruby Quiz 4 or something like it?
ruby
null
null
null
null
12/07/2011 19:39:59
off topic
Is ruby quiz still alive? === A google search brings up 3 retired versions: www.rubyquiz.com (v1), http://www.splatbang.com/rubyquiz/ (v2), http://rubyquiz.strd6.com/ (v3). It looks like that last quiz posted to v3 was in 2010. Is there a Ruby Quiz 4 or something like it?
2
10,106,560
04/11/2012 13:10:13
1,324,443
04/10/2012 15:32:01
1
0
User Interface Language for Browsers/Desktops/Android
I'm looking for a user interface language to create an application that can be easily ported to run as a cross-browser web application, desktop application, and Android application. Is there anything like that?
user-interface
null
null
null
null
06/19/2012 22:51:41
not a real question
User Interface Language for Browsers/Desktops/Android === I'm looking for a user interface language to create an application that can be easily ported to run as a cross-browser web application, desktop application, and Android application. Is there anything like that?
1
5,080,017
02/22/2011 15:20:01
427,306
08/21/2010 21:08:47
508
13
Dancer vs Catalyst [Perl Web Frameworks]
What do you think about both? I began reading a book about Catalyst, and found it pretty complex as compared to Dancer. so now I'm giving Dancer a try, and it looks easier to learn and more "humane friendly".
perl
mvc
catalyst
null
null
01/13/2012 16:57:41
not constructive
Dancer vs Catalyst [Perl Web Frameworks] === What do you think about both? I began reading a book about Catalyst, and found it pretty complex as compared to Dancer. so now I'm giving Dancer a try, and it looks easier to learn and more "humane friendly".
4
8,658,028
12/28/2011 15:50:50
971,115
09/29/2011 12:30:14
42
0
Soapcontext visual basic example
Is there a good web resource for how to use the SOAPcontext web service in visual basic and asp.net?
asp.net
null
null
null
null
null
open
Soapcontext visual basic example === Is there a good web resource for how to use the SOAPcontext web service in visual basic and asp.net?
0
11,042,552
06/14/2012 23:05:11
1,136,700
01/08/2012 04:02:19
656
0
What does the modcount variable when debugging the collection
When debugging Java code using eclipse, for colletcion variables, I saw the modcount member, what does it mean?
java
eclipse
null
null
null
null
open
What does the modcount variable when debugging the collection === When debugging Java code using eclipse, for colletcion variables, I saw the modcount member, what does it mean?
0
8,160,798
11/17/2011 00:51:22
1,050,760
11/17/2011 00:25:28
1
0
Detecting if keys are available in onscreen keyboard of mobile device
I'm adding some mobile usability optimisations to our site. As part of this I am tweaking the type attribute of textfields, to give the user the best input tools for the expected data type. One issue I have come up against in touchscreen mobile devices is that browsers on different OSes, and even different browsers on the same OS, show different onscreen keyboards when input type="number" is used. Safari on iOS 4.3.3 (iPhone 4) and Chrome on Android 2.3.4 include a decimal point, but Firefox on Android 2.3.4 does not. I have tried adding the step attribute (step="0.1") with no improvement in Firefox. If I cannot show the decimal point I will need to show Firefox the full QWERTY keyboard, which is obviously not going to make for the best user experience. It also raises the issue of browser/device sniffing. Either I'll need to make QWERTY the default, and show the numberpad to the handful of devices I can actually test on, or make numberpad the default, and switch back to QWERTY on devices which I know this will break on, the latter option being far less robust as I cannot test on every device ever made. Testing for support for input type="number" is not a fix, as obviously the browser does support the element, it just doesn't offer enough keyboard options to enter all number types. So.. I was wondering if anyone knew of a way to test for the presence of a certain key (such as the decimal point) in the keyboard the browser/OS assigns to the input type, and/or if anyone else has some better suggestions, as I'm quite new to mobile devices. I should also mention that I am using JavaScript here, as this is a website, not a native App. Thanks :)
android
ios
firefox
keyboard
touchscreen
null
open
Detecting if keys are available in onscreen keyboard of mobile device === I'm adding some mobile usability optimisations to our site. As part of this I am tweaking the type attribute of textfields, to give the user the best input tools for the expected data type. One issue I have come up against in touchscreen mobile devices is that browsers on different OSes, and even different browsers on the same OS, show different onscreen keyboards when input type="number" is used. Safari on iOS 4.3.3 (iPhone 4) and Chrome on Android 2.3.4 include a decimal point, but Firefox on Android 2.3.4 does not. I have tried adding the step attribute (step="0.1") with no improvement in Firefox. If I cannot show the decimal point I will need to show Firefox the full QWERTY keyboard, which is obviously not going to make for the best user experience. It also raises the issue of browser/device sniffing. Either I'll need to make QWERTY the default, and show the numberpad to the handful of devices I can actually test on, or make numberpad the default, and switch back to QWERTY on devices which I know this will break on, the latter option being far less robust as I cannot test on every device ever made. Testing for support for input type="number" is not a fix, as obviously the browser does support the element, it just doesn't offer enough keyboard options to enter all number types. So.. I was wondering if anyone knew of a way to test for the presence of a certain key (such as the decimal point) in the keyboard the browser/OS assigns to the input type, and/or if anyone else has some better suggestions, as I'm quite new to mobile devices. I should also mention that I am using JavaScript here, as this is a website, not a native App. Thanks :)
0
8,909,091
01/18/2012 11:11:13
856,132
04/23/2011 10:45:04
1,088
68
How to successfully cause deadlock
I'm trying to cause deadlock in C# for simulation purposes. Just a quick program. Could anyone kindly suggest some ideas for doing so?
deadlock
null
null
null
null
07/25/2012 13:05:30
not constructive
How to successfully cause deadlock === I'm trying to cause deadlock in C# for simulation purposes. Just a quick program. Could anyone kindly suggest some ideas for doing so?
4
6,491,220
06/27/2011 09:58:42
13,198
09/16/2008 17:36:01
11,303
758
Show Image on Select Change in MVC3 Razor
I have a select list which contains some values representing status of some task. The values for select list will come from a property in ViewModel. The object representing status also contains path of associate image like: class Status { public int Id{get;set;} public string Title{get;set;} public string ImagePath{get;set;} } Example values for **Rejected** status: var s=new Status{ Id=1, Title="Rejected", ImagePath="~/images/rej.png"}; The image path is relative to root directory. I want to display image representing the status on change of the select list in an image besides it. What is the best way to do this using MVC3 Razor?
asp.net-mvc-3
drop-down-menu
razor
null
null
null
open
Show Image on Select Change in MVC3 Razor === I have a select list which contains some values representing status of some task. The values for select list will come from a property in ViewModel. The object representing status also contains path of associate image like: class Status { public int Id{get;set;} public string Title{get;set;} public string ImagePath{get;set;} } Example values for **Rejected** status: var s=new Status{ Id=1, Title="Rejected", ImagePath="~/images/rej.png"}; The image path is relative to root directory. I want to display image representing the status on change of the select list in an image besides it. What is the best way to do this using MVC3 Razor?
0
10,376,893
04/29/2012 23:22:48
1,364,787
04/29/2012 23:18:40
1
0
Opensource pastie/pastepin
Is there a opensource pastie or pastebin like software that I could install on my VPS as I would like to use it for internal purposes as i do a lot of coding and would like to know that I have them all stored and easily accessible from anywhere I go.
networking
open-source
install
pastebin
pastie
05/02/2012 13:03:42
off topic
Opensource pastie/pastepin === Is there a opensource pastie or pastebin like software that I could install on my VPS as I would like to use it for internal purposes as i do a lot of coding and would like to know that I have them all stored and easily accessible from anywhere I go.
2
6,460,618
06/23/2011 21:08:28
813,107
06/23/2011 21:08:28
1
0
Simple question about JTextArea
I want to create a blank text area in which the user can enter a few sentences, and then, when the user closes the window (or before), I want to save this text in a string (and print it just to test that it works). So far, the code I have written does not work: JTextArea area = new JTextArea(5,20); JScrollPane scrollPane = new JScrollPane(q); JFrame frame = new JFrame("TextDemo"); frame.add(scrollPane); frame.pack(); frame.setVisible(true); String paragraph_text = area.getText(); System.out.println(paragraph_text);
text
textarea
jtextarea
null
null
null
open
Simple question about JTextArea === I want to create a blank text area in which the user can enter a few sentences, and then, when the user closes the window (or before), I want to save this text in a string (and print it just to test that it works). So far, the code I have written does not work: JTextArea area = new JTextArea(5,20); JScrollPane scrollPane = new JScrollPane(q); JFrame frame = new JFrame("TextDemo"); frame.add(scrollPane); frame.pack(); frame.setVisible(true); String paragraph_text = area.getText(); System.out.println(paragraph_text);
0
1,261,436
08/11/2009 16:16:47
154,477
08/11/2009 16:02:12
1
0
Stop ASP.Net from recycling app pool due to "changes to the bin"
Greetings, I have a large .Net web app which runs on a farm of blades with the code base on a NAS. Every once in a while slight fluctuations in the response time of the nas cause .NET to think that something in the bin has changed and kick off a recycle of the app pool. No change has actually occurred. Is there a way to disable .Net's monitoring of changes to the bin?
windows
asp.net
iis7
web-config
null
null
open
Stop ASP.Net from recycling app pool due to "changes to the bin" === Greetings, I have a large .Net web app which runs on a farm of blades with the code base on a NAS. Every once in a while slight fluctuations in the response time of the nas cause .NET to think that something in the bin has changed and kick off a recycle of the app pool. No change has actually occurred. Is there a way to disable .Net's monitoring of changes to the bin?
0
9,306,432
02/16/2012 06:13:31
269,099
02/08/2010 23:44:34
170
4
Get Port Number for Apache Tomcat
I am having fun creating my first NSIS installer: 1. Aborts if 32bit 2. Checks for a JRE - installs if not 3. Option to install Tomcat (embedded installer) 4. Option to deploy WARs (potentially this could be in the above Tomcat or another instance on the same box) (*[Here][1] is the entire script if need be.*) I am thinking of using `ReadRegStr` to try and present the user with a list of available Tomcat instances. However, what I was hoping to do... **Conundrum**: At the end of the NSIS script, I wanted to dump some shortcuts on the Desktop with links to the application that gets deployed under Tomcat. However, from registry entries alone, I cannot get at the port number. What is the best approach here? I imagine I need to dive into a config file under the Tomcat folder or is their a simpler way? ![enter image description here][2] [Slightly related Q][3] [1]: http://pastebin.com/BxiWCykU [2]: http://i.stack.imgur.com/9GrQg.png [3]: http://stackoverflow.com/questions/8708226/port-availabilty-check-on-remote-system
installer
nsis
null
null
null
null
open
Get Port Number for Apache Tomcat === I am having fun creating my first NSIS installer: 1. Aborts if 32bit 2. Checks for a JRE - installs if not 3. Option to install Tomcat (embedded installer) 4. Option to deploy WARs (potentially this could be in the above Tomcat or another instance on the same box) (*[Here][1] is the entire script if need be.*) I am thinking of using `ReadRegStr` to try and present the user with a list of available Tomcat instances. However, what I was hoping to do... **Conundrum**: At the end of the NSIS script, I wanted to dump some shortcuts on the Desktop with links to the application that gets deployed under Tomcat. However, from registry entries alone, I cannot get at the port number. What is the best approach here? I imagine I need to dive into a config file under the Tomcat folder or is their a simpler way? ![enter image description here][2] [Slightly related Q][3] [1]: http://pastebin.com/BxiWCykU [2]: http://i.stack.imgur.com/9GrQg.png [3]: http://stackoverflow.com/questions/8708226/port-availabilty-check-on-remote-system
0
10,819,973
05/30/2012 16:01:15
288,308
03/07/2010 18:24:52
31
1
Maven is trying to dow
Build fails with message: "Failed to execute goal org.grails:grails-maven-plugin:2.0.3:maven-clean (default) on project primeplace: Failed to create classpath for Grails execution. Encountered problems resolving dependencies of the executable in preparation for its execution. Failure to find com.sun.jersey:jersey-client:bundle:1.11 in http: //myrepro/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of places-nexus-public has elapsed or updates are forced" My pom.xml contains the following about Jersey: <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-apache-client4</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs.jersey-oauth</groupId> <artifactId>oauth-signature</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs.jersey-oauth</groupId> <artifactId>oauth-client</artifactId> <version>1.11</version> </dependency> Any suggestions on how to fix this?
grails
maven
build
jersey
null
null
open
Maven is trying to dow === Build fails with message: "Failed to execute goal org.grails:grails-maven-plugin:2.0.3:maven-clean (default) on project primeplace: Failed to create classpath for Grails execution. Encountered problems resolving dependencies of the executable in preparation for its execution. Failure to find com.sun.jersey:jersey-client:bundle:1.11 in http: //myrepro/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of places-nexus-public has elapsed or updates are forced" My pom.xml contains the following about Jersey: <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-apache-client4</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs.jersey-oauth</groupId> <artifactId>oauth-signature</artifactId> <version>1.11</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs.jersey-oauth</groupId> <artifactId>oauth-client</artifactId> <version>1.11</version> </dependency> Any suggestions on how to fix this?
0
7,088,873
08/17/2011 06:47:52
822,981
06/30/2011 11:51:55
8
0
How to start data warehousing practices?
At the beginning of a business intelligence career, I want to make applications about data warehousing and OLAP. I am researching the subject for months; I know what is a dimension, what is a fact, what is etl etc. But i have no practice. I've neither created an OLAP cube, nor built a warehouse. So, how should i start? I have Oracle database and Hyperion Essbase installed in my computer, but i have a thought that starting with MSSQL would be easier. What do you think? Cheers.
data-warehouse
business-intelligence
null
null
null
11/27/2011 23:55:18
off topic
How to start data warehousing practices? === At the beginning of a business intelligence career, I want to make applications about data warehousing and OLAP. I am researching the subject for months; I know what is a dimension, what is a fact, what is etl etc. But i have no practice. I've neither created an OLAP cube, nor built a warehouse. So, how should i start? I have Oracle database and Hyperion Essbase installed in my computer, but i have a thought that starting with MSSQL would be easier. What do you think? Cheers.
2
1,387,430
09/07/2009 03:24:27
70,353
02/24/2009 13:22:32
1,979
88
Recommended math library for C#/.NET?
I'm currently evaluating different math libraries for my next .NET project, the decent one I found is [Math.NET][1], which is free and open-source. Do you have any recommendation for good math libraries?, free ones are preferable of course, but that isn't a prerequisite. *(I've searched for similar questions but haven't founded any, if you find a duplicate one please post the link and I'll vote to close this one)* [1]: http://www.mathdotnet.com/
.net
math
c#
null
null
06/07/2012 12:35:22
not constructive
Recommended math library for C#/.NET? === I'm currently evaluating different math libraries for my next .NET project, the decent one I found is [Math.NET][1], which is free and open-source. Do you have any recommendation for good math libraries?, free ones are preferable of course, but that isn't a prerequisite. *(I've searched for similar questions but haven't founded any, if you find a duplicate one please post the link and I'll vote to close this one)* [1]: http://www.mathdotnet.com/
4
4,267,726
11/24/2010 14:13:39
409,571
08/03/2010 10:58:51
131
4
Delete Key event in Iphone
i created UITextField. i need only 4 numeric characters only allowed that textfield. I used the following code and get result. -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; NSNumber* candidateNumber; NSString* candidateString = [textField.text stringByReplacingCharactersInRange:range withString:string]; range = NSMakeRange(0, [candidateString length]); [numberFormatter getObjectValue:&candidateNumber forString:candidateString range:&range error:nil]; NSUInteger newLength = [passwordfield.text length]; if(newLength>=4) { [passwordfield setText:[passwordfield.text substringToIndex:3]]; UIAlertView *alert = [[UIAlertView alloc] init]; [alert setTitle:@"Alert"]; [alert setMessage:@"Four Characters only allowed.."]; [alert setDelegate:self]; [alert addButtonWithTitle:@"Ok"]; [alert show]; } if (([candidateString length] > 0) && (candidateNumber == nil || range.length < [candidateString length])) { return NO; } else { return YES; } } **But MY problem is when i press delete key, last two characters are deleting and same time alertview also display.** How to solve this issue. If anybody knows any idea, please help me and edit my code. Thanks.
iphone
null
null
null
null
null
open
Delete Key event in Iphone === i created UITextField. i need only 4 numeric characters only allowed that textfield. I used the following code and get result. -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; NSNumber* candidateNumber; NSString* candidateString = [textField.text stringByReplacingCharactersInRange:range withString:string]; range = NSMakeRange(0, [candidateString length]); [numberFormatter getObjectValue:&candidateNumber forString:candidateString range:&range error:nil]; NSUInteger newLength = [passwordfield.text length]; if(newLength>=4) { [passwordfield setText:[passwordfield.text substringToIndex:3]]; UIAlertView *alert = [[UIAlertView alloc] init]; [alert setTitle:@"Alert"]; [alert setMessage:@"Four Characters only allowed.."]; [alert setDelegate:self]; [alert addButtonWithTitle:@"Ok"]; [alert show]; } if (([candidateString length] > 0) && (candidateNumber == nil || range.length < [candidateString length])) { return NO; } else { return YES; } } **But MY problem is when i press delete key, last two characters are deleting and same time alertview also display.** How to solve this issue. If anybody knows any idea, please help me and edit my code. Thanks.
0
8,358,712
12/02/2011 15:36:13
142,018
07/21/2009 13:41:49
356
4
Firefox 8 still doesn't support multiline titles or alt-text ("tooltips")?
Despite this documentation: https://developer.mozilla.org/en/HTML/Global_attributes#attr-title and HTML5 having a spec for multiline http://dev.w3.org/html5/spec/elements.html#the-title-attribute I cannot reproduce that behavior in Firefox 8. Just wanted to make sure I am not missing something. All other modern browsers support multiline except Firefox? Seriously?
html5
firefox
multiline
tooltips
null
null
open
Firefox 8 still doesn't support multiline titles or alt-text ("tooltips")? === Despite this documentation: https://developer.mozilla.org/en/HTML/Global_attributes#attr-title and HTML5 having a spec for multiline http://dev.w3.org/html5/spec/elements.html#the-title-attribute I cannot reproduce that behavior in Firefox 8. Just wanted to make sure I am not missing something. All other modern browsers support multiline except Firefox? Seriously?
0
6,905,131
08/01/2011 22:12:18
873,513
08/01/2011 21:26:23
1
0
EXE file created by Py2Exe can not run
I used python2.7, lxml and pyqt4 to write a small application, and it worked well in python interpreter. And i decided too create the exe file by using py2exe. According to the turtorial of its website, I copied MSVC dlls from C:\Program Files (x86)\... to dist directory and set the path, it still showed the "ImportError: DLL load failed". I wondered that it was caused all the python and its tool are 64bit(My machine is win7 64bit). Thus, i removed all of them and installed x86 version of python, lxml, pyqt4 and py2exe. The exe file was created sucessfully. However. it didnot work(and no error) when i tried to execute it in windows or CMD window. And I noticed that the size of exe file is very small(only 20kb). In dist dictionary, the corresponding Qt dll files and lxml, pyqt4 pyd files exist. I can not find useful help from the google. Anyone can give me any hint? Thanks
py2exe
null
null
null
null
08/08/2011 05:06:41
too localized
EXE file created by Py2Exe can not run === I used python2.7, lxml and pyqt4 to write a small application, and it worked well in python interpreter. And i decided too create the exe file by using py2exe. According to the turtorial of its website, I copied MSVC dlls from C:\Program Files (x86)\... to dist directory and set the path, it still showed the "ImportError: DLL load failed". I wondered that it was caused all the python and its tool are 64bit(My machine is win7 64bit). Thus, i removed all of them and installed x86 version of python, lxml, pyqt4 and py2exe. The exe file was created sucessfully. However. it didnot work(and no error) when i tried to execute it in windows or CMD window. And I noticed that the size of exe file is very small(only 20kb). In dist dictionary, the corresponding Qt dll files and lxml, pyqt4 pyd files exist. I can not find useful help from the google. Anyone can give me any hint? Thanks
3
7,842,920
10/20/2011 22:15:37
143,725
07/23/2009 13:28:14
1,999
42
Determine if ActiveRecord Object as New Or Created
How can I introspect an ActiveRecord object to determine whether its new or created?
ruby-on-rails
activerecord
null
null
null
null
open
Determine if ActiveRecord Object as New Or Created === How can I introspect an ActiveRecord object to determine whether its new or created?
0
5,920,292
05/07/2011 09:45:55
84,201
03/29/2009 07:46:24
8,206
154
Is HTML5 beneficial to increase the speed and performance of website?
Can using HTML5 things increase the speed and performance of website? Or it will only increase the semanticists and add new technology and user experience.
html
web-development
html5
mobile-web
null
null
open
Is HTML5 beneficial to increase the speed and performance of website? === Can using HTML5 things increase the speed and performance of website? Or it will only increase the semanticists and add new technology and user experience.
0
6,021,088
05/16/2011 17:32:08
756,073
05/16/2011 17:32:08
1
0
augmented reality
i m assigned a project to develop an application based on Argument Reality(AR). They are about to give me an android phone in few days.. I donot know ABC of this technology. i donot understand how do i start with it....can anyone suggest what woud be the first thing and what will be required things for developing this type of application?.. i would be grateful by receiving your help.
augmented-reality
null
null
null
null
05/16/2011 19:15:47
not a real question
augmented reality === i m assigned a project to develop an application based on Argument Reality(AR). They are about to give me an android phone in few days.. I donot know ABC of this technology. i donot understand how do i start with it....can anyone suggest what woud be the first thing and what will be required things for developing this type of application?.. i would be grateful by receiving your help.
1
9,874,164
03/26/2012 14:35:46
396,919
07/20/2010 14:41:43
162
15
Object-oriented database management system fro .NET
I've read about [db4o][1] and how to work with .NET and I want to know more about object-oriented database management systems. Is there any Object database like db4o to work with .NET? And which one is better? [1]: http://www.db4o.com/
asp.net
.net
db4o
object-database
oodbms
03/26/2012 17:47:20
not constructive
Object-oriented database management system fro .NET === I've read about [db4o][1] and how to work with .NET and I want to know more about object-oriented database management systems. Is there any Object database like db4o to work with .NET? And which one is better? [1]: http://www.db4o.com/
4
10,471,233
05/06/2012 14:20:44
1,372,896
05/03/2012 15:17:58
1
0
LUA Team system Garrysmod
We have this piece of code so far: function FoundWinner() if TimerStatus != 3 then return end local Everyone = player.GetAll() local Alive = GetAliveCount() local alive_idents = {1,2,3,5,7,8,9} local alive_players = {} for _, i in pairs(alive_idents) do local players_in_group = team.GetPlayers(i) or nil if players_in_group != nil then for _, p in pairs(players_in_group) do table.insert(alive_players, p) end end end local buddies = false for i=1, #alive_players do for j=1, #alive_players do if alive_players[j]:SteamID() == alive_players[i]:SteamID() then continue end buddies = table.HasValue(alive_players[j].Buddies, alive_players[i]:SteamID()) or false end end if (Alive <= 4 and buddies) or Alive == 1 then TimerStatus = 4 RemoveAllWeapons() ResetHealth() LowerWater() RecieveBonus() GivePhysGuns() for _, v in pairs(Everyone) do -- v:AddCount( "props", 0 ) if v:Team() == TEAM_SPECTATOR then return end if !v:Alive() then v:AddLoss() else v:AddFrags(1) v:AddWin() end v:SaveCash() end FightTime = FIV end end and this function PP(pl, cmd, arg) if TimerStatus == 4 then pl:ChatPrint("Error: You cannot Add/Remove Buddies while fighting") return false else local PPbool = false for kee, vee in pairs( player.GetAll() ) do userid = vee:UserID() .. ".00" if userid == arg[1] then PPSteamID = vee:SteamID() PPName = vee:GetName() end end if PPSteamID != nil then for k, v in ipairs(pl.Buddies) do if v == PPSteamID then pl:RemovePP(k) PPbool = true pl:SavePP() pl:ChatPrint(PPName .. " has been removed from your Prop-Protections list.") umsg.Start( "fm_friend_delete", pl ) umsg.String(PPSteamID) umsg.End() end end if PPbool == false then pl:AddPP(PPSteamID) pl:SavePP() pl:ChatPrint(PPName .. " has been added to your Prop-Protections list.") umsg.Start( "fm_friend_add", pl ) umsg.String(PPSteamID) umsg.End() end end end PPbool = false end concommand.Add( "PP", PP ) The problem is when 3 people are on a team and 2 people are on another team, when one person with only 2 people die there is 4 people in total remaining, and the round will end splitting the money between all the 4 people even tho the 4th person isn't on there team. a 2v2 match seems to work fine however and so does 1v1v1 etc. If there is any other code I need to paste feel free to ask.
lua
null
null
null
null
05/28/2012 08:42:27
too localized
LUA Team system Garrysmod === We have this piece of code so far: function FoundWinner() if TimerStatus != 3 then return end local Everyone = player.GetAll() local Alive = GetAliveCount() local alive_idents = {1,2,3,5,7,8,9} local alive_players = {} for _, i in pairs(alive_idents) do local players_in_group = team.GetPlayers(i) or nil if players_in_group != nil then for _, p in pairs(players_in_group) do table.insert(alive_players, p) end end end local buddies = false for i=1, #alive_players do for j=1, #alive_players do if alive_players[j]:SteamID() == alive_players[i]:SteamID() then continue end buddies = table.HasValue(alive_players[j].Buddies, alive_players[i]:SteamID()) or false end end if (Alive <= 4 and buddies) or Alive == 1 then TimerStatus = 4 RemoveAllWeapons() ResetHealth() LowerWater() RecieveBonus() GivePhysGuns() for _, v in pairs(Everyone) do -- v:AddCount( "props", 0 ) if v:Team() == TEAM_SPECTATOR then return end if !v:Alive() then v:AddLoss() else v:AddFrags(1) v:AddWin() end v:SaveCash() end FightTime = FIV end end and this function PP(pl, cmd, arg) if TimerStatus == 4 then pl:ChatPrint("Error: You cannot Add/Remove Buddies while fighting") return false else local PPbool = false for kee, vee in pairs( player.GetAll() ) do userid = vee:UserID() .. ".00" if userid == arg[1] then PPSteamID = vee:SteamID() PPName = vee:GetName() end end if PPSteamID != nil then for k, v in ipairs(pl.Buddies) do if v == PPSteamID then pl:RemovePP(k) PPbool = true pl:SavePP() pl:ChatPrint(PPName .. " has been removed from your Prop-Protections list.") umsg.Start( "fm_friend_delete", pl ) umsg.String(PPSteamID) umsg.End() end end if PPbool == false then pl:AddPP(PPSteamID) pl:SavePP() pl:ChatPrint(PPName .. " has been added to your Prop-Protections list.") umsg.Start( "fm_friend_add", pl ) umsg.String(PPSteamID) umsg.End() end end end PPbool = false end concommand.Add( "PP", PP ) The problem is when 3 people are on a team and 2 people are on another team, when one person with only 2 people die there is 4 people in total remaining, and the round will end splitting the money between all the 4 people even tho the 4th person isn't on there team. a 2v2 match seems to work fine however and so does 1v1v1 etc. If there is any other code I need to paste feel free to ask.
3
11,483,811
07/14/2012 12:39:11
300,675
03/24/2010 09:44:35
351
0
how to install jre on gentoo?
I am trying to install jre on gentoo I use: emerge virtual/jre My problem is that this does not work Resolving ftp.gentoo.mesh-solutions.com... 213.203.218.123 Connecting to ftp.gentoo.mesh-solutions.com|213.203.218.123|:21... failed: Connection timed out. Retrying. --14:37:13-- ftp://ftp.gentoo.mesh-solutions.com/gentoo/distfiles/portage-utils-0.1.29.tar.bz2 (try: 2) => `/usr/portage/distfiles/portage-utils-0.1.29.tar.bz2' Connecting to ftp.gentoo.mesh-solutions.com|213.203.218.123|:21... Infact the server tries to get some packets from ftp.gentoo.mesh-solutions, but this site seems to be down. Any other alternative for gentoo ? regardfs
linux
jre
gentoo
null
null
07/15/2012 09:06:19
off topic
how to install jre on gentoo? === I am trying to install jre on gentoo I use: emerge virtual/jre My problem is that this does not work Resolving ftp.gentoo.mesh-solutions.com... 213.203.218.123 Connecting to ftp.gentoo.mesh-solutions.com|213.203.218.123|:21... failed: Connection timed out. Retrying. --14:37:13-- ftp://ftp.gentoo.mesh-solutions.com/gentoo/distfiles/portage-utils-0.1.29.tar.bz2 (try: 2) => `/usr/portage/distfiles/portage-utils-0.1.29.tar.bz2' Connecting to ftp.gentoo.mesh-solutions.com|213.203.218.123|:21... Infact the server tries to get some packets from ftp.gentoo.mesh-solutions, but this site seems to be down. Any other alternative for gentoo ? regardfs
2
7,290,379
09/03/2011 00:28:59
766,876
05/23/2011 23:40:08
10
0
RoR: Has_many and belongs_to are not auto generating columns in SQLite tables
I've set up two models, let's call them User and Post. In *user.rb*, I have class User < ActiveRecord::Base has_many ... has_many :posts In *post.rb*, I have class Post < ActiveRecord::Base belongs_to :user At some point or another, I create a post like this @post = @user.posts.build(some_params) if @post.save ... --- However, whenever I try to retrieve the posts from a user... @users_posts = @user.posts ...and then access the array of posts... <%= @users_posts[0] %> I get the following error. > SQLite3::SQLException: no such column: posts.user_id: SELECT "posts".* FROM "posts" WHERE ("posts".user_id = 1) --- I have reset my server and used migrated my database (not that should matter). I haven't done anything too complicated yet, so what could I be missing that would be causing this error?
ruby-on-rails
ruby
ruby-on-rails-3
sqlite
null
09/03/2011 02:46:13
too localized
RoR: Has_many and belongs_to are not auto generating columns in SQLite tables === I've set up two models, let's call them User and Post. In *user.rb*, I have class User < ActiveRecord::Base has_many ... has_many :posts In *post.rb*, I have class Post < ActiveRecord::Base belongs_to :user At some point or another, I create a post like this @post = @user.posts.build(some_params) if @post.save ... --- However, whenever I try to retrieve the posts from a user... @users_posts = @user.posts ...and then access the array of posts... <%= @users_posts[0] %> I get the following error. > SQLite3::SQLException: no such column: posts.user_id: SELECT "posts".* FROM "posts" WHERE ("posts".user_id = 1) --- I have reset my server and used migrated my database (not that should matter). I haven't done anything too complicated yet, so what could I be missing that would be causing this error?
3
1,282,830
08/15/2009 21:01:07
2,075
08/20/2008 07:09:28
138
10
UIImagePickerController, UIImage, Memory and More!
I've noticed that there are many questions about how to handle `UIImage` objects, especially in conjunction with `UIImagePickerController` and then displaying it in a view (usually a `UIImageView`). Here is a collection of common questions and their answers. Feel free to edit and add your own. *I obviously learnt all this information from somewhere too. Various forum posts, StackOverflow answers and my own experimenting brought me to all these solutions. Credit goes to those who posted some sample code that I've since used and modified. I don't remember who you all are - but hats off to you!* ## How Do I Select An Image From the User's Images or From the Camera? ## You use `UIImagePickerController`. The documentation for the class gives a decent overview of how one would use it, and can be found [here][1]. Basically, you create an instance of the class, which is a modal view controller, display it, and set yourself (or some class) to be the delegate. Then you'll get notified when a user selects some form of media (movie or image in 3.0 on the 3GS), and you can do whatever you want. ## My Delegate Was Called - How Do I Get The Media? ## The delegate function signature is the following: -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; You should put a breakpoint in the debugger to see what's in the dictionary, but you use that to extract the media. For example: UIImage* image = [info valueForKey:@"UIImagePickerControllerOriginalImage"]; There are other keys that work as well. You can figure them out by looking in the debugger. ## OK, I Got The Image, But It Doesn't Have Any Geolocation Data. What gives? ## Unfortunately, Apple decided that we're not worthy of this information. When they load the data into the `UIImage`, they strip it of all the EXIF/Geolocation data. ## Can I Get To The Original File Representing This Image on the Disk? ## Nope. For security purposes, you only get the `UIImage`. ## How Do I Modify The Pixels of the `UIImage`? ## The `UIImage` is immutable, meaning you can't change it. However, you can get a copy of the pixels in order to modify them. One method is the following: UIImage* image = ...; // An image NSData* pixelData = (NSData*) CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage)); void* pixelBytes = [pixelData bytes]; // Take away the red pixel, assuming 32-bit RGBA for(int i = 0; i < [pixelData length]; i += 4) { bytes[i] = 0; // red bytes[i+1] = bytes[i+1]; // green bytes[i+2] = bytes[i+2]; // blue bytes[i+3] = bytes[i+3]; // alpha } And if you wanted to create a new image using these pixels, you can do: NSData* newPixelData = [NSData dataWithBytes:pixelBytes length:[pixelData length]]; UIImage* newImage = [UIImage imageWithData:newPixelData]; // Huzzah There are other ways, and Apple wrote a very nice article that goes over the various methods. You can find it [here][2]. ## After I Select 3 Images From The Camera, I Run Out Of Memory. Help! ## You have to remember that even though on disk these images take up only a few hundred kilobytes at most, that's because they're compressed as a PNG or JPG. When they are loaded into the `UIImage`, they become uncompressed. A quick over-the-envelope calculation would be: width x height x 4 = bytes in memory That's assuming 32-bit pixels. If you have 16-bit pixels (some JPGs are stored as RGBA-5551), then you'd replace the `4` with a `2`. Now, images taken with the camera are `1600 x 1200` pixels, so let's do the math: 1600 x 1200 x 4 = 7,680,000 bytes = ~8 MB 8 MB is a lot, especially when you have a limit of around 24 MB for your application. That's why you run out of memory. ## OK, I Understand Why I Have No Memory. What Do I Do? ## There is never any reason to **display** images at their full resolution. The iPhone has a screen of `480 x 320` pixels, so you're just wasting space. If you find yourself in this situation, ask yourself the following question: Do I need the full resolution image? If the answer is yes, then you should save it to disk for later use. If the answer is no, then read the next part. Once you've decided what to do with the full-resolution image, then you need to create a smaller image to use for displaying. Many times you might even want several sizes for your image: a thumbnail, a full-size one for displaying, and the original full-resolution image. ## OK, I'm Hooked. How Do I Resize the Image? ## Unfortunately, there is no defined way how to resize an image. Also, it's important to note that when you resize it, you'll get a new image - you're not modifying the old one. There are a couple of methods to do the resizing. I'll present them both here, and explain the pros and cons of each. **Method 1: Using UIKit Functions** + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; { // Create a graphics image context UIGraphicsBeginImageContext(newSize); // Tell the old image to draw in this new context, with the desired // new size [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; // Get the new image from the context UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); // End the context UIGraphicsEndImageContext(); // Return the new image. return newImage; } This method is very simple, and works great. It will also deal with the UIImageOrientation for you, meaning that you don't have to care whether the camera was sideways when the picture was taken. **However**, this method is not thread safe, and since thumbnailing is a relatively expensive operation (approximately ~2.5s on a 3G for a `1600 x 1200` pixel image), this is very much an operation you may want to do in the background, on a separate thread. **Method 1: Using CoreGraphics Functions** + (UIImage*)imageWithImage:(UIImage*)sourceImage scaledToSize:(CGSize)newSize; { CGFloat targetWidth = targetSize.width; CGFloat targetHeight = targetSize.height; CGImageRef imageRef = [sourceImage CGImage]; CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); CGColorSpaceRef colorSpaceInfo = CGImageGetColorSpace(imageRef); if (bitmapInfo == kCGImageAlphaNone) { bitmapInfo = kCGImageAlphaNoneSkipLast; } CGContextRef bitmap; if (sourceImage.imageOrientation == UIImageOrientationUp || sourceImage.imageOrientation == UIImageOrientationDown) { bitmap = CGBitmapContextCreate(NULL, targetWidth, targetHeight, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } else { bitmap = CGBitmapContextCreate(NULL, targetHeight, targetWidth, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } if (sourceImage.imageOrientation == UIImageOrientationLeft) { CGContextRotateCTM (bitmap, radians(90)); CGContextTranslateCTM (bitmap, 0, -targetHeight); } else if (sourceImage.imageOrientation == UIImageOrientationRight) { CGContextRotateCTM (bitmap, radians(-90)); CGContextTranslateCTM (bitmap, -targetWidth, 0); } else if (sourceImage.imageOrientation == UIImageOrientationUp) { // NOTHING } else if (sourceImage.imageOrientation == UIImageOrientationDown) { CGContextTranslateCTM (bitmap, targetWidth, targetHeight); CGContextRotateCTM (bitmap, radians(-180.)); } CGContextDrawImage(bitmap, CGRectMake(0, 0, targetWidth, targetHeight), imageRef); CGImageRef ref = CGBitmapContextCreateImage(bitmap); UIImage* newImage = [UIImage imageWithCGImage:ref]; CGContextRelease(bitmap); CGImageRelease(ref); return newImage; } The benefit of this method is that it is thread-safe, plus it takes care of all the small things (using correct color space and bitmap info, dealing with image orientation) that the UIKit version does. ## How Do I Resize and Maintain Aspect Ratio (like the AspectFill option)? ## It is very similar to the method above, and it looks like this: + (UIImage*)imageWithImage:(UIImage*)sourceImage scaledToSizeWithSameAspectRatio:(CGSize)newSize; { CGSize imageSize = sourceImage.size; CGFloat width = imageSize.width; CGFloat height = imageSize.height; CGFloat targetWidth = targetSize.width; CGFloat targetHeight = targetSize.height; CGFloat scaleFactor = 0.0; CGFloat scaledWidth = targetWidth; CGFloat scaledHeight = targetHeight; CGPoint thumbnailPoint = CGPointMake(0.0,0.0); if (CGSizeEqualToSize(imageSize, targetSize) == NO) { CGFloat widthFactor = targetWidth / width; CGFloat heightFactor = targetHeight / height; if (widthFactor > heightFactor) { scaleFactor = widthFactor; // scale to fit height } else { scaleFactor = heightFactor; // scale to fit width } scaledWidth = width * scaleFactor; scaledHeight = height * scaleFactor; // center the image if (widthFactor > heightFactor) { thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5; } else if (widthFactor < heightFactor) { thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5; } } CGImageRef imageRef = [sourceImage CGImage]; CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); CGColorSpaceRef colorSpaceInfo = CGImageGetColorSpace(imageRef); if (bitmapInfo == kCGImageAlphaNone) { bitmapInfo = kCGImageAlphaNoneSkipLast; } CGContextRef bitmap; if (sourceImage.imageOrientation == UIImageOrientationUp || sourceImage.imageOrientation == UIImageOrientationDown) { bitmap = CGBitmapContextCreate(NULL, targetWidth, targetHeight, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } else { bitmap = CGBitmapContextCreate(NULL, targetHeight, targetWidth, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } // In the right or left cases, we need to switch scaledWidth and scaledHeight, // and also the thumbnail point if (sourceImage.imageOrientation == UIImageOrientationLeft) { thumbnailPoint = CGPointMake(thumbnailPoint.y, thumbnailPoint.x); CGFloat oldScaledWidth = scaledWidth; scaledWidth = scaledHeight; scaledHeight = oldScaledWidth; CGContextRotateCTM (bitmap, radians(90)); CGContextTranslateCTM (bitmap, 0, -targetHeight); } else if (sourceImage.imageOrientation == UIImageOrientationRight) { thumbnailPoint = CGPointMake(thumbnailPoint.y, thumbnailPoint.x); CGFloat oldScaledWidth = scaledWidth; scaledWidth = scaledHeight; scaledHeight = oldScaledWidth; CGContextRotateCTM (bitmap, radians(-90)); CGContextTranslateCTM (bitmap, -targetWidth, 0); } else if (sourceImage.imageOrientation == UIImageOrientationUp) { // NOTHING } else if (sourceImage.imageOrientation == UIImageOrientationDown) { CGContextTranslateCTM (bitmap, targetWidth, targetHeight); CGContextRotateCTM (bitmap, radians(-180.)); } CGContextDrawImage(bitmap, CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledWidth, scaledHeight), imageRef); CGImageRef ref = CGBitmapContextCreateImage(bitmap); UIImage* newImage = [UIImage imageWithCGImage:ref]; CGContextRelease(bitmap); CGImageRelease(ref); return newImage; } The method we employ here is to create a bitmap with the desired size, but draw an image that is actually larger, thus maintaining the aspect ratio. ## So We've Got Our Scaled Images - How Do I Save Them To Disk? ## This is pretty simple. Remember that we want to save a compressed version to disk, and not the uncompressed pixels. Apple provides two functions that help us with this (documentation is [here][3]): NSData* UIImagePNGRepresentation(UIImage *image); NSData* UIImageJPEGRepresentation (UIImage *image, CGFloat compressionQuality); And if you want to use them, you'd do something like: UIImage* myThumbnail = ...; // Get some image NSData* imageData = UIImagePNGRepresentation(myThumbnail); Now we're ready to save it to disk, which is the final step (say into the documents directory): // Give a name to the file NSString* imageName = "MyImage.png"; // Now, we have to find the documents directory so we can save it // Note that you might want to save it elsewhere, like the cache directory, // or something similar. NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* documentsDirectory = [paths objectAtIndex:0]; // Now we get the full path to the file NSString* fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName]; // and then we write it out [imageData writeToFile:fullPathToFile atomically:NO]; You would repeat this for every version of the image you have. ## How Do I Load These Images Back Into Memory? ## Just look at the various `UIImage` static initialization functions, such as `imageWithContentsOfFile:` in the Apple [documentation][3]. [1]: http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html [2]: http://developer.apple.com/qa/qa2007/qa1509.html [3]: http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIImage_Class/Reference/Reference.html
iphone
uikit
coregraphics
uiimage
uiimagepickercontroller
03/19/2011 16:34:55
not a real question
UIImagePickerController, UIImage, Memory and More! === I've noticed that there are many questions about how to handle `UIImage` objects, especially in conjunction with `UIImagePickerController` and then displaying it in a view (usually a `UIImageView`). Here is a collection of common questions and their answers. Feel free to edit and add your own. *I obviously learnt all this information from somewhere too. Various forum posts, StackOverflow answers and my own experimenting brought me to all these solutions. Credit goes to those who posted some sample code that I've since used and modified. I don't remember who you all are - but hats off to you!* ## How Do I Select An Image From the User's Images or From the Camera? ## You use `UIImagePickerController`. The documentation for the class gives a decent overview of how one would use it, and can be found [here][1]. Basically, you create an instance of the class, which is a modal view controller, display it, and set yourself (or some class) to be the delegate. Then you'll get notified when a user selects some form of media (movie or image in 3.0 on the 3GS), and you can do whatever you want. ## My Delegate Was Called - How Do I Get The Media? ## The delegate function signature is the following: -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; You should put a breakpoint in the debugger to see what's in the dictionary, but you use that to extract the media. For example: UIImage* image = [info valueForKey:@"UIImagePickerControllerOriginalImage"]; There are other keys that work as well. You can figure them out by looking in the debugger. ## OK, I Got The Image, But It Doesn't Have Any Geolocation Data. What gives? ## Unfortunately, Apple decided that we're not worthy of this information. When they load the data into the `UIImage`, they strip it of all the EXIF/Geolocation data. ## Can I Get To The Original File Representing This Image on the Disk? ## Nope. For security purposes, you only get the `UIImage`. ## How Do I Modify The Pixels of the `UIImage`? ## The `UIImage` is immutable, meaning you can't change it. However, you can get a copy of the pixels in order to modify them. One method is the following: UIImage* image = ...; // An image NSData* pixelData = (NSData*) CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage)); void* pixelBytes = [pixelData bytes]; // Take away the red pixel, assuming 32-bit RGBA for(int i = 0; i < [pixelData length]; i += 4) { bytes[i] = 0; // red bytes[i+1] = bytes[i+1]; // green bytes[i+2] = bytes[i+2]; // blue bytes[i+3] = bytes[i+3]; // alpha } And if you wanted to create a new image using these pixels, you can do: NSData* newPixelData = [NSData dataWithBytes:pixelBytes length:[pixelData length]]; UIImage* newImage = [UIImage imageWithData:newPixelData]; // Huzzah There are other ways, and Apple wrote a very nice article that goes over the various methods. You can find it [here][2]. ## After I Select 3 Images From The Camera, I Run Out Of Memory. Help! ## You have to remember that even though on disk these images take up only a few hundred kilobytes at most, that's because they're compressed as a PNG or JPG. When they are loaded into the `UIImage`, they become uncompressed. A quick over-the-envelope calculation would be: width x height x 4 = bytes in memory That's assuming 32-bit pixels. If you have 16-bit pixels (some JPGs are stored as RGBA-5551), then you'd replace the `4` with a `2`. Now, images taken with the camera are `1600 x 1200` pixels, so let's do the math: 1600 x 1200 x 4 = 7,680,000 bytes = ~8 MB 8 MB is a lot, especially when you have a limit of around 24 MB for your application. That's why you run out of memory. ## OK, I Understand Why I Have No Memory. What Do I Do? ## There is never any reason to **display** images at their full resolution. The iPhone has a screen of `480 x 320` pixels, so you're just wasting space. If you find yourself in this situation, ask yourself the following question: Do I need the full resolution image? If the answer is yes, then you should save it to disk for later use. If the answer is no, then read the next part. Once you've decided what to do with the full-resolution image, then you need to create a smaller image to use for displaying. Many times you might even want several sizes for your image: a thumbnail, a full-size one for displaying, and the original full-resolution image. ## OK, I'm Hooked. How Do I Resize the Image? ## Unfortunately, there is no defined way how to resize an image. Also, it's important to note that when you resize it, you'll get a new image - you're not modifying the old one. There are a couple of methods to do the resizing. I'll present them both here, and explain the pros and cons of each. **Method 1: Using UIKit Functions** + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; { // Create a graphics image context UIGraphicsBeginImageContext(newSize); // Tell the old image to draw in this new context, with the desired // new size [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; // Get the new image from the context UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); // End the context UIGraphicsEndImageContext(); // Return the new image. return newImage; } This method is very simple, and works great. It will also deal with the UIImageOrientation for you, meaning that you don't have to care whether the camera was sideways when the picture was taken. **However**, this method is not thread safe, and since thumbnailing is a relatively expensive operation (approximately ~2.5s on a 3G for a `1600 x 1200` pixel image), this is very much an operation you may want to do in the background, on a separate thread. **Method 1: Using CoreGraphics Functions** + (UIImage*)imageWithImage:(UIImage*)sourceImage scaledToSize:(CGSize)newSize; { CGFloat targetWidth = targetSize.width; CGFloat targetHeight = targetSize.height; CGImageRef imageRef = [sourceImage CGImage]; CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); CGColorSpaceRef colorSpaceInfo = CGImageGetColorSpace(imageRef); if (bitmapInfo == kCGImageAlphaNone) { bitmapInfo = kCGImageAlphaNoneSkipLast; } CGContextRef bitmap; if (sourceImage.imageOrientation == UIImageOrientationUp || sourceImage.imageOrientation == UIImageOrientationDown) { bitmap = CGBitmapContextCreate(NULL, targetWidth, targetHeight, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } else { bitmap = CGBitmapContextCreate(NULL, targetHeight, targetWidth, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } if (sourceImage.imageOrientation == UIImageOrientationLeft) { CGContextRotateCTM (bitmap, radians(90)); CGContextTranslateCTM (bitmap, 0, -targetHeight); } else if (sourceImage.imageOrientation == UIImageOrientationRight) { CGContextRotateCTM (bitmap, radians(-90)); CGContextTranslateCTM (bitmap, -targetWidth, 0); } else if (sourceImage.imageOrientation == UIImageOrientationUp) { // NOTHING } else if (sourceImage.imageOrientation == UIImageOrientationDown) { CGContextTranslateCTM (bitmap, targetWidth, targetHeight); CGContextRotateCTM (bitmap, radians(-180.)); } CGContextDrawImage(bitmap, CGRectMake(0, 0, targetWidth, targetHeight), imageRef); CGImageRef ref = CGBitmapContextCreateImage(bitmap); UIImage* newImage = [UIImage imageWithCGImage:ref]; CGContextRelease(bitmap); CGImageRelease(ref); return newImage; } The benefit of this method is that it is thread-safe, plus it takes care of all the small things (using correct color space and bitmap info, dealing with image orientation) that the UIKit version does. ## How Do I Resize and Maintain Aspect Ratio (like the AspectFill option)? ## It is very similar to the method above, and it looks like this: + (UIImage*)imageWithImage:(UIImage*)sourceImage scaledToSizeWithSameAspectRatio:(CGSize)newSize; { CGSize imageSize = sourceImage.size; CGFloat width = imageSize.width; CGFloat height = imageSize.height; CGFloat targetWidth = targetSize.width; CGFloat targetHeight = targetSize.height; CGFloat scaleFactor = 0.0; CGFloat scaledWidth = targetWidth; CGFloat scaledHeight = targetHeight; CGPoint thumbnailPoint = CGPointMake(0.0,0.0); if (CGSizeEqualToSize(imageSize, targetSize) == NO) { CGFloat widthFactor = targetWidth / width; CGFloat heightFactor = targetHeight / height; if (widthFactor > heightFactor) { scaleFactor = widthFactor; // scale to fit height } else { scaleFactor = heightFactor; // scale to fit width } scaledWidth = width * scaleFactor; scaledHeight = height * scaleFactor; // center the image if (widthFactor > heightFactor) { thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5; } else if (widthFactor < heightFactor) { thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5; } } CGImageRef imageRef = [sourceImage CGImage]; CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); CGColorSpaceRef colorSpaceInfo = CGImageGetColorSpace(imageRef); if (bitmapInfo == kCGImageAlphaNone) { bitmapInfo = kCGImageAlphaNoneSkipLast; } CGContextRef bitmap; if (sourceImage.imageOrientation == UIImageOrientationUp || sourceImage.imageOrientation == UIImageOrientationDown) { bitmap = CGBitmapContextCreate(NULL, targetWidth, targetHeight, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } else { bitmap = CGBitmapContextCreate(NULL, targetHeight, targetWidth, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo); } // In the right or left cases, we need to switch scaledWidth and scaledHeight, // and also the thumbnail point if (sourceImage.imageOrientation == UIImageOrientationLeft) { thumbnailPoint = CGPointMake(thumbnailPoint.y, thumbnailPoint.x); CGFloat oldScaledWidth = scaledWidth; scaledWidth = scaledHeight; scaledHeight = oldScaledWidth; CGContextRotateCTM (bitmap, radians(90)); CGContextTranslateCTM (bitmap, 0, -targetHeight); } else if (sourceImage.imageOrientation == UIImageOrientationRight) { thumbnailPoint = CGPointMake(thumbnailPoint.y, thumbnailPoint.x); CGFloat oldScaledWidth = scaledWidth; scaledWidth = scaledHeight; scaledHeight = oldScaledWidth; CGContextRotateCTM (bitmap, radians(-90)); CGContextTranslateCTM (bitmap, -targetWidth, 0); } else if (sourceImage.imageOrientation == UIImageOrientationUp) { // NOTHING } else if (sourceImage.imageOrientation == UIImageOrientationDown) { CGContextTranslateCTM (bitmap, targetWidth, targetHeight); CGContextRotateCTM (bitmap, radians(-180.)); } CGContextDrawImage(bitmap, CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledWidth, scaledHeight), imageRef); CGImageRef ref = CGBitmapContextCreateImage(bitmap); UIImage* newImage = [UIImage imageWithCGImage:ref]; CGContextRelease(bitmap); CGImageRelease(ref); return newImage; } The method we employ here is to create a bitmap with the desired size, but draw an image that is actually larger, thus maintaining the aspect ratio. ## So We've Got Our Scaled Images - How Do I Save Them To Disk? ## This is pretty simple. Remember that we want to save a compressed version to disk, and not the uncompressed pixels. Apple provides two functions that help us with this (documentation is [here][3]): NSData* UIImagePNGRepresentation(UIImage *image); NSData* UIImageJPEGRepresentation (UIImage *image, CGFloat compressionQuality); And if you want to use them, you'd do something like: UIImage* myThumbnail = ...; // Get some image NSData* imageData = UIImagePNGRepresentation(myThumbnail); Now we're ready to save it to disk, which is the final step (say into the documents directory): // Give a name to the file NSString* imageName = "MyImage.png"; // Now, we have to find the documents directory so we can save it // Note that you might want to save it elsewhere, like the cache directory, // or something similar. NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* documentsDirectory = [paths objectAtIndex:0]; // Now we get the full path to the file NSString* fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName]; // and then we write it out [imageData writeToFile:fullPathToFile atomically:NO]; You would repeat this for every version of the image you have. ## How Do I Load These Images Back Into Memory? ## Just look at the various `UIImage` static initialization functions, such as `imageWithContentsOfFile:` in the Apple [documentation][3]. [1]: http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html [2]: http://developer.apple.com/qa/qa2007/qa1509.html [3]: http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIImage_Class/Reference/Reference.html
1
3,313,366
07/22/2010 20:53:45
399,606
07/22/2010 20:41:18
1
0
Hadoop and Eclipse
i'm trying to implement PageRank algorithm on Hadoop platform with Eclipse, but I'm facing some unusual problems :). I tried locally: installed cygwin, set up Hadoop 0.19.2 (and 0.18.0), started the necessary daemons and installed Eclipse 3.3.1. I uploaded testinf .txt file and then tried to run the WordCount example or even a simple .java and I got this output (for about 100 times :)) ): 10/07/22 22:10:23 INFO mapred.FileInputFormat: Total input paths to process : 1 10/07/22 22:10:23 INFO mapred.JobClient: Running job: job_201007220415_0017 10/07/22 22:10:24 INFO mapred.JobClient: map 0% reduce 0% Map and reduce are 0% all the time. I tried with Hadoop on virtual machine and I got the same situation. I followed all the instructions from Hadoop page and other useful pages, but I didn't resolve my problem. Any suggestions? :)
eclipse
hadoop
mapreduce
null
null
null
open
Hadoop and Eclipse === i'm trying to implement PageRank algorithm on Hadoop platform with Eclipse, but I'm facing some unusual problems :). I tried locally: installed cygwin, set up Hadoop 0.19.2 (and 0.18.0), started the necessary daemons and installed Eclipse 3.3.1. I uploaded testinf .txt file and then tried to run the WordCount example or even a simple .java and I got this output (for about 100 times :)) ): 10/07/22 22:10:23 INFO mapred.FileInputFormat: Total input paths to process : 1 10/07/22 22:10:23 INFO mapred.JobClient: Running job: job_201007220415_0017 10/07/22 22:10:24 INFO mapred.JobClient: map 0% reduce 0% Map and reduce are 0% all the time. I tried with Hadoop on virtual machine and I got the same situation. I followed all the instructions from Hadoop page and other useful pages, but I didn't resolve my problem. Any suggestions? :)
0
6,881,396
07/30/2011 05:57:02
212,317
11/16/2009 19:09:10
68
1
php-How can i put this IF condition inside switch?
Please help me for correcting this code,i want put if inside switch: switch ($urlcomecatid) { if ($urlcomeparentid == 1 || $urlcomeparentid == 2 || $urlcomeparentid == 3) break; case "50": case "51": case "52": case "109": case "110": //do nothing and exit from switch break; default: header ("Location:http://www.example.com/tech/tech.php"); exit(); break; }
switch-statement
null
null
null
null
07/31/2011 08:15:18
too localized
php-How can i put this IF condition inside switch? === Please help me for correcting this code,i want put if inside switch: switch ($urlcomecatid) { if ($urlcomeparentid == 1 || $urlcomeparentid == 2 || $urlcomeparentid == 3) break; case "50": case "51": case "52": case "109": case "110": //do nothing and exit from switch break; default: header ("Location:http://www.example.com/tech/tech.php"); exit(); break; }
3
8,561,905
12/19/2011 13:16:48
923,095
09/01/2011 08:32:45
157
24
Insert Word shape at cursor position
Im looking for a way to insert an MS Word Shape at cursor position. At the moment I have the following code which inserts a shape at a predetermined location: Microsoft.Office.Interop.Word.Range CurrRange = Globals.ThisAddIn.Application.Selection.Range; //Get the id of the MS Word shape to be inserted int shapeId = (int)MsoAutoShapeType.msoShapeRoundedRectangle; //Get the value of the name attribute from the selected tree view item string nodeText = treeViewItem.GetAttribute("name"); //Add a new shape to the MS Word designer and set shape properties var shape = CurrRange.Document.Shapes.AddShape(shapeId, 170, 200, 100, 20); shape.AlternativeText = String.Format("Alt {0}", nodeText); shape.TextFrame.ContainingRange.Text = nodeText; shape.TextFrame.ContainingRange.Font.Size = 8; The location where the shape gets inserted is hardcoded: This can be seen from the 2nd and 3rd parameters of the `AddShape()` method: 170 = position measured in points to the left edge of the autoshape 200 = position measured in points to the top edge of the autoshape I've had a look at the properties and methods of my Range object but cannot seem to find any which store the position values which I require.
c#
ms-word
office-interop
null
null
null
open
Insert Word shape at cursor position === Im looking for a way to insert an MS Word Shape at cursor position. At the moment I have the following code which inserts a shape at a predetermined location: Microsoft.Office.Interop.Word.Range CurrRange = Globals.ThisAddIn.Application.Selection.Range; //Get the id of the MS Word shape to be inserted int shapeId = (int)MsoAutoShapeType.msoShapeRoundedRectangle; //Get the value of the name attribute from the selected tree view item string nodeText = treeViewItem.GetAttribute("name"); //Add a new shape to the MS Word designer and set shape properties var shape = CurrRange.Document.Shapes.AddShape(shapeId, 170, 200, 100, 20); shape.AlternativeText = String.Format("Alt {0}", nodeText); shape.TextFrame.ContainingRange.Text = nodeText; shape.TextFrame.ContainingRange.Font.Size = 8; The location where the shape gets inserted is hardcoded: This can be seen from the 2nd and 3rd parameters of the `AddShape()` method: 170 = position measured in points to the left edge of the autoshape 200 = position measured in points to the top edge of the autoshape I've had a look at the properties and methods of my Range object but cannot seem to find any which store the position values which I require.
0
4,907,117
02/05/2011 13:34:05
257,903
01/24/2010 17:34:56
1,033
63
Platform independent way to locate fonts
I'm working on a multi-platform application in C where I need to load fonts from disk and render messages with FreeType. However, I currently use full paths for locating fonts, and it's somewhat awkward to ask users for the full path of fonts since they are generally buried deep into system folders. Is there a simple, platform-idependent way of just locating fonts? E.g. I can expect users to be able to provide something like "Sans" and have a library or something locate the full path of this font for me. I'm aware of the existence of fontconfig, but I found it quite hard to go through the documentation for it. Clarification: This is a CLI driven application, which is configured through a config file.
c
fonts
cross-platform
null
null
null
open
Platform independent way to locate fonts === I'm working on a multi-platform application in C where I need to load fonts from disk and render messages with FreeType. However, I currently use full paths for locating fonts, and it's somewhat awkward to ask users for the full path of fonts since they are generally buried deep into system folders. Is there a simple, platform-idependent way of just locating fonts? E.g. I can expect users to be able to provide something like "Sans" and have a library or something locate the full path of this font for me. I'm aware of the existence of fontconfig, but I found it quite hard to go through the documentation for it. Clarification: This is a CLI driven application, which is configured through a config file.
0
8,260,064
11/24/2011 16:28:21
704,004
04/12/2011 11:52:52
33
1
Hibernate only loads one object from a list
This is what I do: @Repository @Transactional(propagation = Propagation.SUPPORTS) public class ProfileDAOHibernateImpl implements ProfileDAO { @Autowired private SessionFactory sessionFactory; private Session currentSession() { return sessionFactory.getCurrentSession(); } @Override public Profile getProfile(String name) { return (Profile) currentSession().createCriteria(Profile.class) .add(Restrictions.eq("name", name)).uniqueResult(); } ... } Profile entity: @Entity @Table(name = "profiles") public class Profile { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int Id; @Column(name = "name", unique = true) private String name; @ManyToOne(optional = false, fetch = FetchType.EAGER) @JoinColumn(name="partner_id", nullable = false) private Partner partner; ... } Partner entity @Entity @Table(name = "partners") public class Partner { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @OneToMany(fetch = FetchType.LAZY, cascade={CascadeType.ALL}, mappedBy = "partner") @OrderBy(value = "dateCreated desc") private Set<Profile> profiles = new HashSet<Profile>(); @ManyToMany(fetch = FetchType.EAGER) @OrderBy(value = "name asc") @JoinTable(name = "partner_service", joinColumns = { @JoinColumn(name = "partner_id") }, inverseJoinColumns = { @JoinColumn(name = "service_id") }) private Set<Service> services = new HashSet<Service>(); ... } Service entity: @Entity @Table(name = "services") public class Service { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "partner_service", joinColumns = { @JoinColumn(name = "service_id") }, inverseJoinColumns = { @JoinColumn(name = "partner_id") }) private Set<Partner> partners = new HashSet<Partner>(); ... } Here are my hibernate/datasource configurations <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="poolPreparedStatements" value="true" /> <property name="maxActive" value="20" /> <property name="initialSize" value="2" /> <property name="maxIdle" value="2" /> </bean> <bean id="profileDAO" class="com.eniro.partnerapi.dao.impl.ProfileDAOHibernateImpl" /> <!-- Hibernate session factory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="packagesToScan" value="com.eniro.partnerapi.model" /> <property name="hibernateProperties"> <props> <prop key="dialect">org.hibernate.dialect.MySQL5Dialect</prop> <prop key="hibernate.hbm2ddl.auto">verify</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.jdbc.batch_size">30</prop> </props> </property> </bean> <tx:annotation-driven transaction-manager="txManager" /> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="dataSource" ref="dataSource" /> <property name="sessionFactory" ref="sessionFactory" /> </bean> * A Partner has a OneToMany to Profiles (and vice versa) * A Partner has a ManyToMany to Services What I'm trying to achieve is that when I load a profile, I want its owning Partner to be loaded, and the Partner's Services at the same time. And yes, I want them to be eagerly loaded since they are rarely of great sets, and they are almost always needed all at the same time in this system. An example scenario is: * Partner A has 3 profiles * Partner A has 5 services * The partners first Profile is fetched (profileX), at the same time the Partner and the Partner's Services are loaded. Here is where my problem occurs (in the getProfile call in my DAO): Sometimes only the first service (based on id) is loaded from the database, and sometimes all 5 services are loaded. What can be the cause of this?! Anyone has any experience or anything for me to go on?
java
hibernate
spring
hibernate-session
null
null
open
Hibernate only loads one object from a list === This is what I do: @Repository @Transactional(propagation = Propagation.SUPPORTS) public class ProfileDAOHibernateImpl implements ProfileDAO { @Autowired private SessionFactory sessionFactory; private Session currentSession() { return sessionFactory.getCurrentSession(); } @Override public Profile getProfile(String name) { return (Profile) currentSession().createCriteria(Profile.class) .add(Restrictions.eq("name", name)).uniqueResult(); } ... } Profile entity: @Entity @Table(name = "profiles") public class Profile { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int Id; @Column(name = "name", unique = true) private String name; @ManyToOne(optional = false, fetch = FetchType.EAGER) @JoinColumn(name="partner_id", nullable = false) private Partner partner; ... } Partner entity @Entity @Table(name = "partners") public class Partner { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @OneToMany(fetch = FetchType.LAZY, cascade={CascadeType.ALL}, mappedBy = "partner") @OrderBy(value = "dateCreated desc") private Set<Profile> profiles = new HashSet<Profile>(); @ManyToMany(fetch = FetchType.EAGER) @OrderBy(value = "name asc") @JoinTable(name = "partner_service", joinColumns = { @JoinColumn(name = "partner_id") }, inverseJoinColumns = { @JoinColumn(name = "service_id") }) private Set<Service> services = new HashSet<Service>(); ... } Service entity: @Entity @Table(name = "services") public class Service { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "partner_service", joinColumns = { @JoinColumn(name = "service_id") }, inverseJoinColumns = { @JoinColumn(name = "partner_id") }) private Set<Partner> partners = new HashSet<Partner>(); ... } Here are my hibernate/datasource configurations <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="poolPreparedStatements" value="true" /> <property name="maxActive" value="20" /> <property name="initialSize" value="2" /> <property name="maxIdle" value="2" /> </bean> <bean id="profileDAO" class="com.eniro.partnerapi.dao.impl.ProfileDAOHibernateImpl" /> <!-- Hibernate session factory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="packagesToScan" value="com.eniro.partnerapi.model" /> <property name="hibernateProperties"> <props> <prop key="dialect">org.hibernate.dialect.MySQL5Dialect</prop> <prop key="hibernate.hbm2ddl.auto">verify</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.jdbc.batch_size">30</prop> </props> </property> </bean> <tx:annotation-driven transaction-manager="txManager" /> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="dataSource" ref="dataSource" /> <property name="sessionFactory" ref="sessionFactory" /> </bean> * A Partner has a OneToMany to Profiles (and vice versa) * A Partner has a ManyToMany to Services What I'm trying to achieve is that when I load a profile, I want its owning Partner to be loaded, and the Partner's Services at the same time. And yes, I want them to be eagerly loaded since they are rarely of great sets, and they are almost always needed all at the same time in this system. An example scenario is: * Partner A has 3 profiles * Partner A has 5 services * The partners first Profile is fetched (profileX), at the same time the Partner and the Partner's Services are loaded. Here is where my problem occurs (in the getProfile call in my DAO): Sometimes only the first service (based on id) is loaded from the database, and sometimes all 5 services are loaded. What can be the cause of this?! Anyone has any experience or anything for me to go on?
0
10,282,505
04/23/2012 14:27:09
1,148,457
01/13/2012 20:28:41
1
0
Unable to get button text from a ReturnDialogHandler
I am able to handle a Return Dialog presented on beforeunload similar to this question: http://stackoverflow.com/questions/9295710/watin-driving-the-ie-are-you-sure-you-want-to-leave-this-page-popup but I am having a problem with actually getting the window text and the button text. My set up code looks something like this... public delegate void NoWaitFunc2RaiseUnloadDialog(); public browser IE; public void HandleUnloadDialog(NoWaitFunc2RaiseUnloadDialog func, string response) { IReturnDialogHandler unloadPageHandler = ReturnDialogHandler.CreateInstance(); using (new UseDialogOnce(browser.DialogWatcher, unloadPageHandler)) { func(); try { unloadPageHandler.WaitUntilExists(5); if(unloadPageHandler.Exists()) { //var okButton = unloadPageHandler.OKButton.Title //if(okButton.contains(response) //{ unloadPageHandler.OKButton.Click(); } //else { unloadPageHandler.CancelButton.Click(); } } } catch(Exception e) { System.Diagnostics.Debug.Assert(false, e.Message); } } } [SetUp] public void SetUp() { browser = new IE("http://MySite.com"); } And my test looks something like this... [Test] public void TestUnloadPage() { try { NoWaitFunc2RaiseUnloadDialog f = () => { browser.Link(Find.ByText(new Regex(@""Log off"))).ClickNoWait(); }; HandleUnloadDialog(f, "Stay on this page"); } catch(Exception e) { System.Diagnostics.Debug.Assert(false, e.Message); } browser.WaitForComplete(); //Somewhere in/after this wait, I get COMException 0x80004005 E_FAIL //but only when I use unloadPageHandler.OkButton.Title (commented out for now). } I have been able to debug the unloadPageHandler to see that it does have button title, but it does not have a message. I have only been working with IE9 so far. From Spy++ I have gathered that the unload popup dialog is on the same thread and process as the original IE window frame. Can anyone else get dialog message or button text? or am I going about this wrong?
watin
null
null
null
null
null
open
Unable to get button text from a ReturnDialogHandler === I am able to handle a Return Dialog presented on beforeunload similar to this question: http://stackoverflow.com/questions/9295710/watin-driving-the-ie-are-you-sure-you-want-to-leave-this-page-popup but I am having a problem with actually getting the window text and the button text. My set up code looks something like this... public delegate void NoWaitFunc2RaiseUnloadDialog(); public browser IE; public void HandleUnloadDialog(NoWaitFunc2RaiseUnloadDialog func, string response) { IReturnDialogHandler unloadPageHandler = ReturnDialogHandler.CreateInstance(); using (new UseDialogOnce(browser.DialogWatcher, unloadPageHandler)) { func(); try { unloadPageHandler.WaitUntilExists(5); if(unloadPageHandler.Exists()) { //var okButton = unloadPageHandler.OKButton.Title //if(okButton.contains(response) //{ unloadPageHandler.OKButton.Click(); } //else { unloadPageHandler.CancelButton.Click(); } } } catch(Exception e) { System.Diagnostics.Debug.Assert(false, e.Message); } } } [SetUp] public void SetUp() { browser = new IE("http://MySite.com"); } And my test looks something like this... [Test] public void TestUnloadPage() { try { NoWaitFunc2RaiseUnloadDialog f = () => { browser.Link(Find.ByText(new Regex(@""Log off"))).ClickNoWait(); }; HandleUnloadDialog(f, "Stay on this page"); } catch(Exception e) { System.Diagnostics.Debug.Assert(false, e.Message); } browser.WaitForComplete(); //Somewhere in/after this wait, I get COMException 0x80004005 E_FAIL //but only when I use unloadPageHandler.OkButton.Title (commented out for now). } I have been able to debug the unloadPageHandler to see that it does have button title, but it does not have a message. I have only been working with IE9 so far. From Spy++ I have gathered that the unload popup dialog is on the same thread and process as the original IE window frame. Can anyone else get dialog message or button text? or am I going about this wrong?
0
255,785
11/01/2008 17:13:49
13,227
09/16/2008 17:43:51
642
24
Does a tool exist for dynamically altering running javascript in a browser?
Does a tool exist for dynamically altering running javascript in a browser? For example, to changes the values of javascript variables during runtime.
javascript
dynamic-data
null
null
null
11/01/2008 23:34:19
off topic
Does a tool exist for dynamically altering running javascript in a browser? === Does a tool exist for dynamically altering running javascript in a browser? For example, to changes the values of javascript variables during runtime.
2
1,046,810
06/26/2009 00:18:39
80
08/01/2008 16:11:11
800
16
Using JSLint in Notepad++
I have seen other text editors use extensions to allow syntax checkers such as <a href="http://www.jslint.com">JSLint</a>, is this possible with Notepad++?
jslint
notepad++
javascript
lint
null
null
open
Using JSLint in Notepad++ === I have seen other text editors use extensions to allow syntax checkers such as <a href="http://www.jslint.com">JSLint</a>, is this possible with Notepad++?
0
7,270,895
09/01/2011 13:17:22
651,174
03/09/2011 08:26:41
422
15
How to pass variables to a form before it is processed
I have the following template form, containing several variables. <form action="https://me.s3.amazonaws.com/" method="post" enctype='multipart/form-data' class="upload-form"> <input type="hidden" name="key" value="videos/{{filename}}"> <input type="hidden" name="AWSAccessKeyId" value="{{access_key}}"> <input type="hidden" name="acl" value="public-read"> <input type="hidden" name="policy" value="{{policy}}"> <input type="hidden" name="signature" value="{{signature}}"> <input type="hidden" name="Content-Type" value="{{content_type}}"> <input name="file" type="file"> <input type="submit" value="Upload" name="upload"> </form> However, as soon as the submit button is hit, the form is sent to amazon, and I'm not able to pass it variables. This is what I've been trying to do, unsuccessfully -- if 'upload' in request.POST: policy = base64.b64encode(...) signature = base64.b64encode( hmac.new('secret_key', policy, sha).digest()) file = request.POST['files'] filename=file.name content_type=mimetypes.guess_type(filename)[0] What do I need to do to pass the variables to the form after the POST request but BEFORE amazon processes the form? Thank you.
python
django
forms
http-headers
amazon-s3
null
open
How to pass variables to a form before it is processed === I have the following template form, containing several variables. <form action="https://me.s3.amazonaws.com/" method="post" enctype='multipart/form-data' class="upload-form"> <input type="hidden" name="key" value="videos/{{filename}}"> <input type="hidden" name="AWSAccessKeyId" value="{{access_key}}"> <input type="hidden" name="acl" value="public-read"> <input type="hidden" name="policy" value="{{policy}}"> <input type="hidden" name="signature" value="{{signature}}"> <input type="hidden" name="Content-Type" value="{{content_type}}"> <input name="file" type="file"> <input type="submit" value="Upload" name="upload"> </form> However, as soon as the submit button is hit, the form is sent to amazon, and I'm not able to pass it variables. This is what I've been trying to do, unsuccessfully -- if 'upload' in request.POST: policy = base64.b64encode(...) signature = base64.b64encode( hmac.new('secret_key', policy, sha).digest()) file = request.POST['files'] filename=file.name content_type=mimetypes.guess_type(filename)[0] What do I need to do to pass the variables to the form after the POST request but BEFORE amazon processes the form? Thank you.
0
8,942,507
01/20/2012 13:59:56
538,191
12/10/2010 18:03:14
559
15
How to redirect to page which has GET parameters after login using the {{next}} variable in django
I am using `allauth` to provide registration and login in my django site. Everything else seems to be working fine other than that I am having problems to redirect the person to the current page after login. I have a page where I have some interview questions and a typical url for it would be like /questions/?company=google This page contains a list of questions for the company google, but to view the answer the person needs to login. The answers are displayed in a dropdown box. However when the user clicks on login a request is sent to the `login` page as follows /login/?next=/questions/ And the get parameter which was actually there in my actual page is not sent because of the `&` in my url. How can I solve this problem. It does not look nice that the person is redirected to a different page from where he/she tried to login. I know sending the `next` parameter as a `GET` variable is not the solution, but is there a way I can send the `redirect link` as a `POST` variable from the template. I tried another thing, in my view that displays the questions list. I set session variables which contains the url of the current link . If a user clicks on login, in my login view I check for this particular session variable. If it is set then I redirect to that page. However the session variable is not received in the login view, I am not sure but I think the session is reset when the user goes to the login view. Any suggestions are appreciated.
django
session
url
redirect
null
null
open
How to redirect to page which has GET parameters after login using the {{next}} variable in django === I am using `allauth` to provide registration and login in my django site. Everything else seems to be working fine other than that I am having problems to redirect the person to the current page after login. I have a page where I have some interview questions and a typical url for it would be like /questions/?company=google This page contains a list of questions for the company google, but to view the answer the person needs to login. The answers are displayed in a dropdown box. However when the user clicks on login a request is sent to the `login` page as follows /login/?next=/questions/ And the get parameter which was actually there in my actual page is not sent because of the `&` in my url. How can I solve this problem. It does not look nice that the person is redirected to a different page from where he/she tried to login. I know sending the `next` parameter as a `GET` variable is not the solution, but is there a way I can send the `redirect link` as a `POST` variable from the template. I tried another thing, in my view that displays the questions list. I set session variables which contains the url of the current link . If a user clicks on login, in my login view I check for this particular session variable. If it is set then I redirect to that page. However the session variable is not received in the login view, I am not sure but I think the session is reset when the user goes to the login view. Any suggestions are appreciated.
0
11,596,332
07/21/2012 22:27:37
452,521
09/18/2008 15:03:11
5,376
60
How to resample audio using FFT or DFT
I'm down sampling voice audio by first performing an FFT, then only taking the parts of the result that I need, and then performing an inverse FFT. However, it's only working properly when I'm using frequencies that are both power of two, say down-sampling from 32768 to 8192. I perform an FFT on the 32k data, discard the top 3/4 of the data and then perform an inverse FFT on the remaining 1/4. However, whenever I try to do this with data that doesn't line up properly one of two things happen: The math library I'm (Aforge.Math) using throws a fit, because my samples are not a power of two. If I try to zero-pad the samples so they become power of twos, it get gibberish out on the other end. I also tried to use a DFT instead, but it ends up being insanely slow (this needs to be done in real time). How would I go about to zero pad the FFT data properly, both on the initial FFT and the inverse FFT at the end? Assuming I have a sample at 44.1khz that needs to get to 16khz, I currently try something like this, the sample being 1000 in size. 1. Pad input data to 1024 at the end 2. Perform FFT 3. Read the first 512 items into an array (I only need the first 332, but need ^2) 4. Perform inverse FFT 5. Read the first 332 items into the audio play buffer From this, i get garbage out at the end. Doing the same thing but without having to pad at step 1 and 3 due to the samples already being ^2, gives a correct result.
c#
.net
math
audio
aforge
07/24/2012 16:43:49
off topic
How to resample audio using FFT or DFT === I'm down sampling voice audio by first performing an FFT, then only taking the parts of the result that I need, and then performing an inverse FFT. However, it's only working properly when I'm using frequencies that are both power of two, say down-sampling from 32768 to 8192. I perform an FFT on the 32k data, discard the top 3/4 of the data and then perform an inverse FFT on the remaining 1/4. However, whenever I try to do this with data that doesn't line up properly one of two things happen: The math library I'm (Aforge.Math) using throws a fit, because my samples are not a power of two. If I try to zero-pad the samples so they become power of twos, it get gibberish out on the other end. I also tried to use a DFT instead, but it ends up being insanely slow (this needs to be done in real time). How would I go about to zero pad the FFT data properly, both on the initial FFT and the inverse FFT at the end? Assuming I have a sample at 44.1khz that needs to get to 16khz, I currently try something like this, the sample being 1000 in size. 1. Pad input data to 1024 at the end 2. Perform FFT 3. Read the first 512 items into an array (I only need the first 332, but need ^2) 4. Perform inverse FFT 5. Read the first 332 items into the audio play buffer From this, i get garbage out at the end. Doing the same thing but without having to pad at step 1 and 3 due to the samples already being ^2, gives a correct result.
2
11,641,009
07/25/2012 00:06:11
215,042
02/21/2009 19:11:34
1,753
77
C# Linq Intersect List<T> in memory with IEnumerable<T> from filestream
I have this class that exposes an `IEnumerable<Record>` as follows (implementation details left out): public class SomeFileReader() { public virtual IEnumerable<Record> Records() { using (StreamReader sr = new StreamReader(this.Path, this.Encoding, true)) { while (!sr.EndOfStream) yield return this.RecordParser.Parse(sr.ReadLine()) as Record; } } A `Record` has, amongst many other properties (and thus being quite large 'memory/storage wise'), an `Id` property (which is a `Key` object that consists of 2 "parts"). For completeness this looks something like: public class Key : IEquatable<Key> { public string OperatorCode { get; set; } public string Key { get; set; } public bool Equals(Key other) { return (this.OperatorCode.Equals(other.OperatorCode, StringComparison.OrdinalIgnoreCase)) && (this.Key.Equals(other.Key, StringComparison.OrdinalIgnoreCase)); } } The file contains the records in "key order", so it is (guaranteed to be) sorted by the Record's `ID` on-disk. I also have, in memory, a `List<Key>` of records that I want to process from the `SomeFileReader`. Currently my testfile is only a few megabytes large but I am forseeing this to grow very large in the near future. At this moment I just read the entire file into memory using a `Dictionary<Key, Record>` for easy/fast retrieval of specific records I want to process from my list of "to be processed" records. This would be similar to: var recordsfromfile = MyFileImporter.Records().ToDictionary(k => k.Key.Key); This will be problematic once the file grows (too) large ofcourse. But since I am exposing an `IEnumerable<Record>` I was thinking... I shouldn't have to read the file into memory *completely* since the records are in key order. A simple [Intersect()][1] with my list of to-be-processed ID's should suffice. The `Key` already implements `IEquatable` and *should* I need an `IEQualityComparer<Key>` that wouldn't be hard to implement at all. But I (think I) digress.. The `Intersect()` documentation tells me: > When the object returned by this method is enumerated, Intersect > enumerates *`first`*, collecting all distinct elements of that sequence. > It then enumerates *`second`*, marking those elements that occur in both > sequences. **Finally**, the marked elements are yielded in the order in > which they were collected. <sup>(Emphasis mine)</sup> So, if I understand correcly, if *`first`* would be my `IEnumerable<Record>` the file will still be read into memory completely. And even if it would be *`second`* all matches with my 'to-be-processed' list would still be read into memory which could still be a very large amount of data. Or am I misreading the documentation and is this "Finally" tripping me up and/or am I misunderstanding the documentation? What I want to prevent, obviously, is - a) not reading a large wad of data into memory for the sole purpose of processing some of the records in them one-by-one after which I don't care about those records (the processing will write the result out somewhere else for example) - b) not (re)opening the same file again and again for each record on my 'to-be-processed' list (so I want to be careful not to reset my iterator) Long story short; will the `Intersect()` do what I want it to do? Should I use another method? Nested for-loop? Any other ideas on how to handle this efficiently?<br> __<br> P.s. I was just hit by a brainwave about using Linq for this purpose in bed and can't get to sleep before I figure this out. Unfortunately, I am on vacation and miles away from a decent Visual Studio instance to just simply test this out. That will have to wait until after my vaction (so the misses says... we'll see about that...) ![smiley][2] [1]: http://msdn.microsoft.com/en-us/library/system.linq.enumerable.intersect.aspx [2]: http://i.stack.imgur.com/P6HSs.gif
c#
linq
memory
file-io
null
null
open
C# Linq Intersect List<T> in memory with IEnumerable<T> from filestream === I have this class that exposes an `IEnumerable<Record>` as follows (implementation details left out): public class SomeFileReader() { public virtual IEnumerable<Record> Records() { using (StreamReader sr = new StreamReader(this.Path, this.Encoding, true)) { while (!sr.EndOfStream) yield return this.RecordParser.Parse(sr.ReadLine()) as Record; } } A `Record` has, amongst many other properties (and thus being quite large 'memory/storage wise'), an `Id` property (which is a `Key` object that consists of 2 "parts"). For completeness this looks something like: public class Key : IEquatable<Key> { public string OperatorCode { get; set; } public string Key { get; set; } public bool Equals(Key other) { return (this.OperatorCode.Equals(other.OperatorCode, StringComparison.OrdinalIgnoreCase)) && (this.Key.Equals(other.Key, StringComparison.OrdinalIgnoreCase)); } } The file contains the records in "key order", so it is (guaranteed to be) sorted by the Record's `ID` on-disk. I also have, in memory, a `List<Key>` of records that I want to process from the `SomeFileReader`. Currently my testfile is only a few megabytes large but I am forseeing this to grow very large in the near future. At this moment I just read the entire file into memory using a `Dictionary<Key, Record>` for easy/fast retrieval of specific records I want to process from my list of "to be processed" records. This would be similar to: var recordsfromfile = MyFileImporter.Records().ToDictionary(k => k.Key.Key); This will be problematic once the file grows (too) large ofcourse. But since I am exposing an `IEnumerable<Record>` I was thinking... I shouldn't have to read the file into memory *completely* since the records are in key order. A simple [Intersect()][1] with my list of to-be-processed ID's should suffice. The `Key` already implements `IEquatable` and *should* I need an `IEQualityComparer<Key>` that wouldn't be hard to implement at all. But I (think I) digress.. The `Intersect()` documentation tells me: > When the object returned by this method is enumerated, Intersect > enumerates *`first`*, collecting all distinct elements of that sequence. > It then enumerates *`second`*, marking those elements that occur in both > sequences. **Finally**, the marked elements are yielded in the order in > which they were collected. <sup>(Emphasis mine)</sup> So, if I understand correcly, if *`first`* would be my `IEnumerable<Record>` the file will still be read into memory completely. And even if it would be *`second`* all matches with my 'to-be-processed' list would still be read into memory which could still be a very large amount of data. Or am I misreading the documentation and is this "Finally" tripping me up and/or am I misunderstanding the documentation? What I want to prevent, obviously, is - a) not reading a large wad of data into memory for the sole purpose of processing some of the records in them one-by-one after which I don't care about those records (the processing will write the result out somewhere else for example) - b) not (re)opening the same file again and again for each record on my 'to-be-processed' list (so I want to be careful not to reset my iterator) Long story short; will the `Intersect()` do what I want it to do? Should I use another method? Nested for-loop? Any other ideas on how to handle this efficiently?<br> __<br> P.s. I was just hit by a brainwave about using Linq for this purpose in bed and can't get to sleep before I figure this out. Unfortunately, I am on vacation and miles away from a decent Visual Studio instance to just simply test this out. That will have to wait until after my vaction (so the misses says... we'll see about that...) ![smiley][2] [1]: http://msdn.microsoft.com/en-us/library/system.linq.enumerable.intersect.aspx [2]: http://i.stack.imgur.com/P6HSs.gif
0