PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
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
32
30.1k
OpenStatus_id
int64
0
4
11,472,483
07/13/2012 14:25:59
346,527
05/20/2010 20:26:49
337
10
clean/sanitize HTML, but preserve loose HTML chars with Ruby/Rails + Nokogiri + Sanitize (?)
so, in a Ruby on Rails app, we were using a combination of the Sanitize gem and HTMLEntities to do some clean up of user input HTML. the Sanitize Gem used to use Hpricot, but now uses Nokogiri. I need to get Hpricot out of the app. Here's the test i cannot get to pass using Nokogiri. text string: "SOME TEXT < '<span style='background-image: url(\"http://evil.ru/webbug.png\")'>MORE' & TEXT!!!</span>" expected_text = "SOME TEXT < 'MORE' & TEXT!!!" and also, a slightly different path: 'Support <i>odd</i> chars like " < \' ‽' expected_text = 'Support <i>odd</i> chars like &quot; &lt; &#39; ‽' is this something you've solved? what tools did you use?
ruby
ruby-on-rails-3
nokogiri
hpricot
sanitize
null
open
clean/sanitize HTML, but preserve loose HTML chars with Ruby/Rails + Nokogiri + Sanitize (?) === so, in a Ruby on Rails app, we were using a combination of the Sanitize gem and HTMLEntities to do some clean up of user input HTML. the Sanitize Gem used to use Hpricot, but now uses Nokogiri. I need to get Hpricot out of the app. Here's the test i cannot get to pass using Nokogiri. text string: "SOME TEXT < '<span style='background-image: url(\"http://evil.ru/webbug.png\")'>MORE' & TEXT!!!</span>" expected_text = "SOME TEXT < 'MORE' & TEXT!!!" and also, a slightly different path: 'Support <i>odd</i> chars like " < \' ‽' expected_text = 'Support <i>odd</i> chars like &quot; &lt; &#39; ‽' is this something you've solved? what tools did you use?
0
11,472,484
07/13/2012 14:26:00
648,290
03/07/2011 14:25:02
370
1
word size and data bus
I am confused about **the definition of word size**.I read that the word size of a processor is its data bus width. Like an 8 bit processor has an 8 bit wide data bus. I recently read that the maximum size of the virtual address space is determined by word size i.e. if the word size is n bits the max virtual address space is 2^n -1. But i always thought that maximum virtual address space is determined by address bus width i.e. an n bits wide address bus can address maximum 2^n bytes. So, **what is true?** **Also**, is this related to **pointers** as an n bit data bus is capable of carrying only an n bit address. So, maximum 2^n bytes can be accessed via pointers.
word
computer-architecture
null
null
null
null
open
word size and data bus === I am confused about **the definition of word size**.I read that the word size of a processor is its data bus width. Like an 8 bit processor has an 8 bit wide data bus. I recently read that the maximum size of the virtual address space is determined by word size i.e. if the word size is n bits the max virtual address space is 2^n -1. But i always thought that maximum virtual address space is determined by address bus width i.e. an n bits wide address bus can address maximum 2^n bytes. So, **what is true?** **Also**, is this related to **pointers** as an n bit data bus is capable of carrying only an n bit address. So, maximum 2^n bytes can be accessed via pointers.
0
11,471,822
07/13/2012 13:49:25
929,655
09/05/2011 22:45:39
37
3
how to remove request reader from HttpInputStream
i need help whit a servlet. I need to head a inputStream in one request and write a tiff file. The inputStream come whit request header and i dont know how i remove that bytes and write only the file. see initial bytes from the writen file. -qF3PFkB8oQ-OnPe9HVzkqFtLeOnz7S5Be Content-Disposition: form-data; name=""; filename="" Content-Type: application/octet-stream; charset=ISO-8859-1 Content-Transfer-Encoding: binary i want to remove that and write only bytes from the tiff file. PS: sender of file its not me.
file
servlets
httprequest
fileinputstream
null
null
open
how to remove request reader from HttpInputStream === i need help whit a servlet. I need to head a inputStream in one request and write a tiff file. The inputStream come whit request header and i dont know how i remove that bytes and write only the file. see initial bytes from the writen file. -qF3PFkB8oQ-OnPe9HVzkqFtLeOnz7S5Be Content-Disposition: form-data; name=""; filename="" Content-Type: application/octet-stream; charset=ISO-8859-1 Content-Transfer-Encoding: binary i want to remove that and write only bytes from the tiff file. PS: sender of file its not me.
0
11,471,825
07/13/2012 13:49:37
461,992
09/29/2010 16:19:41
387
5
Java - regex not working
I have a string of `"abc123("` and want to check if contains one or more chars that are not a number or character. `"abc123(".matches("[^a-zA-Z0-9]+");` should return true in this case? But it dose not! Whats wrong?
java
regex
null
null
null
null
open
Java - regex not working === I have a string of `"abc123("` and want to check if contains one or more chars that are not a number or character. `"abc123(".matches("[^a-zA-Z0-9]+");` should return true in this case? But it dose not! Whats wrong?
0
11,467,760
07/13/2012 09:29:54
1,393,855
05/14/2012 13:32:23
24
4
FindViewById() not finding View
Just added a new button to my already-working-fine layout, but the findViewById function seems to be angry with something I don't get to understand. Here's a bit of the layout: <LinearLayout ... > <ListView android:id="@+id/my_lovely_list" android:layout_width="fill_parent" android:layout_weight="1" /> <Button android:id="@+id/my_lovely_butt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/exit_b" android:layout_weight="0" android:clickable="true" /> </LinearLayout> And here's a bit of the coding: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ... list_o = (ListView)findViewById(R.id.my_lovely_list); butt_o = (Button)findViewById(R.id.my_lovely_butt); ... } So, the big mistery is that the ListView is found without any problem, but the Button won't by any means. I've already tried cleaning the Proyect, and look throught the posts I've found here... but still don't get to find the problem! Any thoughts?
android
android-layout
null
null
null
null
open
FindViewById() not finding View === Just added a new button to my already-working-fine layout, but the findViewById function seems to be angry with something I don't get to understand. Here's a bit of the layout: <LinearLayout ... > <ListView android:id="@+id/my_lovely_list" android:layout_width="fill_parent" android:layout_weight="1" /> <Button android:id="@+id/my_lovely_butt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/exit_b" android:layout_weight="0" android:clickable="true" /> </LinearLayout> And here's a bit of the coding: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ... list_o = (ListView)findViewById(R.id.my_lovely_list); butt_o = (Button)findViewById(R.id.my_lovely_butt); ... } So, the big mistery is that the ListView is found without any problem, but the Button won't by any means. I've already tried cleaning the Proyect, and look throught the posts I've found here... but still don't get to find the problem! Any thoughts?
0
11,467,761
07/13/2012 09:29:55
1,040,070
11/10/2011 15:37:57
135
3
Netty-based application with long calculations
I going to start application development where network subsystem based on Netty. There are not so many documentation for it, especially it hard to find some "good practices". So the question is: where in Netty-based application I should perform long calculations? For example let it be very slow calculator which will calculate factorial of some integer in one minute. In Netty I'll have FrameDecoder which converts raw data to packets, and PacketProcessor selecting operation to perform. And now its time to perform numeric operation itself.. So the question is: which is the tupical way of doing long calculations with Netty? I know, Play Framework 2 uses Akka actors, but how they connected?
netty
null
null
null
null
null
open
Netty-based application with long calculations === I going to start application development where network subsystem based on Netty. There are not so many documentation for it, especially it hard to find some "good practices". So the question is: where in Netty-based application I should perform long calculations? For example let it be very slow calculator which will calculate factorial of some integer in one minute. In Netty I'll have FrameDecoder which converts raw data to packets, and PacketProcessor selecting operation to perform. And now its time to perform numeric operation itself.. So the question is: which is the tupical way of doing long calculations with Netty? I know, Play Framework 2 uses Akka actors, but how they connected?
0
11,472,487
07/13/2012 14:26:17
1,088,089
12/08/2011 15:55:59
13
0
jQuery override event.preventDefault()
I have a form that, when submitted, goes through the usual e.preventDefault() and sends an ajax request instead. However, if this ajax request returns a certain condition, I want the form to be submitted normally. How do I achieve this? // Submit handler $(".reserveer_form").submit(function(event){ event.preventDefault(); $.ajax({ url: $(this).attr("action"), data: $(this).serialize(), success: function(data) { if($(".messagered",data).length > 0){ var errors = $(".messagered",data); $(".gegevens").before(errors); } else { // SUBMIT THE FORM! } } }); })
javascript
jquery
javascript-events
preventdefault
null
null
open
jQuery override event.preventDefault() === I have a form that, when submitted, goes through the usual e.preventDefault() and sends an ajax request instead. However, if this ajax request returns a certain condition, I want the form to be submitted normally. How do I achieve this? // Submit handler $(".reserveer_form").submit(function(event){ event.preventDefault(); $.ajax({ url: $(this).attr("action"), data: $(this).serialize(), success: function(data) { if($(".messagered",data).length > 0){ var errors = $(".messagered",data); $(".gegevens").before(errors); } else { // SUBMIT THE FORM! } } }); })
0
11,472,491
07/13/2012 14:26:32
1,007,264
10/21/2011 14:07:39
71
0
Taskbar icon not showing until App get focus
I'm having a problem. My application won't be shown in Windows 7 taskbar until it gets focus. I've tried a lot of things, including: this.TopMost = true; this.ShowInTaskBar = true; In different stages of the form lifecycle, but nothing happens. The FormBorderStyle property is set to FixedSingle. The form only has a couple of buttons and a webbrowser (that gets an html page from the resources). I'm running on Windows 7 64 bit. Thanks.
c#
winforms
null
null
null
null
open
Taskbar icon not showing until App get focus === I'm having a problem. My application won't be shown in Windows 7 taskbar until it gets focus. I've tried a lot of things, including: this.TopMost = true; this.ShowInTaskBar = true; In different stages of the form lifecycle, but nothing happens. The FormBorderStyle property is set to FixedSingle. The form only has a couple of buttons and a webbrowser (that gets an html page from the resources). I'm running on Windows 7 64 bit. Thanks.
0
11,472,138
07/13/2012 14:08:39
501,673
11/09/2010 09:27:29
1,053
151
Cores and hyperthreading
I'm writing an extremely optimized and CPU-intensive multithreaded code in C which performs a task in a more or less limited time space. During this time it does not venture out of its L1 cache except to load initial values and to store final results. So essentially this is a parallelized code which scales linearly for every core added. This is what happens on non-HT cores. On my 2-core i5 with HT (which the BIOS does not allow to be disabled - this is an impractical solution anyway) I get an annoyingly dismal improvement when going from one core to two. My hypothesis is that the first thread runs alone on a core and the second shares the core with the first. There are functions in the Windows API to retrieve info about available cores and HTs. But how do I make use of this information to ensure that there is only one thread on one hyperthread per core?
winapi
scalability
multicore
hyperthreading
null
null
open
Cores and hyperthreading === I'm writing an extremely optimized and CPU-intensive multithreaded code in C which performs a task in a more or less limited time space. During this time it does not venture out of its L1 cache except to load initial values and to store final results. So essentially this is a parallelized code which scales linearly for every core added. This is what happens on non-HT cores. On my 2-core i5 with HT (which the BIOS does not allow to be disabled - this is an impractical solution anyway) I get an annoyingly dismal improvement when going from one core to two. My hypothesis is that the first thread runs alone on a core and the second shares the core with the first. There are functions in the Windows API to retrieve info about available cores and HTs. But how do I make use of this information to ensure that there is only one thread on one hyperthread per core?
0
11,472,494
07/13/2012 14:26:43
1,523,728
07/13/2012 13:47:07
1
0
Self-Hosted WCF Custom binding, Binary message, HTTPS transport WITHOUT certificate
I have some self-hosted WCF services using CustomBinding for HTTP protocol on a specific port. I use BinaryMessageEncodingBindingElement and HttpTransportBindingElement so far without problem. Now I need to secure a bit more by using HTTPS but with NO cert. I switched to HttpsTransportBindingElement and set RequireClientCertificate to false. I have no cert installed on that port. I checked by running "netsh http show sslcert". And I get follow error when I try to add my service to a WPF app (browsing with Chrome I get "This webpage is not available"): ---------- >There was an error downloading 'https://localhost:8080/myhost/myservice.svc'. <br/> >The underlying connection was closed: An unexpected error occurred on a send. <br/> Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.<br/> An existing connection was forcibly closed by the remote host <br/> Metadata contains a reference that cannot be resolved: 'https://localhost:8080/myhost/myservice.svc'. <br/> An error occurred while making the HTTP request to 'https://localhost:8080/myhost/myservice.svc'. <br/> This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. <br/> This could also be caused by a mismatch of the security binding between the client and the server. <br/> The underlying connection was closed: An unexpected error occurred on a send. <br/> Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. <br/> An existing connection was forcibly closed by the remote host <br/> If the service is defined in the current solution, try building the solution and adding the service reference again. <br/> Here goes my binding: private System.ServiceModel.Channels.Binding GetHttpBinding(String pName) { System.ServiceModel.Channels.BindingElementCollection elements = new System.ServiceModel.Channels.BindingElementCollection(); System.ServiceModel.Channels.BinaryMessageEncodingBindingElement binaryMessageEncoding = new System.ServiceModel.Channels.BinaryMessageEncodingBindingElement(); binaryMessageEncoding.MessageVersion = System.ServiceModel.Channels.MessageVersion.Default; binaryMessageEncoding.ReaderQuotas.MaxArrayLength = this._maxArrayLength; binaryMessageEncoding.ReaderQuotas.MaxBytesPerRead = this._maxBytesPerRead; binaryMessageEncoding.ReaderQuotas.MaxDepth = this._maxDepth; binaryMessageEncoding.ReaderQuotas.MaxNameTableCharCount = this._maxNameTableCharCount; binaryMessageEncoding.ReaderQuotas.MaxStringContentLength = this._maxStringContentLength; elements.Add(binaryMessageEncoding); if (this._applyHttps) { System.ServiceModel.Channels.HttpsTransportBindingElement transport = new System.ServiceModel.Channels.HttpsTransportBindingElement() { MaxBufferSize = this._maxBufferSize, MaxReceivedMessageSize = this._maxReceivedMessageSize, AllowCookies = false, BypassProxyOnLocal = false, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, MaxBufferPoolSize = this._maxBufferPoolSize, TransferMode = TransferMode.Buffered, UseDefaultWebProxy = true, ProxyAddress = null, RequireClientCertificate = false }; elements.Add(transport); } else { System.ServiceModel.Channels.HttpTransportBindingElement transport = new System.ServiceModel.Channels.HttpTransportBindingElement() { MaxBufferSize = this._maxBufferSize, MaxReceivedMessageSize = this._maxReceivedMessageSize, }; elements.Add(transport); } System.ServiceModel.Channels.CustomBinding custB = new System.ServiceModel.Channels.CustomBinding(elements); custB.Name = pName; custB.SendTimeout = new TimeSpan(0, 2, 0); return custB; } ---------- And I configure the service host with this method: private void ConfigureBinaryService(ServiceHost pHost, Type pType, String pServiceName) { pHost.AddServiceEndpoint(pType, this.GetHttpBinding(pType.Name), String.Empty); pHost.AddServiceEndpoint(pType, this.GetNetTcpBinding(pType.Name), String.Empty); pHost.Description.Endpoints[0].Name = pType.Name + "_BasicBin"; pHost.Description.Endpoints[1].Name = pType.Name + "_TCP"; pHost.OpenTimeout = new TimeSpan(0, 2, 0); pHost.CloseTimeout = new TimeSpan(0, 2, 0); System.ServiceModel.Description.ServiceMetadataBehavior metadataBehavior = pHost.Description.Behaviors.Find<System.ServiceModel.Description.ServiceMetadataBehavior>(); if (metadataBehavior == null) { metadataBehavior = new System.ServiceModel.Description.ServiceMetadataBehavior(); pHost.Description.Behaviors.Add(metadataBehavior); } if (this._applyHttps) metadataBehavior.HttpsGetEnabled = true; else metadataBehavior.HttpGetEnabled = true; metadataBehavior.MetadataExporter.PolicyVersion = System.ServiceModel.Description.PolicyVersion.Policy15; if (this._applyHttps) pHost.AddServiceEndpoint(System.ServiceModel.Description.ServiceMetadataBehavior.MexContractName , System.ServiceModel.Description.MetadataExchangeBindings.CreateMexHttpsBinding(), "mex"); else pHost.AddServiceEndpoint(System.ServiceModel.Description.ServiceMetadataBehavior.MexContractName , System.ServiceModel.Description.MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); pHost.AddServiceEndpoint(System.ServiceModel.Description.ServiceMetadataBehavior.MexContractName , System.ServiceModel.Description.MetadataExchangeBindings.CreateMexTcpBinding(), this._NetTcpComm + @"/" + pServiceName + @"/mex"); pHost.Description.Endpoints[2].Name = pType.Name + "_mex_BasicBin"; pHost.Description.Endpoints[3].Name = pType.Name + "_mex_TCP"; foreach (var item in pHost.Description.Endpoints[0].Contract.Operations) item.Behaviors.Find<System.ServiceModel.Description.DataContractSerializerOperationBehavior>().MaxItemsInObjectGraph = System.Int32.MaxValue; foreach (var item in pHost.Description.Endpoints[1].Contract.Operations) item.Behaviors.Find<System.ServiceModel.Description.DataContractSerializerOperationBehavior>().MaxItemsInObjectGraph = System.Int32.MaxValue; System.ServiceModel.Description.ServiceDebugBehavior debugBehavior = pHost.Description.Behaviors.Find<System.ServiceModel.Description.ServiceDebugBehavior>(); if (debugBehavior == null) { debugBehavior = new System.ServiceModel.Description.ServiceDebugBehavior(); pHost.Description.Behaviors.Add(debugBehavior); } debugBehavior.IncludeExceptionDetailInFaults = true; } When this._applyHttps is false, my service is accessible both by browser and reference in WPF project. So I ask for help for the first time after enjoying for so long all your help without asking directly. What am I missing? As it's not hosted under IIS should I still need a cert to install on the server side only for the specific port? Thanks guys in advance! And if someone has already answered this case I'm sorry for not finding it...
wcf
https
ssl-certificate
custom-binding
null
null
open
Self-Hosted WCF Custom binding, Binary message, HTTPS transport WITHOUT certificate === I have some self-hosted WCF services using CustomBinding for HTTP protocol on a specific port. I use BinaryMessageEncodingBindingElement and HttpTransportBindingElement so far without problem. Now I need to secure a bit more by using HTTPS but with NO cert. I switched to HttpsTransportBindingElement and set RequireClientCertificate to false. I have no cert installed on that port. I checked by running "netsh http show sslcert". And I get follow error when I try to add my service to a WPF app (browsing with Chrome I get "This webpage is not available"): ---------- >There was an error downloading 'https://localhost:8080/myhost/myservice.svc'. <br/> >The underlying connection was closed: An unexpected error occurred on a send. <br/> Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.<br/> An existing connection was forcibly closed by the remote host <br/> Metadata contains a reference that cannot be resolved: 'https://localhost:8080/myhost/myservice.svc'. <br/> An error occurred while making the HTTP request to 'https://localhost:8080/myhost/myservice.svc'. <br/> This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. <br/> This could also be caused by a mismatch of the security binding between the client and the server. <br/> The underlying connection was closed: An unexpected error occurred on a send. <br/> Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. <br/> An existing connection was forcibly closed by the remote host <br/> If the service is defined in the current solution, try building the solution and adding the service reference again. <br/> Here goes my binding: private System.ServiceModel.Channels.Binding GetHttpBinding(String pName) { System.ServiceModel.Channels.BindingElementCollection elements = new System.ServiceModel.Channels.BindingElementCollection(); System.ServiceModel.Channels.BinaryMessageEncodingBindingElement binaryMessageEncoding = new System.ServiceModel.Channels.BinaryMessageEncodingBindingElement(); binaryMessageEncoding.MessageVersion = System.ServiceModel.Channels.MessageVersion.Default; binaryMessageEncoding.ReaderQuotas.MaxArrayLength = this._maxArrayLength; binaryMessageEncoding.ReaderQuotas.MaxBytesPerRead = this._maxBytesPerRead; binaryMessageEncoding.ReaderQuotas.MaxDepth = this._maxDepth; binaryMessageEncoding.ReaderQuotas.MaxNameTableCharCount = this._maxNameTableCharCount; binaryMessageEncoding.ReaderQuotas.MaxStringContentLength = this._maxStringContentLength; elements.Add(binaryMessageEncoding); if (this._applyHttps) { System.ServiceModel.Channels.HttpsTransportBindingElement transport = new System.ServiceModel.Channels.HttpsTransportBindingElement() { MaxBufferSize = this._maxBufferSize, MaxReceivedMessageSize = this._maxReceivedMessageSize, AllowCookies = false, BypassProxyOnLocal = false, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, MaxBufferPoolSize = this._maxBufferPoolSize, TransferMode = TransferMode.Buffered, UseDefaultWebProxy = true, ProxyAddress = null, RequireClientCertificate = false }; elements.Add(transport); } else { System.ServiceModel.Channels.HttpTransportBindingElement transport = new System.ServiceModel.Channels.HttpTransportBindingElement() { MaxBufferSize = this._maxBufferSize, MaxReceivedMessageSize = this._maxReceivedMessageSize, }; elements.Add(transport); } System.ServiceModel.Channels.CustomBinding custB = new System.ServiceModel.Channels.CustomBinding(elements); custB.Name = pName; custB.SendTimeout = new TimeSpan(0, 2, 0); return custB; } ---------- And I configure the service host with this method: private void ConfigureBinaryService(ServiceHost pHost, Type pType, String pServiceName) { pHost.AddServiceEndpoint(pType, this.GetHttpBinding(pType.Name), String.Empty); pHost.AddServiceEndpoint(pType, this.GetNetTcpBinding(pType.Name), String.Empty); pHost.Description.Endpoints[0].Name = pType.Name + "_BasicBin"; pHost.Description.Endpoints[1].Name = pType.Name + "_TCP"; pHost.OpenTimeout = new TimeSpan(0, 2, 0); pHost.CloseTimeout = new TimeSpan(0, 2, 0); System.ServiceModel.Description.ServiceMetadataBehavior metadataBehavior = pHost.Description.Behaviors.Find<System.ServiceModel.Description.ServiceMetadataBehavior>(); if (metadataBehavior == null) { metadataBehavior = new System.ServiceModel.Description.ServiceMetadataBehavior(); pHost.Description.Behaviors.Add(metadataBehavior); } if (this._applyHttps) metadataBehavior.HttpsGetEnabled = true; else metadataBehavior.HttpGetEnabled = true; metadataBehavior.MetadataExporter.PolicyVersion = System.ServiceModel.Description.PolicyVersion.Policy15; if (this._applyHttps) pHost.AddServiceEndpoint(System.ServiceModel.Description.ServiceMetadataBehavior.MexContractName , System.ServiceModel.Description.MetadataExchangeBindings.CreateMexHttpsBinding(), "mex"); else pHost.AddServiceEndpoint(System.ServiceModel.Description.ServiceMetadataBehavior.MexContractName , System.ServiceModel.Description.MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); pHost.AddServiceEndpoint(System.ServiceModel.Description.ServiceMetadataBehavior.MexContractName , System.ServiceModel.Description.MetadataExchangeBindings.CreateMexTcpBinding(), this._NetTcpComm + @"/" + pServiceName + @"/mex"); pHost.Description.Endpoints[2].Name = pType.Name + "_mex_BasicBin"; pHost.Description.Endpoints[3].Name = pType.Name + "_mex_TCP"; foreach (var item in pHost.Description.Endpoints[0].Contract.Operations) item.Behaviors.Find<System.ServiceModel.Description.DataContractSerializerOperationBehavior>().MaxItemsInObjectGraph = System.Int32.MaxValue; foreach (var item in pHost.Description.Endpoints[1].Contract.Operations) item.Behaviors.Find<System.ServiceModel.Description.DataContractSerializerOperationBehavior>().MaxItemsInObjectGraph = System.Int32.MaxValue; System.ServiceModel.Description.ServiceDebugBehavior debugBehavior = pHost.Description.Behaviors.Find<System.ServiceModel.Description.ServiceDebugBehavior>(); if (debugBehavior == null) { debugBehavior = new System.ServiceModel.Description.ServiceDebugBehavior(); pHost.Description.Behaviors.Add(debugBehavior); } debugBehavior.IncludeExceptionDetailInFaults = true; } When this._applyHttps is false, my service is accessible both by browser and reference in WPF project. So I ask for help for the first time after enjoying for so long all your help without asking directly. What am I missing? As it's not hosted under IIS should I still need a cert to install on the server side only for the specific port? Thanks guys in advance! And if someone has already answered this case I'm sorry for not finding it...
0
11,472,495
07/13/2012 14:26:47
1,331,671
04/13/2012 13:17:10
39
4
Remove Labels in a Django Crispy Forms
does anybody know if there is a correct way to remove labels in a crispy form? I got as far as this: self.fields['field'].label = "" But it's not a very nice solution... Thanks :) Ron
django
forms
label
django-crispy-forms
null
null
open
Remove Labels in a Django Crispy Forms === does anybody know if there is a correct way to remove labels in a crispy form? I got as far as this: self.fields['field'].label = "" But it's not a very nice solution... Thanks :) Ron
0
11,472,496
07/13/2012 14:26:50
625,936
02/21/2011 03:38:39
42
2
where is com.google.android.gcm.GCMBaseIntentService?
I'm following the tutorial on GCM here http://developer.android.com/guide/google/gcm/gs.html At point 5 of **Step 2**, it says: -- Add the following intent service: service android:name=".GCMIntentService" This intent service will be called by the GCMBroadcastReceiver (which is is provided by GCM library), as shown in the next step. It must be a subclass of com.google.android.gcm.GCMBaseIntentService, must contain a public constructor, and should be named my_app_package.GCMIntentService (unless you use a subclass of GCMBroadcastReceiver that overrides the method used to name the service). --- However, I can't subclass com.google.android.gcm.GCMBaseIntentService, the import can't be resolved. How do I fix this? Tks in advance.
android
android-gcm
null
null
null
null
open
where is com.google.android.gcm.GCMBaseIntentService? === I'm following the tutorial on GCM here http://developer.android.com/guide/google/gcm/gs.html At point 5 of **Step 2**, it says: -- Add the following intent service: service android:name=".GCMIntentService" This intent service will be called by the GCMBroadcastReceiver (which is is provided by GCM library), as shown in the next step. It must be a subclass of com.google.android.gcm.GCMBaseIntentService, must contain a public constructor, and should be named my_app_package.GCMIntentService (unless you use a subclass of GCMBroadcastReceiver that overrides the method used to name the service). --- However, I can't subclass com.google.android.gcm.GCMBaseIntentService, the import can't be resolved. How do I fix this? Tks in advance.
0
11,650,973
07/25/2012 13:35:00
1,513,168
07/09/2012 21:35:10
34
0
How to "cd" to a directory after "grep"?
I want to find a directory using `grep` then change current directory to the resulting directory. For example: $ ls | grep 1670 | finds me directory haib12CJS1670. I am trying to do something like below: $ ls | grep 1670 | cd so that my directory is set to haib12CJS1670 at a single step. Obviously my way is not working. Any suggestions? Thank you
unix
terminal
null
null
null
07/27/2012 04:16:05
off topic
How to "cd" to a directory after "grep"? === I want to find a directory using `grep` then change current directory to the resulting directory. For example: $ ls | grep 1670 | finds me directory haib12CJS1670. I am trying to do something like below: $ ls | grep 1670 | cd so that my directory is set to haib12CJS1670 at a single step. Obviously my way is not working. Any suggestions? Thank you
2
11,650,928
07/25/2012 13:32:46
765,409
05/23/2011 03:58:39
363
5
VTK: I lose color information when I use the vtkOBJReader or vtkPLYReader, how to I display 3D images with this information?
If I use the vtkOBJReader, all that gets displayed is the wavefront OBJ (understandable, as the color and lighting information is stored in the accompanying MTL file, however I only see the geometry image if I use the vtkPLYReader even though PLY does store color information, is there any way to display this using just the vtk library?
c++
3d
vtk
null
null
null
open
VTK: I lose color information when I use the vtkOBJReader or vtkPLYReader, how to I display 3D images with this information? === If I use the vtkOBJReader, all that gets displayed is the wavefront OBJ (understandable, as the color and lighting information is stored in the accompanying MTL file, however I only see the geometry image if I use the vtkPLYReader even though PLY does store color information, is there any way to display this using just the vtk library?
0
11,650,982
07/25/2012 13:35:17
1,453,711
06/13/2012 13:07:14
8
1
Ease in 3 lines text
i would like to show three lines from a certain text with timestamp, but with ease in animation, my idea would be to show 3 lines of a document and they will replace each other with ease. **For example:** [0:02]Line 1 [0:03]Line 2 [0:04]Line 3 In the second 2: (empty) Line 1 -highlighted line- Line 2 In the second 3: Line 1 Line 2 -highlighted line- Line 3 In the second 3: Line 2 Line 3 -highlighted line- (empty) I amange to change everyline in the right time, but i would like to ease it for better view. something like a Karaoke. Thanks
flash
flex
actionscript
null
null
null
open
Ease in 3 lines text === i would like to show three lines from a certain text with timestamp, but with ease in animation, my idea would be to show 3 lines of a document and they will replace each other with ease. **For example:** [0:02]Line 1 [0:03]Line 2 [0:04]Line 3 In the second 2: (empty) Line 1 -highlighted line- Line 2 In the second 3: Line 1 Line 2 -highlighted line- Line 3 In the second 3: Line 2 Line 3 -highlighted line- (empty) I amange to change everyline in the right time, but i would like to ease it for better view. something like a Karaoke. Thanks
0
11,650,760
07/25/2012 13:24:48
1,262,131
03/11/2012 10:37:46
34
0
how to use controls in nested master page?
In my main Master page i have: <html> <head runat="server"> <title>Master Page</title> </head> <body> <form runat="server"> <div> <table cellpadding="0" cellspacing="0" style="width: 100%"> <tr> <td align="center"><img src="images/download.jpg" alt="manipallogo" /></td> <td align="center" valign="middle"><h2 style="font-style:normal;font-size:x-large">Mobility Sanjivini</h2></td> <td align="center"><img src="images/philips.jpg" alt="philipslogo" height="84" width="170" /></td> </tr> <tr> <td colspan="1"> <asp:ContentPlaceHolder runat="server" ID="cntplace1"></asp:ContentPlaceHolder></td> <td colspan="2"> <asp:ContentPlaceHolder runat="server" ID="ContentPlaceHolder2"></asp:ContentPlaceHolder> </td> </tr> </table> </div> </form> </body> </html> Nested Masted Page: <asp:Content ID="Content1" ContentPlaceHolderID="cntplace1" Runat="Server"> <table width="100%"> <tr> <td><asp:Label runat="server" ID="lblImmu" Text="Immunization Details"></asp:Label></td></tr> <tr><td><asp:Label runat="server" ID="lblDel" Text="Immunization Details"></asp:Label></td></tr> <tr><td><asp:Label runat="server" ID="lblMal" Text="Immunization Details"></asp:Label></td></tr> </table> </asp:Content> but When i run, Nested page Labels are not displayed. Please someone tell me where i am going wrong.
c#
asp.net
null
null
null
null
open
how to use controls in nested master page? === In my main Master page i have: <html> <head runat="server"> <title>Master Page</title> </head> <body> <form runat="server"> <div> <table cellpadding="0" cellspacing="0" style="width: 100%"> <tr> <td align="center"><img src="images/download.jpg" alt="manipallogo" /></td> <td align="center" valign="middle"><h2 style="font-style:normal;font-size:x-large">Mobility Sanjivini</h2></td> <td align="center"><img src="images/philips.jpg" alt="philipslogo" height="84" width="170" /></td> </tr> <tr> <td colspan="1"> <asp:ContentPlaceHolder runat="server" ID="cntplace1"></asp:ContentPlaceHolder></td> <td colspan="2"> <asp:ContentPlaceHolder runat="server" ID="ContentPlaceHolder2"></asp:ContentPlaceHolder> </td> </tr> </table> </div> </form> </body> </html> Nested Masted Page: <asp:Content ID="Content1" ContentPlaceHolderID="cntplace1" Runat="Server"> <table width="100%"> <tr> <td><asp:Label runat="server" ID="lblImmu" Text="Immunization Details"></asp:Label></td></tr> <tr><td><asp:Label runat="server" ID="lblDel" Text="Immunization Details"></asp:Label></td></tr> <tr><td><asp:Label runat="server" ID="lblMal" Text="Immunization Details"></asp:Label></td></tr> </table> </asp:Content> but When i run, Nested page Labels are not displayed. Please someone tell me where i am going wrong.
0
11,650,986
07/25/2012 13:35:25
1,269,091
03/14/2012 13:22:13
94
11
Weird Batch File Issue
Can someone help me with this one? I have a batch file, where I am trying to connect a couple network drives based on my current internal IP address. Problem is, it is outputting the following: Home 192.168.2.99 Basement Where it should be just outputting: Home 192.168.2.99 Here's the code: @echo off @for /F "tokens=2 delims=:" %%i in ('"ipconfig | findstr IP | findstr 192."') do SET LOCAL_IP=%%i @if ("%LOCAL_IP%" == "192.168.2.99") Call ConnectHome else (Call ConnectBasement) :ConnectHome @echo Home %LOCAL_IP% :ConnectBasement @echo Basement @REM net use R: \\192.168.2.98\Storage @REM net use S: \\192.168.2.98\MyStuff @REM net use T: \\192.168.2.98\Server I've also tried replacing the IF statement with: @if ("%LOCAL_IP%" == "192.168.2.99") goto ConnectHome else (goto ConnectBasement) and: @if ("%LOCAL_IP%" == "192.168.2.99") goto :ConnectHome else (goto :ConnectBasement) and the results are always the same... OS is Windows 7 Pro
windows
windows-7
batch-file
windows-7-x64
null
null
open
Weird Batch File Issue === Can someone help me with this one? I have a batch file, where I am trying to connect a couple network drives based on my current internal IP address. Problem is, it is outputting the following: Home 192.168.2.99 Basement Where it should be just outputting: Home 192.168.2.99 Here's the code: @echo off @for /F "tokens=2 delims=:" %%i in ('"ipconfig | findstr IP | findstr 192."') do SET LOCAL_IP=%%i @if ("%LOCAL_IP%" == "192.168.2.99") Call ConnectHome else (Call ConnectBasement) :ConnectHome @echo Home %LOCAL_IP% :ConnectBasement @echo Basement @REM net use R: \\192.168.2.98\Storage @REM net use S: \\192.168.2.98\MyStuff @REM net use T: \\192.168.2.98\Server I've also tried replacing the IF statement with: @if ("%LOCAL_IP%" == "192.168.2.99") goto ConnectHome else (goto ConnectBasement) and: @if ("%LOCAL_IP%" == "192.168.2.99") goto :ConnectHome else (goto :ConnectBasement) and the results are always the same... OS is Windows 7 Pro
0
11,650,991
07/25/2012 13:35:41
891,380
08/12/2011 08:09:37
52
2
accessing and sorting array objects in json using javascript
I’m playing around with json objects in javascript and wanted see if someone could help me out with a problem My json file contains a list of hash objects containing a key (id) and the value being an array of [ ipaddress, timestamp, url] e.g. {"output": { "1":["10.0.0.1","2012-07-11T11:41:42+01:00","http://myurl.com"], "2":["10.0.0.1","2012-07-11T11:45:42+01:00","http://myurl2.com"], "3":["192.168.1.1","2012-07-11T11:41:47+01:00","http://myurl3.com"] } } What I want to do is be able to sort on the contents of the arrays For example I’d like to go through the json and pull out the highest timestamp for each ip address So an example output for the json above would look like:- 10.0.0.1 - http://myurl2.com 192.168.1.1 - http://myurl3.com At the moment I have a simple function to output the raw data in a div, but I’m sure I could handle the arrays better var displayOutput = function(data){ var container = $("#fragment-1"); var body = “”; $.each(data.output, function(key, val) { var arr = val.toString().split(","); body = body + arr[0]+ ' - ' + arr[1]) + ' - ' + arr[2] }); container.html(body); };
javascript
json
null
null
null
null
open
accessing and sorting array objects in json using javascript === I’m playing around with json objects in javascript and wanted see if someone could help me out with a problem My json file contains a list of hash objects containing a key (id) and the value being an array of [ ipaddress, timestamp, url] e.g. {"output": { "1":["10.0.0.1","2012-07-11T11:41:42+01:00","http://myurl.com"], "2":["10.0.0.1","2012-07-11T11:45:42+01:00","http://myurl2.com"], "3":["192.168.1.1","2012-07-11T11:41:47+01:00","http://myurl3.com"] } } What I want to do is be able to sort on the contents of the arrays For example I’d like to go through the json and pull out the highest timestamp for each ip address So an example output for the json above would look like:- 10.0.0.1 - http://myurl2.com 192.168.1.1 - http://myurl3.com At the moment I have a simple function to output the raw data in a div, but I’m sure I could handle the arrays better var displayOutput = function(data){ var container = $("#fragment-1"); var body = “”; $.each(data.output, function(key, val) { var arr = val.toString().split(","); body = body + arr[0]+ ' - ' + arr[1]) + ' - ' + arr[2] }); container.html(body); };
0
11,650,996
07/25/2012 13:36:01
1,474,263
06/22/2012 08:33:29
1
0
R Generating a 5 min spaced time sequence
I would like to generate a 1 min spaced time sequence to paste then to a xts object. Basically, I've got a tick-by-tick dateTime object like that : [1] "2010-02-02 08:00:03 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" [6] "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:05 CET" "2010-02-02 08:00:05 CET" "2010-02-02 08:00:05 CET" I'm aggregating my xts series (by previous tick) to get a 1 min (equally)-spaced time series using : price_1m<-aggregatets(price,FUN="previoustick",k=1,on="minutes") The problem is that the time label is not aggregated that is the aggregated series is not labeled by a 1 min spaced time-object. Is it possible to keep a relevant aggregated time label? If not how can i create a 1 min spaced time sequence? Thanks.
r
physics
time-series
finance
xts
null
open
R Generating a 5 min spaced time sequence === I would like to generate a 1 min spaced time sequence to paste then to a xts object. Basically, I've got a tick-by-tick dateTime object like that : [1] "2010-02-02 08:00:03 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" [6] "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:05 CET" "2010-02-02 08:00:05 CET" "2010-02-02 08:00:05 CET" I'm aggregating my xts series (by previous tick) to get a 1 min (equally)-spaced time series using : price_1m<-aggregatets(price,FUN="previoustick",k=1,on="minutes") The problem is that the time label is not aggregated that is the aggregated series is not labeled by a 1 min spaced time-object. Is it possible to keep a relevant aggregated time label? If not how can i create a 1 min spaced time sequence? Thanks.
0
11,594,506
07/21/2012 17:46:38
1,292,190
03/26/2012 04:41:44
6
0
How to create WritebleBitmap from a resource image with C++ for Windows Metro app?
I can easily create a BitmapImage from a resource JPG image file using the following code... Windows::Foundation::Uri^ uri = ref new Windows::Foundation::Uri(L"ms-appx:///Hippo.JPG"); Imaging::BitmapImage^ image = ref new Imaging::BitmapImage(uri); But WritableBitmap does not take an Uri. I see a SetSource method, but that needs a IRandomaccessStream and not an Uri. And I have no clue how to create one from a JPG file. I searched the net over and over again, but could not find a straight forward answer. Any help would be greatly appreciated. I want something like this... Windows::UI::Xaml::Media::Imaging::WriteableBitmap image = ref new Windows::UI::Xaml::Media::Imaging::WriteableBitmap(); image->SetSource(somehowGetRandomAccessStreamFromUri); But, how do I get the IRandomaccessStream instance from a uri? I started working on C++ Metro app only today, so might be wrong, but I find it to be overly complicated with too much or onion peeling.
c++
windows-8
microsoft-metro
imaging
null
null
open
How to create WritebleBitmap from a resource image with C++ for Windows Metro app? === I can easily create a BitmapImage from a resource JPG image file using the following code... Windows::Foundation::Uri^ uri = ref new Windows::Foundation::Uri(L"ms-appx:///Hippo.JPG"); Imaging::BitmapImage^ image = ref new Imaging::BitmapImage(uri); But WritableBitmap does not take an Uri. I see a SetSource method, but that needs a IRandomaccessStream and not an Uri. And I have no clue how to create one from a JPG file. I searched the net over and over again, but could not find a straight forward answer. Any help would be greatly appreciated. I want something like this... Windows::UI::Xaml::Media::Imaging::WriteableBitmap image = ref new Windows::UI::Xaml::Media::Imaging::WriteableBitmap(); image->SetSource(somehowGetRandomAccessStreamFromUri); But, how do I get the IRandomaccessStream instance from a uri? I started working on C++ Metro app only today, so might be wrong, but I find it to be overly complicated with too much or onion peeling.
0
11,594,507
07/21/2012 17:46:40
1,298,426
03/28/2012 14:23:19
1
0
GRAILS 2.0 Exception :- java.lang.VerifyError: (class: xls/Recruitment, method: initErrors signature: ()V) Unable to pop operand off an empty stack
I am trying to run grails application and I get below exception SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener **org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: (class: xls/Recruitment, method: initErrors signature: ()V) Unable to pop operand off an empty stack** at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) **Caused by: java.lang.VerifyError: (class: xls/Recruitment, method: initErrors signature: ()V) Unable to pop operand off an empty stack** at java.lang.Class.forName(Class.java:247) ... 5 more I am using grails 2.0 and Recruitment class mentioned in the exception is domain class. package xls class Recruitment implements Serializable { String id String position String candidateName String noticePeriod String hrAgencyName String cellPhone String profileSourcingData String totalWorkExperience String emailAddress String currentCTC String expectedCTC String currentPosition String currentOrganisationName String communication String bankingOrFinancialDomainKnowledge String clientManagementExperience String reasonForChange String firstInterviewBy String secondInterviewBy String interviewStatus String offerDate String expectedDateOfJoining String joiningTeamName static constraints = { position(blank:true, nullable:true) candidateName(blank:true, nullable:true) noticePeriod(blank:true, nullable:true) hrAgencyName(blank:true, nullable:true) cellPhone(blank:true, nullable:true) profileSourcingData(blank:true, nullable:true) emailAddress(blank:true, nullable:true) totalWorkExperience(blank:true, nullable:true) currentCTC(blank:true, nullable:true) expectedCTC(blank:true, nullable:true) currentPosition(blank:true, nullable:true) currentOrganisationName(blank:true, nullable:true) communication(blank:true, nullable:true) bankingOrFinancialDomainKnowledge(blank:true, nullable:true) clientManagementExperience(blank:true, nullable:true) reasonForChange(blank:true, nullable:true) firstInterviewBy(blank:true, nullable:true) secondInterviewBy(blank:true, nullable:true) interviewStatus(blank:true, nullable:true) offerDate(blank:true, nullable:true) expectedDateOfJoining(blank:true, nullable:true) joiningTeamName(blank:true, nullable:true) } static mapping = { id generator:'assigned' } }
grails
null
null
null
null
null
open
GRAILS 2.0 Exception :- java.lang.VerifyError: (class: xls/Recruitment, method: initErrors signature: ()V) Unable to pop operand off an empty stack === I am trying to run grails application and I get below exception SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener **org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.VerifyError: (class: xls/Recruitment, method: initErrors signature: ()V) Unable to pop operand off an empty stack** at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) **Caused by: java.lang.VerifyError: (class: xls/Recruitment, method: initErrors signature: ()V) Unable to pop operand off an empty stack** at java.lang.Class.forName(Class.java:247) ... 5 more I am using grails 2.0 and Recruitment class mentioned in the exception is domain class. package xls class Recruitment implements Serializable { String id String position String candidateName String noticePeriod String hrAgencyName String cellPhone String profileSourcingData String totalWorkExperience String emailAddress String currentCTC String expectedCTC String currentPosition String currentOrganisationName String communication String bankingOrFinancialDomainKnowledge String clientManagementExperience String reasonForChange String firstInterviewBy String secondInterviewBy String interviewStatus String offerDate String expectedDateOfJoining String joiningTeamName static constraints = { position(blank:true, nullable:true) candidateName(blank:true, nullable:true) noticePeriod(blank:true, nullable:true) hrAgencyName(blank:true, nullable:true) cellPhone(blank:true, nullable:true) profileSourcingData(blank:true, nullable:true) emailAddress(blank:true, nullable:true) totalWorkExperience(blank:true, nullable:true) currentCTC(blank:true, nullable:true) expectedCTC(blank:true, nullable:true) currentPosition(blank:true, nullable:true) currentOrganisationName(blank:true, nullable:true) communication(blank:true, nullable:true) bankingOrFinancialDomainKnowledge(blank:true, nullable:true) clientManagementExperience(blank:true, nullable:true) reasonForChange(blank:true, nullable:true) firstInterviewBy(blank:true, nullable:true) secondInterviewBy(blank:true, nullable:true) interviewStatus(blank:true, nullable:true) offerDate(blank:true, nullable:true) expectedDateOfJoining(blank:true, nullable:true) joiningTeamName(blank:true, nullable:true) } static mapping = { id generator:'assigned' } }
0
11,594,510
07/21/2012 17:46:48
1,084,353
12/06/2011 20:49:29
84
0
How to insert array into hashtable w/o initializing in Java?
I have a hashmap initialized as follows: Hashmap<String[][], Boolean> tests = new Hashmap<String [][], Boolean>(); I would like to insert into tests without having to initialize the key: tests.put({{"a"}, {"a"}}, true); However, Java doesn't seem to let me do this. It works if I do it like this: String[][] hi = {{"a"}, {"a"}}; tests.put(hi, true); Is there any way to avoid the latter and get the former working? Can someone also explain the reasoning behind this error? Thanks
java
arrays
hash
initialization
hashmap
null
open
How to insert array into hashtable w/o initializing in Java? === I have a hashmap initialized as follows: Hashmap<String[][], Boolean> tests = new Hashmap<String [][], Boolean>(); I would like to insert into tests without having to initialize the key: tests.put({{"a"}, {"a"}}, true); However, Java doesn't seem to let me do this. It works if I do it like this: String[][] hi = {{"a"}, {"a"}}; tests.put(hi, true); Is there any way to avoid the latter and get the former working? Can someone also explain the reasoning behind this error? Thanks
0
11,594,512
07/21/2012 17:47:03
349,060
05/24/2010 15:04:04
55
0
Generating random values in PHP
I am quite a newbie when it comes to php and i wanted to try something but i have absolutely no idea how should i do this.. To be honest i am not sure if can explain this to you very clearly either.. Lets get started.. I have couple of letters for example a, b, c, d and e.. and for each one of them i have couples of two-charactered values like this: a -> fg, dz, gc, bg b -> zt, hg, oq, vg, gb c -> lt, pr, cs, sh, pr d -> kt, nt, as, pr e -> zd, ke, cg, sq, mo, ld Here comes the question: I would like to get a random value for each time for example: dcbae and for this the ultimate output should be something like this: ntshztdzld or asltvggcmo.. (After generating a random string with the charachters above (between a-e), i should generate another string that contains random values those are related with the each character.. This is not a homework or something similar. I am a little bit interested in encryption and would like to know how to do sth like this. Thanks in advence for your understanding..
php
arrays
encryption
null
null
null
open
Generating random values in PHP === I am quite a newbie when it comes to php and i wanted to try something but i have absolutely no idea how should i do this.. To be honest i am not sure if can explain this to you very clearly either.. Lets get started.. I have couple of letters for example a, b, c, d and e.. and for each one of them i have couples of two-charactered values like this: a -> fg, dz, gc, bg b -> zt, hg, oq, vg, gb c -> lt, pr, cs, sh, pr d -> kt, nt, as, pr e -> zd, ke, cg, sq, mo, ld Here comes the question: I would like to get a random value for each time for example: dcbae and for this the ultimate output should be something like this: ntshztdzld or asltvggcmo.. (After generating a random string with the charachters above (between a-e), i should generate another string that contains random values those are related with the each character.. This is not a homework or something similar. I am a little bit interested in encryption and would like to know how to do sth like this. Thanks in advence for your understanding..
0
11,594,513
07/21/2012 17:47:05
1,543,005
07/21/2012 17:34:55
1
0
an idiomatic way to initialize a Scala ArrayBuffer?
I would like to initialize an ArrayBuffer with value -1 in indexes 0 through 99. Is there a simple, idiomatic way to do so? This works, but it's a bit crufty: > val a = new ArrayBuffer[Int]() > a.appendAll(Nil.padTo(100, -1)) I'd like to see something more like this: > val a = ArrayBuffer(List(-1) * 100)
scala
null
null
null
null
null
open
an idiomatic way to initialize a Scala ArrayBuffer? === I would like to initialize an ArrayBuffer with value -1 in indexes 0 through 99. Is there a simple, idiomatic way to do so? This works, but it's a bit crufty: > val a = new ArrayBuffer[Int]() > a.appendAll(Nil.padTo(100, -1)) I'd like to see something more like this: > val a = ArrayBuffer(List(-1) * 100)
0
11,594,514
07/21/2012 17:47:05
1,345,376
04/20/2012 00:55:53
354
4
how to pipe commands in ubuntu
How do I pipe commands and their results in ubuntu when writing them in the terminal. I would write the following commands in sequence - 1) ls | grep ab >> abc.pdf cde.pdf 2) cp abc.pdf cde.pdf files/ I would like to pipe the results of the first command into the second command, and write them all in the same line. How do I do that ? something like cp "ls | grep ab" files/ (the above is a contrived example and can be written as cp *.pdf files/) Thanks, Murtaza
shell
ubuntu
null
null
null
null
open
how to pipe commands in ubuntu === How do I pipe commands and their results in ubuntu when writing them in the terminal. I would write the following commands in sequence - 1) ls | grep ab >> abc.pdf cde.pdf 2) cp abc.pdf cde.pdf files/ I would like to pipe the results of the first command into the second command, and write them all in the same line. How do I do that ? something like cp "ls | grep ab" files/ (the above is a contrived example and can be written as cp *.pdf files/) Thanks, Murtaza
0
11,594,518
07/21/2012 17:47:41
1,520,544
07/12/2012 10:56:14
1
0
Creating current user cookie in rails application
app/helpers/sessions_helper.rb module SessionHelper def sign_in(user) cookies.permanent[:remember_token] = user.remember_token self.current_user = user end def signed_in? !current_user.nil? end def current_user=(user) @current_user = user end def current_user @current_user ||= User.find_by_remember_token(cookies[:remember_token]) end end when i am running the test"bundle exec rspec spec/"..getting following error..even before this all test were getting pass... 1) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa17b218> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' 2) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa689ad4> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' 3) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa5919d8> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' 4) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa4f761c> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' Finished in 2.03 seconds 46 examples, 4 failures it is showing the error regarding authentication page...but i didn't get error before abt this..and this time i didn't touch this file.. what is the wrong..
ruby-on-rails
application
null
null
null
null
open
Creating current user cookie in rails application === app/helpers/sessions_helper.rb module SessionHelper def sign_in(user) cookies.permanent[:remember_token] = user.remember_token self.current_user = user end def signed_in? !current_user.nil? end def current_user=(user) @current_user = user end def current_user @current_user ||= User.find_by_remember_token(cookies[:remember_token]) end end when i am running the test"bundle exec rspec spec/"..getting following error..even before this all test were getting pass... 1) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa17b218> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' 2) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa689ad4> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' 3) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa5919d8> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' 4) Authentication signin with valid information Failure/Error: click_button "Sign in" NoMethodError: undefined method `sign_in' for #<SessionsController:0xa4f761c> # ./app/controllers/sessions_controller.rb:10:in `create' # (eval):2:in `click_button' # ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>' Finished in 2.03 seconds 46 examples, 4 failures it is showing the error regarding authentication page...but i didn't get error before abt this..and this time i didn't touch this file.. what is the wrong..
0
11,594,520
07/21/2012 17:48:04
1,543,010
07/21/2012 17:38:41
1
0
Python items from list to other list: weird results
I'm trying to transfer items from one list to the other (like below) but the result is really puzzling. Does anyone have an idea what's going on here?? l1=range(1,11) l2=[] for i in l1: if i>=6: l2.append(i) l1.remove(i) print l1 print l2 l1= [1-5, 7, 9] and l2= [6, 8, 10]!!
python
list
remove
append
null
null
open
Python items from list to other list: weird results === I'm trying to transfer items from one list to the other (like below) but the result is really puzzling. Does anyone have an idea what's going on here?? l1=range(1,11) l2=[] for i in l1: if i>=6: l2.append(i) l1.remove(i) print l1 print l2 l1= [1-5, 7, 9] and l2= [6, 8, 10]!!
0
11,594,522
07/21/2012 17:48:33
1,154,885
01/17/2012 21:10:02
10
0
Mysql maximum rows in a variable timeframe
I'm making a fitness logbook where indoor rowers can log there results. To make it interesting and motivating I'm implementing an achievement system. I like to have an achievement that if someone rows more than 90 times within 24 weeks they get that achievement. Does anybody have some hints in how i can implement this in MYSQL. The mysql-table for the logbook is pretty straightforward: id, userid, date (timestamp),etc (rest is omitted because it doesn't really matter) The jist is that the first rowdate and the last one can't exceed the 24 weeks.
mysql
date
count
timestamp
null
null
open
Mysql maximum rows in a variable timeframe === I'm making a fitness logbook where indoor rowers can log there results. To make it interesting and motivating I'm implementing an achievement system. I like to have an achievement that if someone rows more than 90 times within 24 weeks they get that achievement. Does anybody have some hints in how i can implement this in MYSQL. The mysql-table for the logbook is pretty straightforward: id, userid, date (timestamp),etc (rest is omitted because it doesn't really matter) The jist is that the first rowdate and the last one can't exceed the 24 weeks.
0
11,410,954
07/10/2012 10:05:29
411,520
08/03/2010 08:01:34
246
25
JAXB alternative on Android for XML Schema?
Is there any lightweight library for Android that acts like JAXB on the desktop? Give an XML schema, create code to parse, validate, manipulate and then again write it. The files already exist and since it's a finance application nothing that isn't modified must be touched. Including whitespace, ordering and character encoding. (I'm doing this for years with JAXB and it works fine but I can't port that code to Android due to the lack of JAXB and it's footprint.)
android
xml
jaxb
xml-schema
null
null
open
JAXB alternative on Android for XML Schema? === Is there any lightweight library for Android that acts like JAXB on the desktop? Give an XML schema, create code to parse, validate, manipulate and then again write it. The files already exist and since it's a finance application nothing that isn't modified must be touched. Including whitespace, ordering and character encoding. (I'm doing this for years with JAXB and it works fine but I can't port that code to Android due to the lack of JAXB and it's footprint.)
0
11,410,955
07/10/2012 10:05:29
1,506,589
07/06/2012 11:25:51
1
0
JavaScript simple echo/print query
I know this is basic stuff, but after hours of research on google, this site and others I simply cannot come up with an explanation of why this code wouldnt work. And it doesnt. Can someone please spot the mistake? many thanks in advance: The JavaScript bit: <script language="text/JavaScript"> function myFunction() { var date1; date1=getElementByID("date1").value; document.getElementByID("calculate").innerHTML=date1; } </script> The HTML bit (that definitely works and its a rather large file with loads of forms, tables) <form> <table> <tr> <th bgcolor="#eeeee" width=12.5%><input type=time id="date1" value="09:00" size=15></td></th></tr></table></form> <table> <tr> <th bgcolor="#eeaaaa" align=center><em></em> <input type=text id=pay id="calculate" size=15></th></tr></table> I tried different things already, changing the syntax, clearing the clutter out, but nothing seems to work. I appreciate any constructive comments/criticism. Thanks
javascript
html
forms
input
null
null
open
JavaScript simple echo/print query === I know this is basic stuff, but after hours of research on google, this site and others I simply cannot come up with an explanation of why this code wouldnt work. And it doesnt. Can someone please spot the mistake? many thanks in advance: The JavaScript bit: <script language="text/JavaScript"> function myFunction() { var date1; date1=getElementByID("date1").value; document.getElementByID("calculate").innerHTML=date1; } </script> The HTML bit (that definitely works and its a rather large file with loads of forms, tables) <form> <table> <tr> <th bgcolor="#eeeee" width=12.5%><input type=time id="date1" value="09:00" size=15></td></th></tr></table></form> <table> <tr> <th bgcolor="#eeaaaa" align=center><em></em> <input type=text id=pay id="calculate" size=15></th></tr></table> I tried different things already, changing the syntax, clearing the clutter out, but nothing seems to work. I appreciate any constructive comments/criticism. Thanks
0
11,410,960
07/10/2012 10:05:48
1,193,596
02/07/2012 00:53:01
316
11
User Permission Mask from NetworkCredentials
Although I am currently developing this WinForms application on our Sharepoint server I intend for the finished program to function from any computer on the Domain. I'm using the WSS web services to get all the information I use from Sharepoint. I have written some code which will check Sharepoint Permission masks, with logical OR against mask, for all the permissions it covers but I am having trouble returning the Sharepoint mask for the current user. I would like users to be able to log right in through Windows Authentication so this was my immediate idea. NetworkCredential credentails = CredentialCache.DefaultNetworkCredentials; var userInfo = userGroupService.GetUserInfo(credentails.UserName); However although I am able to return the permission collection for the entire Sharepoint site with `DefaultNetworkCredentials` (as in bellow snippet) the properties are empty strings, so I can't use it to get the UserName. permissionService.Credentials = CredentialCache.DefaultNetworkCredentials; permissionService.Url = "http://localhost/mySite/_vti_bin/Permissions.asmx"; // Web service request works XmlNode node = permissionService.GetPermissionCollection(siteName, "Web"); // But I need to identify current user from this collection somehow still I read that Windows Authentication suffers from a [double-hop issue](http://weblogs.asp.net/owscott/archive/2008/08/22/iis-windows-authentication-and-the-double-hop-issue.aspx), which I want to avoid, but as I am developing on the server Sharepoint & IIS are running, I can't see this causing an immediate issue. Is there a way around this or a better way to get the current users permission mask?
c#
sharepoint
wss-3.0
networkcredentials
null
null
open
User Permission Mask from NetworkCredentials === Although I am currently developing this WinForms application on our Sharepoint server I intend for the finished program to function from any computer on the Domain. I'm using the WSS web services to get all the information I use from Sharepoint. I have written some code which will check Sharepoint Permission masks, with logical OR against mask, for all the permissions it covers but I am having trouble returning the Sharepoint mask for the current user. I would like users to be able to log right in through Windows Authentication so this was my immediate idea. NetworkCredential credentails = CredentialCache.DefaultNetworkCredentials; var userInfo = userGroupService.GetUserInfo(credentails.UserName); However although I am able to return the permission collection for the entire Sharepoint site with `DefaultNetworkCredentials` (as in bellow snippet) the properties are empty strings, so I can't use it to get the UserName. permissionService.Credentials = CredentialCache.DefaultNetworkCredentials; permissionService.Url = "http://localhost/mySite/_vti_bin/Permissions.asmx"; // Web service request works XmlNode node = permissionService.GetPermissionCollection(siteName, "Web"); // But I need to identify current user from this collection somehow still I read that Windows Authentication suffers from a [double-hop issue](http://weblogs.asp.net/owscott/archive/2008/08/22/iis-windows-authentication-and-the-double-hop-issue.aspx), which I want to avoid, but as I am developing on the server Sharepoint & IIS are running, I can't see this causing an immediate issue. Is there a way around this or a better way to get the current users permission mask?
0
11,410,961
07/10/2012 10:05:50
1,228,957
02/23/2012 17:14:46
41
0
MySQL error with dates
MySQL tells me I have a wrong syntax, but I don't know where. Can anyone help me? $dt = $xml->item->parameter[2]; $to = date('Y-m-d H:i:s',strtotime($dt)); $query = sprintf("select * from me,val where group_id=%s AND m_id= me_id AND time_stamp <= $to",mysql_real_escape_string($gid)); $result= mysql_query($query) or die(mysql_error()); while ($row=mysql_fetch_array($result)){ The parsing to a date works. Thanks in advance. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '23:59:59' at line 1
php
mysql
null
null
null
null
open
MySQL error with dates === MySQL tells me I have a wrong syntax, but I don't know where. Can anyone help me? $dt = $xml->item->parameter[2]; $to = date('Y-m-d H:i:s',strtotime($dt)); $query = sprintf("select * from me,val where group_id=%s AND m_id= me_id AND time_stamp <= $to",mysql_real_escape_string($gid)); $result= mysql_query($query) or die(mysql_error()); while ($row=mysql_fetch_array($result)){ The parsing to a date works. Thanks in advance. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '23:59:59' at line 1
0
11,410,963
07/10/2012 10:05:51
1,514,242
07/10/2012 08:50:52
1
0
Python socket Buffering: Message Framing
I am receiving the data stream(46 Bytes) from external hardware(Zigbee receiver) to PC on a TCP/IP socket. Then by using Python programming,iam trying to extract the message from the received data stream from TCP/IP socket. my python source code and extracted data from the data stream, given in the bellow link https://docs.google.com/document/pub?id=1pYASqImWm4HkKrDbeeal8fTBsh_GojBQLXixxbMQBlU As we know "TCP/IP operate on stream of data, never by packets" i could able extract the data, if i received the complete packet in a single stream. but some times, the single packet is received in two data streams(broken), that time i couldn't extract my message from the stream. i am not more familier with python programming, so can anyone help me to slove this problem. I am looking for any good example(programming) to manage the breaking of incomming data stream on a TCP/IP socket, by storing those stream in a buffer as complete packet and then extract the message by using delimiters. Thanks in advance
python
null
null
null
null
null
open
Python socket Buffering: Message Framing === I am receiving the data stream(46 Bytes) from external hardware(Zigbee receiver) to PC on a TCP/IP socket. Then by using Python programming,iam trying to extract the message from the received data stream from TCP/IP socket. my python source code and extracted data from the data stream, given in the bellow link https://docs.google.com/document/pub?id=1pYASqImWm4HkKrDbeeal8fTBsh_GojBQLXixxbMQBlU As we know "TCP/IP operate on stream of data, never by packets" i could able extract the data, if i received the complete packet in a single stream. but some times, the single packet is received in two data streams(broken), that time i couldn't extract my message from the stream. i am not more familier with python programming, so can anyone help me to slove this problem. I am looking for any good example(programming) to manage the breaking of incomming data stream on a TCP/IP socket, by storing those stream in a buffer as complete packet and then extract the message by using delimiters. Thanks in advance
0
11,410,976
07/10/2012 10:06:32
1,179,960
01/31/2012 09:30:20
53
0
django pdf with logo image
I have created Invoice Pdf text template using pisa. But I want to display logo(image) in the pdf file along with the text.My views as follows: def generate_invoice(request, user_id = None): personal_html = '' personal_html += 'hai' fileread = str(settings.TEMPLATE_DIRS[0])+str('/invoice.html') fr = open(fileread, "r").read() fr = fr.replace('personal_details', personal_html) result = StringIO.StringIO() pdf = pisa.CreatePDF( fr,result ) filewrite = str(settings.TEMPLATE_DIRS[0]) + str('/invoice_write.html') empty = "" fw = open(filewrite, 'w') fw.write(empty) fw.write(fr) fw.close() PaymentPdf.objects.filter(invoicepdf = user_id).delete() pdf_contents = render_to_pdf1('invoice_write.html',result) file_to_be_saved = ContentFile(pdf_contents) random_str = ''.join(random.sample((string.ascii_lowercase + string.ascii_uppercase + string.digits), 8)) resume_name = (str(user_id) + "_" + random_str + ".pdf").replace("@", '') resume = PaymentPdf.objects.create(name = resume_name, invoicepdf_id = user_id, created_by = request.user) resume.name.save(resume_name ,file_to_be_saved) file_path = PaymentPdf.objects.get(invoicepdf = user_id).name pdf_file = str(file_path).split("media")[1] return HttpResponseRedirect('/site_media' + pdf_file) def render_to_pdf1(template_src, context_dict): template = get_template(template_src) context = Context(context_dict) html = template.render(context) result = StringIO.StringIO() pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), result) return result.getvalue() Anyone help me to display image in pdf?
django
null
null
null
null
null
open
django pdf with logo image === I have created Invoice Pdf text template using pisa. But I want to display logo(image) in the pdf file along with the text.My views as follows: def generate_invoice(request, user_id = None): personal_html = '' personal_html += 'hai' fileread = str(settings.TEMPLATE_DIRS[0])+str('/invoice.html') fr = open(fileread, "r").read() fr = fr.replace('personal_details', personal_html) result = StringIO.StringIO() pdf = pisa.CreatePDF( fr,result ) filewrite = str(settings.TEMPLATE_DIRS[0]) + str('/invoice_write.html') empty = "" fw = open(filewrite, 'w') fw.write(empty) fw.write(fr) fw.close() PaymentPdf.objects.filter(invoicepdf = user_id).delete() pdf_contents = render_to_pdf1('invoice_write.html',result) file_to_be_saved = ContentFile(pdf_contents) random_str = ''.join(random.sample((string.ascii_lowercase + string.ascii_uppercase + string.digits), 8)) resume_name = (str(user_id) + "_" + random_str + ".pdf").replace("@", '') resume = PaymentPdf.objects.create(name = resume_name, invoicepdf_id = user_id, created_by = request.user) resume.name.save(resume_name ,file_to_be_saved) file_path = PaymentPdf.objects.get(invoicepdf = user_id).name pdf_file = str(file_path).split("media")[1] return HttpResponseRedirect('/site_media' + pdf_file) def render_to_pdf1(template_src, context_dict): template = get_template(template_src) context = Context(context_dict) html = template.render(context) result = StringIO.StringIO() pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), result) return result.getvalue() Anyone help me to display image in pdf?
0
11,410,978
07/10/2012 10:06:44
940,340
09/12/2011 10:24:46
1,112
142
Reverse Proxy for WCF Rest Service
I created a web site that exposes several WCF Rest Services. Currently I separated it to Web and Application servers. The main issue that I deal with is to create a proxy for the rest services which are placed in the Application server. The flow is as following : The client will open URL for the Web Server, request will be redirected to the App. App will return response the Web Server and Web server to the client. The problem is that Rest Services do not have WSDL. Currenyl after google it I reading about URL Rewrite. The problem is that I do not know if it will work with the post data and will support the same installation for IIS 6/7. The reverse proxy option I think also depending on the URL Rewrite. Please advice what is the best way to create Reverse Proxy for WCF Rest Service ?
c#
wcf
rest
reverse-proxy
null
null
open
Reverse Proxy for WCF Rest Service === I created a web site that exposes several WCF Rest Services. Currently I separated it to Web and Application servers. The main issue that I deal with is to create a proxy for the rest services which are placed in the Application server. The flow is as following : The client will open URL for the Web Server, request will be redirected to the App. App will return response the Web Server and Web server to the client. The problem is that Rest Services do not have WSDL. Currenyl after google it I reading about URL Rewrite. The problem is that I do not know if it will work with the post data and will support the same installation for IIS 6/7. The reverse proxy option I think also depending on the URL Rewrite. Please advice what is the best way to create Reverse Proxy for WCF Rest Service ?
0
11,410,980
07/10/2012 10:06:56
1,514,395
07/10/2012 09:55:29
1
0
Ant: Create an antform based on a directory content
I'm writing an Ant script that installs some unix software automatically. What I'm doing is to call several targets from my build.xml. Each target installs one component, including tasks like shutting down services, copy and manipulate installation files etc. Now I'm thinking of an antform that serves as menu. I have the output of our build in a specific directory and want to generate a form that shows all entries (sub-dirs) of the build folder. Next to each entry I would like to have a checkbox, so that the user can decide which components to install. The difficulty is now to figure out, which sub-dirs exist and should be displayed in the form and which not. How can I achieve that? Hope my description is clear enough :-). Thanks, Jens
ant
null
null
null
null
null
open
Ant: Create an antform based on a directory content === I'm writing an Ant script that installs some unix software automatically. What I'm doing is to call several targets from my build.xml. Each target installs one component, including tasks like shutting down services, copy and manipulate installation files etc. Now I'm thinking of an antform that serves as menu. I have the output of our build in a specific directory and want to generate a form that shows all entries (sub-dirs) of the build folder. Next to each entry I would like to have a checkbox, so that the user can decide which components to install. The difficulty is now to figure out, which sub-dirs exist and should be displayed in the form and which not. How can I achieve that? Hope my description is clear enough :-). Thanks, Jens
0
11,410,981
07/10/2012 10:06:59
1,514,409
07/10/2012 09:59:24
1
0
play framework 2.0.2 mssql config
i have problem connect to MSSQL: In my application.conf: db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver db.default.url="jdbc:sqlserver://localhost\\SQLEXPRESS:1433;databaseName=testdb;user=sa;password=***;" When i run app i got error: play.api.Configuration$$anon$1: Configuration error [Driver not found: [com.micr osoft.sqlserver.jdbc.SQLServerDriver]] pl help me
playframework-2.0
null
null
null
null
null
open
play framework 2.0.2 mssql config === i have problem connect to MSSQL: In my application.conf: db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver db.default.url="jdbc:sqlserver://localhost\\SQLEXPRESS:1433;databaseName=testdb;user=sa;password=***;" When i run app i got error: play.api.Configuration$$anon$1: Configuration error [Driver not found: [com.micr osoft.sqlserver.jdbc.SQLServerDriver]] pl help me
0
11,410,982
07/10/2012 10:07:02
1,154,342
01/17/2012 16:08:10
17
1
.bat rename files name remove first x characters and last x characters
I nead to rename files i some folder, like explained it neads to rename files name in one folder by removing first number of x characters and last number of x characters i sett. Can someone show me how to do that. Thanks
batch
batch-file
null
null
null
null
open
.bat rename files name remove first x characters and last x characters === I nead to rename files i some folder, like explained it neads to rename files name in one folder by removing first number of x characters and last number of x characters i sett. Can someone show me how to do that. Thanks
0
11,373,408
07/07/2012 08:07:36
477,340
10/15/2010 19:08:34
84
1
check real-ip IP address with javascript for nodejs
I have this code as part of a nodejs application that runs behind an nginx proxy: var ip_address = (request.headers['x-real-ip']); if (ip_address !== "127.0.0.1") { var ip = request.headers['x-real-ip']; console.log(ip); } else { var ip = "173.194.41.100"; console.log(ip); } What I am trying to achieve is that on my local dev machine, for testing i use a fixed IP address, otherwise it reads the x-real-ip from the request header. My question, is there a way to make this more full proof, for example, is there a way to by pass this loop thus making the var ip return null, which would create a traceback on my app?
javascript
node.js
null
null
null
null
open
check real-ip IP address with javascript for nodejs === I have this code as part of a nodejs application that runs behind an nginx proxy: var ip_address = (request.headers['x-real-ip']); if (ip_address !== "127.0.0.1") { var ip = request.headers['x-real-ip']; console.log(ip); } else { var ip = "173.194.41.100"; console.log(ip); } What I am trying to achieve is that on my local dev machine, for testing i use a fixed IP address, otherwise it reads the x-real-ip from the request header. My question, is there a way to make this more full proof, for example, is there a way to by pass this loop thus making the var ip return null, which would create a traceback on my app?
0
11,373,421
07/07/2012 08:10:13
1,488,106
06/28/2012 09:37:19
1
0
How do i fix the warning
I have two classes in my project.SIAViewController.h and its sub class cell.h. in cell.h i have @interface cell : UIViewController @property(nonatomic)CGRect frame; @property(assign,nonatomic)UIImage *image; @property(nonatomic)int tag; @property(nonatomic)bool userInteractionEnabled; @property(retain,nonatomic)UITapGestureRecognizer *addGestureRecognizer; @end And in the Calling class ie the SIAViewController.m int x=20,y=50,t=1; cell *tank[9][9]; for(int i=1;i<=8;i++) { for(int j=1;j<=8;j++) { tank[i][j]=[[cell alloc]init]; tank[i][j].frame=CGRectMake(x, y, 35, 35); UIImage *myImage=[UIImage imageNamed:@"s.jpg"]; [tank[i][j] setImage:myImage]; tank[i][j].tag=t; tank[i][j].userInteractionEnabled=YES; UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapDetected:)]; tank[i][j]. addGestureRecognizer=recognizer; [self.view addSubview:tank[i][j]]; x+=35; t++; } y+=35; x=20; } And while running the project i recieve the thread incompatible pointer types sending cell __strong to parameter of type uiview.Can anyone help me. Am new to xcode.Thanks
xcode4.2
null
null
null
null
null
open
How do i fix the warning === I have two classes in my project.SIAViewController.h and its sub class cell.h. in cell.h i have @interface cell : UIViewController @property(nonatomic)CGRect frame; @property(assign,nonatomic)UIImage *image; @property(nonatomic)int tag; @property(nonatomic)bool userInteractionEnabled; @property(retain,nonatomic)UITapGestureRecognizer *addGestureRecognizer; @end And in the Calling class ie the SIAViewController.m int x=20,y=50,t=1; cell *tank[9][9]; for(int i=1;i<=8;i++) { for(int j=1;j<=8;j++) { tank[i][j]=[[cell alloc]init]; tank[i][j].frame=CGRectMake(x, y, 35, 35); UIImage *myImage=[UIImage imageNamed:@"s.jpg"]; [tank[i][j] setImage:myImage]; tank[i][j].tag=t; tank[i][j].userInteractionEnabled=YES; UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapDetected:)]; tank[i][j]. addGestureRecognizer=recognizer; [self.view addSubview:tank[i][j]]; x+=35; t++; } y+=35; x=20; } And while running the project i recieve the thread incompatible pointer types sending cell __strong to parameter of type uiview.Can anyone help me. Am new to xcode.Thanks
0
11,660,618
07/26/2012 00:19:45
1,301,754
03/29/2012 19:48:20
18
0
Change Image of UItabbar Item, Using storyboards
Hey guys I have the following story board ![enter image description here][1] As you can see there is a tab bar application with 5 tabs, on the storyboard I've assign the logo for each tab. Now when the user clicks a cell in a particular view I want to change the image of one of the tabs. How can I do this? I don't have an instance of the tab bar view controller or items since storyboards pretty much does all this for me. So my question is what methods do I have to implement to change the image? If I need the tab bar controller how can I get its instance and in which class should I point it to? Thank you very much, [1]: http://i.stack.imgur.com/wqruo.png
ios
uitabbar
null
null
null
null
open
Change Image of UItabbar Item, Using storyboards === Hey guys I have the following story board ![enter image description here][1] As you can see there is a tab bar application with 5 tabs, on the storyboard I've assign the logo for each tab. Now when the user clicks a cell in a particular view I want to change the image of one of the tabs. How can I do this? I don't have an instance of the tab bar view controller or items since storyboards pretty much does all this for me. So my question is what methods do I have to implement to change the image? If I need the tab bar controller how can I get its instance and in which class should I point it to? Thank you very much, [1]: http://i.stack.imgur.com/wqruo.png
0
11,660,621
07/26/2012 00:20:21
1,431,633
06/01/2012 21:13:40
30
1
jQuery to change dropdown with AJAX
I need a radio button to change a dropdown and have most if it working just not sure about a few things. I want to have CreativeID as the ID and CreativeName as the name. Here's my AJAX: $('input[name=creativeType]').change(function(){ $.ajax({ url: '/app/components/MailingsReport.cfc', //POST method is used type: "POST", //pass the data data: { method: "getCreative", CreativeType: $('input[name=creativeType]:checked').val(), datasource: "shopping_cart" }, dataType: "xml", //contentType: "application/text; charset=utf-8", success: function(xml){ $('#creative option').remove(); $(xml).find('number').each(function() { $("#creative").append('<option value="' + $(this).text() + '">' + $(this).find('CREATIVENAME').text() + '<\/option>'); }); } }); Here's my return data: <wddxPacket version='1.0'><header/><data><recordset rowCount='3' fieldNames='CREATIVEID,CREATIVENAME' type='coldfusion.sql.QueryTable'><field name='CREATIVEID'><number>52.0</number><number>65.0</number><number>77.0</number></field><field name='CREATIVENAME'><string>Product One</string><string>Product Two</string><string>Product Three</string></field></recordset></data></wddxPacket> My Question: I just have no idea how to populate the dropdown so the ID is the value AND the product name shows between the option tags. Any help on this would be appreciated!
jquery
ajax
null
null
null
null
open
jQuery to change dropdown with AJAX === I need a radio button to change a dropdown and have most if it working just not sure about a few things. I want to have CreativeID as the ID and CreativeName as the name. Here's my AJAX: $('input[name=creativeType]').change(function(){ $.ajax({ url: '/app/components/MailingsReport.cfc', //POST method is used type: "POST", //pass the data data: { method: "getCreative", CreativeType: $('input[name=creativeType]:checked').val(), datasource: "shopping_cart" }, dataType: "xml", //contentType: "application/text; charset=utf-8", success: function(xml){ $('#creative option').remove(); $(xml).find('number').each(function() { $("#creative").append('<option value="' + $(this).text() + '">' + $(this).find('CREATIVENAME').text() + '<\/option>'); }); } }); Here's my return data: <wddxPacket version='1.0'><header/><data><recordset rowCount='3' fieldNames='CREATIVEID,CREATIVENAME' type='coldfusion.sql.QueryTable'><field name='CREATIVEID'><number>52.0</number><number>65.0</number><number>77.0</number></field><field name='CREATIVENAME'><string>Product One</string><string>Product Two</string><string>Product Three</string></field></recordset></data></wddxPacket> My Question: I just have no idea how to populate the dropdown so the ID is the value AND the product name shows between the option tags. Any help on this would be appreciated!
0
11,660,622
07/26/2012 00:20:41
1,553,108
07/25/2012 23:47:36
1
0
SQL Return Unique Data from 3 columns and how many times it shows up
What I have: SELECT SGFORM.FFORMDESC, SGFORM.FPAPERNAME, SGFORM.FPAPERDESC FROM SGFORM Group by SGFORM.FPAPERNAME, SGFORM.FPAPERDESC, SGFORM.FFORMDESC Having Count (*) > 0; This gives me a list of the unique items but it doesn't tell me how many times they show up in the table.
sql
null
null
null
null
null
open
SQL Return Unique Data from 3 columns and how many times it shows up === What I have: SELECT SGFORM.FFORMDESC, SGFORM.FPAPERNAME, SGFORM.FPAPERDESC FROM SGFORM Group by SGFORM.FPAPERNAME, SGFORM.FPAPERDESC, SGFORM.FFORMDESC Having Count (*) > 0; This gives me a list of the unique items but it doesn't tell me how many times they show up in the table.
0
11,657,749
07/25/2012 20:04:56
229,853
12/11/2009 18:14:59
1,247
4
Mountain Lion - SVN Missing
I upgraded to Mac OS X Mountain Lion and found out SVN is no longer present. I use netbeans 6.9.1 in conjunction with Apache's SVN. How can I get it back and working? Thanks
svn
netbeans-6.9
osx-mountain-lion
null
null
07/30/2012 06:34:04
off topic
Mountain Lion - SVN Missing === I upgraded to Mac OS X Mountain Lion and found out SVN is no longer present. I use netbeans 6.9.1 in conjunction with Apache's SVN. How can I get it back and working? Thanks
2
11,660,623
07/26/2012 00:20:44
640,590
03/02/2011 05:24:46
74
4
app is asking for AppleID when being run
I am updating my iOS app with the Apple suggested transaction VerificationController code to verify in-app purchases due to the recent "hack" published that allowed people to purchase in-ap purchases without paying due to spoofed receipts from spoofed Apple servers. I have everything integrated, and am now testing. I have run the app several times and the verification stuff has run several times. I want to test everything about purchasing including starting with a fresh brand new app and AppleID. So I deleted the app completely off my testing device. I created a brand new "test user" AppleID in iTunes Connect. I went to the Settings app on my test device, went to Store, and changed the default AppleID for the device to this newly created AppleID. I re-run the app from Xcode with the debugger, which re-installs the App onto the testing device and runs it fresh. The problem is that almost immediately on launch, the testing device puts up the AppleID password Alert-type view and asks for the password for the old AppleID that I originally used to test everything including the original in-app purchase and the verification for it. It does not ask for the password for the new device AppleID as set in the Settings app under store. When I run it as a new app, the verification code does not run and no code from any of my routines that do anything with the Apple StoreKit stuff is run except for a solitary [[SKPaymentQueue defaultQueue] addTransactionObserver:observer]; (observer is my delegate object for the StoreKit stuff and is created but no routines in it run except init and init does nothing except set a static variable for itself to create a singleton type class) For checking purposes, I also added in NSLog(@"in App Delegate, payment queue transactions are %@", [[SKPaymentQueue defaultQueue] transactions]); which shows no old transactions hanging around. I have no clue on why it has started to ask for my AppleID of the original test user when the App is newly installed, the AppleID for the store for the device is different, and I can identify no code being run that accesses the StoreKit (except as mentioned above). ANy insight into this would be appreciated. Thanks
iphone
ios
in-app
null
null
null
open
app is asking for AppleID when being run === I am updating my iOS app with the Apple suggested transaction VerificationController code to verify in-app purchases due to the recent "hack" published that allowed people to purchase in-ap purchases without paying due to spoofed receipts from spoofed Apple servers. I have everything integrated, and am now testing. I have run the app several times and the verification stuff has run several times. I want to test everything about purchasing including starting with a fresh brand new app and AppleID. So I deleted the app completely off my testing device. I created a brand new "test user" AppleID in iTunes Connect. I went to the Settings app on my test device, went to Store, and changed the default AppleID for the device to this newly created AppleID. I re-run the app from Xcode with the debugger, which re-installs the App onto the testing device and runs it fresh. The problem is that almost immediately on launch, the testing device puts up the AppleID password Alert-type view and asks for the password for the old AppleID that I originally used to test everything including the original in-app purchase and the verification for it. It does not ask for the password for the new device AppleID as set in the Settings app under store. When I run it as a new app, the verification code does not run and no code from any of my routines that do anything with the Apple StoreKit stuff is run except for a solitary [[SKPaymentQueue defaultQueue] addTransactionObserver:observer]; (observer is my delegate object for the StoreKit stuff and is created but no routines in it run except init and init does nothing except set a static variable for itself to create a singleton type class) For checking purposes, I also added in NSLog(@"in App Delegate, payment queue transactions are %@", [[SKPaymentQueue defaultQueue] transactions]); which shows no old transactions hanging around. I have no clue on why it has started to ask for my AppleID of the original test user when the App is newly installed, the AppleID for the store for the device is different, and I can identify no code being run that accesses the StoreKit (except as mentioned above). ANy insight into this would be appreciated. Thanks
0
11,660,627
07/26/2012 00:20:54
674,794
03/24/2011 11:31:26
172
5
Python app import error in Django with WSGI gunicorn
I'm trying to deploy a Django app with gunicorn on Heroku and I've run into a few hitches. When I began my project my Django version was 1.3 and didn't contain the standard wsgi.py module, so I added the standard wsgi module as top/wsgi.py (top being my project name, turk being my app name, topturk being the containing directory - preserved so error logs make sense below). Now when I run gunicorn top.wsgi:application -b 0.0.0.0:$PORT The server successfully starts up, 19:00:42 web.1 | started with pid 7869 19:00:42 web.1 | 2012-07-25 19:00:42 [7869] [INFO] Starting gunicorn 0.14.5 19:00:42 web.1 | 2012-07-25 19:00:42 [7869] [INFO] Listening at: http://0.0.0.0:5000 (7869) 19:00:42 web.1 | 2012-07-25 19:00:42 [7869] [INFO] Using worker: sync 19:00:42 web.1 | 2012-07-25 19:00:42 [7870] [INFO] Booting worker with pid: 7870 but then when I navigate to 0.0.0.0:5000 I get returned an Internal Server Error: 19:00:45 web.1 | 2012-07-25 17:00:45 [7870] [ERROR] Error handling request 19:00:45 web.1 | Traceback (most recent call last): 19:00:45 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 102, in handle_request 19:00:45 web.1 | respiter = self.wsgi(environ, resp.start_response) 19:00:45 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__ 19:00:45 web.1 | self.load_middleware() 19:00:45 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware 19:00:45 web.1 | raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e)) 19:00:45 web.1 | ImproperlyConfigured: Error importing middleware turk.middleware.subdomain: "No module named turk.middleware.subdomain" 19:00:47 web.1 | 2012-07-25 17:00:47 [7870] [ERROR] Error handling request 19:00:47 web.1 | Traceback (most recent call last): 19:00:47 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 102, in handle_request 19:00:47 web.1 | respiter = self.wsgi(environ, resp.start_response) 19:00:47 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__ 19:00:47 web.1 | self.load_middleware() 19:00:47 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware 19:00:47 web.1 | raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e)) 19:00:47 web.1 | ImproperlyConfigured: Error importing middleware turk.middleware.subdomain: "No module named turk.middleware.subdomain" I'm assuming this is a python path error, where the server doesn't know how to import from my app directory The relevant import code is here in settings: MIDDLEWARE_CLASSES = ( 'turk.middleware.subdomain.SubdomainMiddleware', 'turk.middleware.removewww.RemoveWWWMiddleware', ) I attempted to fix this problem by inserting my app directory into sys.path like so at the top of my settings.py file like so: PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) sys.path.insert(1, PROJECT_ROOT+'/turk/') Which I've verified adds the app directory to the path, but still no dice. Any ideas? Also sys.path.insert(1, PROJECT_ROOT+'/turk/') seems hackish and adds at least two copies of the directory to the path, what's the correct way to append to PYTHON_PATH in Django? Thanks!
python
django
import
wsgi
gunicorn
null
open
Python app import error in Django with WSGI gunicorn === I'm trying to deploy a Django app with gunicorn on Heroku and I've run into a few hitches. When I began my project my Django version was 1.3 and didn't contain the standard wsgi.py module, so I added the standard wsgi module as top/wsgi.py (top being my project name, turk being my app name, topturk being the containing directory - preserved so error logs make sense below). Now when I run gunicorn top.wsgi:application -b 0.0.0.0:$PORT The server successfully starts up, 19:00:42 web.1 | started with pid 7869 19:00:42 web.1 | 2012-07-25 19:00:42 [7869] [INFO] Starting gunicorn 0.14.5 19:00:42 web.1 | 2012-07-25 19:00:42 [7869] [INFO] Listening at: http://0.0.0.0:5000 (7869) 19:00:42 web.1 | 2012-07-25 19:00:42 [7869] [INFO] Using worker: sync 19:00:42 web.1 | 2012-07-25 19:00:42 [7870] [INFO] Booting worker with pid: 7870 but then when I navigate to 0.0.0.0:5000 I get returned an Internal Server Error: 19:00:45 web.1 | 2012-07-25 17:00:45 [7870] [ERROR] Error handling request 19:00:45 web.1 | Traceback (most recent call last): 19:00:45 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 102, in handle_request 19:00:45 web.1 | respiter = self.wsgi(environ, resp.start_response) 19:00:45 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__ 19:00:45 web.1 | self.load_middleware() 19:00:45 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware 19:00:45 web.1 | raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e)) 19:00:45 web.1 | ImproperlyConfigured: Error importing middleware turk.middleware.subdomain: "No module named turk.middleware.subdomain" 19:00:47 web.1 | 2012-07-25 17:00:47 [7870] [ERROR] Error handling request 19:00:47 web.1 | Traceback (most recent call last): 19:00:47 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 102, in handle_request 19:00:47 web.1 | respiter = self.wsgi(environ, resp.start_response) 19:00:47 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__ 19:00:47 web.1 | self.load_middleware() 19:00:47 web.1 | File "/Users/intenex/Dropbox/code/django/topturk/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware 19:00:47 web.1 | raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e)) 19:00:47 web.1 | ImproperlyConfigured: Error importing middleware turk.middleware.subdomain: "No module named turk.middleware.subdomain" I'm assuming this is a python path error, where the server doesn't know how to import from my app directory The relevant import code is here in settings: MIDDLEWARE_CLASSES = ( 'turk.middleware.subdomain.SubdomainMiddleware', 'turk.middleware.removewww.RemoveWWWMiddleware', ) I attempted to fix this problem by inserting my app directory into sys.path like so at the top of my settings.py file like so: PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) sys.path.insert(1, PROJECT_ROOT+'/turk/') Which I've verified adds the app directory to the path, but still no dice. Any ideas? Also sys.path.insert(1, PROJECT_ROOT+'/turk/') seems hackish and adds at least two copies of the directory to the path, what's the correct way to append to PYTHON_PATH in Django? Thanks!
0
11,660,629
07/26/2012 00:21:12
1,553,139
07/26/2012 00:13:40
1
0
How can i create splash screen not using thread or something like that in Android?
I want to introduce my logo in 5 seconds at start. But it must be motional. I used thread my logo was stoped in 5 seconds. I thought that maybe I could use "gif" but it can not work. I want to show my logo motional. How can i do it in Android?
android
multithreading
gif
splash
logo
null
open
How can i create splash screen not using thread or something like that in Android? === I want to introduce my logo in 5 seconds at start. But it must be motional. I used thread my logo was stoped in 5 seconds. I thought that maybe I could use "gif" but it can not work. I want to show my logo motional. How can i do it in Android?
0
11,350,718
07/05/2012 18:54:30
873,227
08/01/2011 17:54:56
125
1
QSystemTrayIcon, open other dialog than mainwindow closes the application
As the title says, if I make a systemtray icon which has an option to open an other dialog (e.g. preferences) through there, when I close this other dialog, the whole application closes when I call this>close(); from withing that preferences dialog. Take this example code: main.cpp: #include <QtGui/QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); trayIcon = new QSystemTrayIcon(this); trayIcon->setIcon(QIcon(":/icons/error.png")); //replace 'error' with 'video' and recompile. The indicator isn't shown! trayIcon->setToolTip("Test"); QMenu *changer_menu = new QMenu; Show_action = new QAction(tr("S&how"),this); Show_action->setIconVisibleInMenu(true); connect(Show_action, SIGNAL(triggered()), this, SLOT(show_me())); changer_menu->addAction(Show_action); changer_menu->addSeparator(); Preferences_action = new QAction(tr("Preferences"), this); Preferences_action->setIconVisibleInMenu(true); connect(Preferences_action, SIGNAL(triggered()), this, SLOT(showpref())); changer_menu->addAction(Preferences_action); Quit_action = new QAction(tr("&Quit"), this); Quit_action->setIconVisibleInMenu(true); connect(Quit_action, SIGNAL(triggered()), this, SLOT(quit_me())); changer_menu->addAction(Quit_action); trayIcon->setContextMenu(changer_menu); } void MainWindow::showpref(){ pref=new Preferences(this); pref->exec(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { trayIcon->show(); this->hide(); } void MainWindow::show_me(){ this->show(); } void MainWindow::quit_me(){ this->close(); } mainwindow.h: #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QSystemTrayIcon> #include "preferences.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_pushButton_clicked(); void show_me(); void quit_me(); void showpref(); private: Ui::MainWindow *ui; QSystemTrayIcon *trayIcon; QAction *Show_action; QAction *Preferences_action; QAction *Quit_action; Preferences *pref; }; #endif // MAINWINDOW_H preferences.cpp: #include "preferences.h" #include "ui_preferences.h" Preferences::Preferences(QWidget *parent) : QDialog(parent), ui(new Ui::Preferences) { ui->setupUi(this); } Preferences::~Preferences() { delete ui; } void Preferences::on_pushButton_clicked() { /HERE THE WHOLE PROGRAM CLOSES. I WANT ONLY THE PREFERENCES DIALOG TO CLOSE, THE INDICATOR TO STAY close(); } preferences.h: #ifndef PREFERENCES_H #define PREFERENCES_H #include <QDialog> namespace Ui { class Preferences; } class Preferences : public QDialog { Q_OBJECT public: explicit Preferences(QWidget *parent = 0); ~Preferences(); private slots: void on_pushButton_clicked(); private: Ui::Preferences *ui; }; #endif // PREFERENCES_H icons.qrc: <RCC> <qresource prefix="/icons"> <file>error.png</file> </qresource> </RCC> file error.png here: http://i.imgur.com/beSvX.png Keep all of the above files to the same dir and compile as: qmake -project qmake *.pro qmake make Thanks for any help!
qt
indicator
tray
null
null
null
open
QSystemTrayIcon, open other dialog than mainwindow closes the application === As the title says, if I make a systemtray icon which has an option to open an other dialog (e.g. preferences) through there, when I close this other dialog, the whole application closes when I call this>close(); from withing that preferences dialog. Take this example code: main.cpp: #include <QtGui/QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); trayIcon = new QSystemTrayIcon(this); trayIcon->setIcon(QIcon(":/icons/error.png")); //replace 'error' with 'video' and recompile. The indicator isn't shown! trayIcon->setToolTip("Test"); QMenu *changer_menu = new QMenu; Show_action = new QAction(tr("S&how"),this); Show_action->setIconVisibleInMenu(true); connect(Show_action, SIGNAL(triggered()), this, SLOT(show_me())); changer_menu->addAction(Show_action); changer_menu->addSeparator(); Preferences_action = new QAction(tr("Preferences"), this); Preferences_action->setIconVisibleInMenu(true); connect(Preferences_action, SIGNAL(triggered()), this, SLOT(showpref())); changer_menu->addAction(Preferences_action); Quit_action = new QAction(tr("&Quit"), this); Quit_action->setIconVisibleInMenu(true); connect(Quit_action, SIGNAL(triggered()), this, SLOT(quit_me())); changer_menu->addAction(Quit_action); trayIcon->setContextMenu(changer_menu); } void MainWindow::showpref(){ pref=new Preferences(this); pref->exec(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { trayIcon->show(); this->hide(); } void MainWindow::show_me(){ this->show(); } void MainWindow::quit_me(){ this->close(); } mainwindow.h: #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QSystemTrayIcon> #include "preferences.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_pushButton_clicked(); void show_me(); void quit_me(); void showpref(); private: Ui::MainWindow *ui; QSystemTrayIcon *trayIcon; QAction *Show_action; QAction *Preferences_action; QAction *Quit_action; Preferences *pref; }; #endif // MAINWINDOW_H preferences.cpp: #include "preferences.h" #include "ui_preferences.h" Preferences::Preferences(QWidget *parent) : QDialog(parent), ui(new Ui::Preferences) { ui->setupUi(this); } Preferences::~Preferences() { delete ui; } void Preferences::on_pushButton_clicked() { /HERE THE WHOLE PROGRAM CLOSES. I WANT ONLY THE PREFERENCES DIALOG TO CLOSE, THE INDICATOR TO STAY close(); } preferences.h: #ifndef PREFERENCES_H #define PREFERENCES_H #include <QDialog> namespace Ui { class Preferences; } class Preferences : public QDialog { Q_OBJECT public: explicit Preferences(QWidget *parent = 0); ~Preferences(); private slots: void on_pushButton_clicked(); private: Ui::Preferences *ui; }; #endif // PREFERENCES_H icons.qrc: <RCC> <qresource prefix="/icons"> <file>error.png</file> </qresource> </RCC> file error.png here: http://i.imgur.com/beSvX.png Keep all of the above files to the same dir and compile as: qmake -project qmake *.pro qmake make Thanks for any help!
0
11,350,720
07/05/2012 18:54:36
1,078,242
12/02/2011 21:02:45
42
1
"Win32Exception: The operation completed successfully" after WTSQueryUserToken on 32bit Windows (64bit works)
I'm developing a small Windows Service in C# that needs to do interop with Win32 API at some point. I'm getting the following exception which does not make sense to me: `System.ComponentModel.Win32Exception: The operation completed successfully` Right after the last line in this C# snippet: var sessionId = Kernel32.WTSGetActiveConsoleSessionId(); var userTokenPtr = new IntPtr(); if (!WtsApi32.WTSQueryUserToken(sessionId, out userTokenPtr)) { throw new Win32Exception(Marshal.GetLastWin32Error()); } Here's how I'm declaring `WTSQueryUserToken` in `WtsApi32`: [DllImport("Wtsapi32.dll", EntryPoint="WTSQueryUserToken")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool WTSQueryUserToken ( [In, MarshalAs(UnmanagedType.U8)] ulong sessionId, [Out] out IntPtr phToken ); Some facts: - This works perfectly on 64bit Win7, but **fails on a 32bit Win7**. - There's no way the [10,000 handle limit][1] has been reached when this is executed, it's the first Win32 call in a very small windows service. - I think there might be some underlying Win32 error but some bug overwrote the errorcode with a 0, thus giving me the "success" error message, but I don't know how to confirm or even diagnose this. - **Nearly all of the answers I found to this problem had to do with [improper disposal of user controls][2]. Since this is a Windows service, *this is not the case*.** I'm guessing there must be something wrong with my WTSQueryUserToken declaration, since it only fails on 32bit Windows, which leads me to think it's a marshaling problem. However, I still can't see what it might be. [1]: http://support.microsoft.com/kb/327699 [2]: http://nomagichere.blogspot.com.ar/2008/03/systemcomponentmodelwin32exception-is.html
c#
.net
winapi
interop
win32exception
null
open
"Win32Exception: The operation completed successfully" after WTSQueryUserToken on 32bit Windows (64bit works) === I'm developing a small Windows Service in C# that needs to do interop with Win32 API at some point. I'm getting the following exception which does not make sense to me: `System.ComponentModel.Win32Exception: The operation completed successfully` Right after the last line in this C# snippet: var sessionId = Kernel32.WTSGetActiveConsoleSessionId(); var userTokenPtr = new IntPtr(); if (!WtsApi32.WTSQueryUserToken(sessionId, out userTokenPtr)) { throw new Win32Exception(Marshal.GetLastWin32Error()); } Here's how I'm declaring `WTSQueryUserToken` in `WtsApi32`: [DllImport("Wtsapi32.dll", EntryPoint="WTSQueryUserToken")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool WTSQueryUserToken ( [In, MarshalAs(UnmanagedType.U8)] ulong sessionId, [Out] out IntPtr phToken ); Some facts: - This works perfectly on 64bit Win7, but **fails on a 32bit Win7**. - There's no way the [10,000 handle limit][1] has been reached when this is executed, it's the first Win32 call in a very small windows service. - I think there might be some underlying Win32 error but some bug overwrote the errorcode with a 0, thus giving me the "success" error message, but I don't know how to confirm or even diagnose this. - **Nearly all of the answers I found to this problem had to do with [improper disposal of user controls][2]. Since this is a Windows service, *this is not the case*.** I'm guessing there must be something wrong with my WTSQueryUserToken declaration, since it only fails on 32bit Windows, which leads me to think it's a marshaling problem. However, I still can't see what it might be. [1]: http://support.microsoft.com/kb/327699 [2]: http://nomagichere.blogspot.com.ar/2008/03/systemcomponentmodelwin32exception-is.html
0
11,350,640
07/05/2012 18:49:03
401,147
04/16/2010 00:27:33
1,257
5
Html5/CSS3 list style issue
I am creating a `<ul>` and `<li>` wrapped by `<section>` tag. Everything works fine except the list style (dot) display outside of my `<section>` tag. I am not sure why. I appreciate it if someone can share tips. Thanks a lot. my html <section id='test'> <ul> <li>line 1 jiofjisojfoisdjfoisjfio</li> <li>line 2 jiofjisojfoisdjfoisjfio</li> <li>line 3 jiofjisojfoisdjfoisjfio</li> <li>line 4 jiofjisojfoisdjfoisjfio</li> <li>line 5 jiofjisojfoisdjfoisjfio</li> <li>line 6 jiofjisojfoisdjfoisjfio</li> <li>line 7 jiofjisojfoisdjfoisjfio</li> </ul> </section> CSS section { display: block; width: 1200px; margin: 50px auto; border: 3px solid red; } It displays like this.. ---------------------- *| line 1 jioj.. | *| line 2 jiof.. | *| line 3 jiof.. | *| line 4 jiof.. | *| line 5 jiof.. | *| line 6 jiof.. | ----------------------- The black dot is outside of the section tag.
html5
css3
null
null
null
null
open
Html5/CSS3 list style issue === I am creating a `<ul>` and `<li>` wrapped by `<section>` tag. Everything works fine except the list style (dot) display outside of my `<section>` tag. I am not sure why. I appreciate it if someone can share tips. Thanks a lot. my html <section id='test'> <ul> <li>line 1 jiofjisojfoisdjfoisjfio</li> <li>line 2 jiofjisojfoisdjfoisjfio</li> <li>line 3 jiofjisojfoisdjfoisjfio</li> <li>line 4 jiofjisojfoisdjfoisjfio</li> <li>line 5 jiofjisojfoisdjfoisjfio</li> <li>line 6 jiofjisojfoisdjfoisjfio</li> <li>line 7 jiofjisojfoisdjfoisjfio</li> </ul> </section> CSS section { display: block; width: 1200px; margin: 50px auto; border: 3px solid red; } It displays like this.. ---------------------- *| line 1 jioj.. | *| line 2 jiof.. | *| line 3 jiof.. | *| line 4 jiof.. | *| line 5 jiof.. | *| line 6 jiof.. | ----------------------- The black dot is outside of the section tag.
0
11,350,299
07/05/2012 18:25:11
673,664
03/23/2011 18:33:48
4,105
242
How to use an array value as field in Java? a1.section[2] = 1;
New to Java, and can't figure out what I hope to be a simple thing. I keep "sections" in an array: //Section.java public static final String[] TOP = { "Top News", "http://www.mysite.com/RSS/myfeed.csp", "top" }; I'd like to do something like this: Article a1 = new Article(); a1.section[2] = 1; //should resolve to a1.top = 1; But it won't let me, as it doesn't know what "section" is. (I'm sure seasoned Java people will cringe at this attempt... but my searches have come up empty on how to do this)
java
android
null
null
null
null
open
How to use an array value as field in Java? a1.section[2] = 1; === New to Java, and can't figure out what I hope to be a simple thing. I keep "sections" in an array: //Section.java public static final String[] TOP = { "Top News", "http://www.mysite.com/RSS/myfeed.csp", "top" }; I'd like to do something like this: Article a1 = new Article(); a1.section[2] = 1; //should resolve to a1.top = 1; But it won't let me, as it doesn't know what "section" is. (I'm sure seasoned Java people will cringe at this attempt... but my searches have come up empty on how to do this)
0
11,350,723
07/05/2012 18:54:42
429,303
08/24/2010 08:54:45
76
6
Collections.newSetFromMap(»HashMap«) vs. Collections.synchronizedSet(»HashSet«)
Apparently, there are two ways to obtain a thread-safe `HashSet` instance using Java's `Collections` API. - How do they differ? - Which, and under what circumstances, is one preferred over the over?
java
collections
thread-safety
hashset
null
null
open
Collections.newSetFromMap(»HashMap«) vs. Collections.synchronizedSet(»HashSet«) === Apparently, there are two ways to obtain a thread-safe `HashSet` instance using Java's `Collections` API. - How do they differ? - Which, and under what circumstances, is one preferred over the over?
0
11,350,725
07/05/2012 18:54:51
940,173
09/12/2011 08:50:42
207
7
javascript + send multiple strings with URL
I have a script that calls another php page and passes values using PHP get. The one variable, q is sent with the URL where str is a variable. xmlhttp.open("GET","getdata.php?q="+str,true); I have a few multiple variables that I want to send in the URL string. How can I send multiple variables. Along the lines of: xmlhttp.open("GET","getdata.php?q="+str+"y="+str2+"z="+str3,true); where the URL will then be somthing like page.php?q=Peter&y=John&z=Smith Thanks for the help, Ryan
php
javascript
get
null
null
null
open
javascript + send multiple strings with URL === I have a script that calls another php page and passes values using PHP get. The one variable, q is sent with the URL where str is a variable. xmlhttp.open("GET","getdata.php?q="+str,true); I have a few multiple variables that I want to send in the URL string. How can I send multiple variables. Along the lines of: xmlhttp.open("GET","getdata.php?q="+str+"y="+str2+"z="+str3,true); where the URL will then be somthing like page.php?q=Peter&y=John&z=Smith Thanks for the help, Ryan
0
11,350,733
07/05/2012 18:55:30
878,080
08/04/2011 07:35:38
89
0
How do I convert my eclipse project to an earlier java version?
I have a project in Eclipse which previously used JRE7 and referenced the JRE7 system libraries. I absolutely need it to now run in JRE6. I have not used any Java 7 specific syntax so the source code itself is entirely compatible. Here is what I have already done: - I Installed JDK6. - I then went to **Window > Preferences > Java > Installed JREs** and set JRE6 as default. - I configured the **build path** of my project to reference the JRE6 system library and not the JRE7 one. - Finally I went to **Run Configurations > JRE** and set it to run in JRE6. Immediately after that last step, the top of the dialogue shows a message that says: > JRE not compatible with project .class file compatibility: 1.7 And when I run the project I get this error message: > java.lang.UnsupportedClassVersionError: ExampleProcessingApp : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:314) at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:146) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:608) at sun.applet.AppletPanel.createApplet(AppletPanel.java:798) at sun.applet.AppletPanel.runLoader(AppletPanel.java:727) at sun.applet.AppletPanel.run(AppletPanel.java:380) at java.lang.Thread.run(Thread.java:679) As I mentioned previously, the actual code of the project is no different from Java 6 syntax so it would run in JRE6. So presumably I need to somehow recompile all the .class files from the source code. I thought Eclipse would do this automatically. Any ideas?
java
eclipse
jre
backwards-compatibility
null
null
open
How do I convert my eclipse project to an earlier java version? === I have a project in Eclipse which previously used JRE7 and referenced the JRE7 system libraries. I absolutely need it to now run in JRE6. I have not used any Java 7 specific syntax so the source code itself is entirely compatible. Here is what I have already done: - I Installed JDK6. - I then went to **Window > Preferences > Java > Installed JREs** and set JRE6 as default. - I configured the **build path** of my project to reference the JRE6 system library and not the JRE7 one. - Finally I went to **Run Configurations > JRE** and set it to run in JRE6. Immediately after that last step, the top of the dialogue shows a message that says: > JRE not compatible with project .class file compatibility: 1.7 And when I run the project I get this error message: > java.lang.UnsupportedClassVersionError: ExampleProcessingApp : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:314) at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:146) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:608) at sun.applet.AppletPanel.createApplet(AppletPanel.java:798) at sun.applet.AppletPanel.runLoader(AppletPanel.java:727) at sun.applet.AppletPanel.run(AppletPanel.java:380) at java.lang.Thread.run(Thread.java:679) As I mentioned previously, the actual code of the project is no different from Java 6 syntax so it would run in JRE6. So presumably I need to somehow recompile all the .class files from the source code. I thought Eclipse would do this automatically. Any ideas?
0
11,350,739
07/05/2012 18:55:46
1,354,417
04/24/2012 17:48:38
1
0
SQL -- SELECT statement -- concatenate strings to
I have an SQL question. Everything works fine in the below SELECT statement except the portion I have highlighted in bold. What I'm trying to do is allow the user to search for a specific Rule within the database. Unfortunately, I do not actually have a Rule column, and so I need to concatenate certain field values to create a string with which to compare to the user's searchtext. Any idea why the part in bold does not work? In theory, I would like this statement to check for whether the string "Rule " + part_num (where part_num is the value contained in the part_num field) equals the value of searchtext (the value of searchtext is obtained from my PHP script). I did some research on concatenating strings for SQL purposes, but none seem to fit the bill. Does someone out there have any suggestions? 'SELECT ID, part_num, part_title, rule_num, rule_title, sub_heading_num, sub_heading, contents FROM Rules WHERE part_title LIKE "%'.$searchtext.'%" OR rule_title LIKE "%'.$searchtext.'%" OR sub_heading LIKE "%'.$searchtext.'%" OR contents LIKE "%'.$searchtext.'%" OR **"Rule " + part_num** LIKE "%'.$searchtext.'%" ORDER BY ID';
sql
null
null
null
null
null
open
SQL -- SELECT statement -- concatenate strings to === I have an SQL question. Everything works fine in the below SELECT statement except the portion I have highlighted in bold. What I'm trying to do is allow the user to search for a specific Rule within the database. Unfortunately, I do not actually have a Rule column, and so I need to concatenate certain field values to create a string with which to compare to the user's searchtext. Any idea why the part in bold does not work? In theory, I would like this statement to check for whether the string "Rule " + part_num (where part_num is the value contained in the part_num field) equals the value of searchtext (the value of searchtext is obtained from my PHP script). I did some research on concatenating strings for SQL purposes, but none seem to fit the bill. Does someone out there have any suggestions? 'SELECT ID, part_num, part_title, rule_num, rule_title, sub_heading_num, sub_heading, contents FROM Rules WHERE part_title LIKE "%'.$searchtext.'%" OR rule_title LIKE "%'.$searchtext.'%" OR sub_heading LIKE "%'.$searchtext.'%" OR contents LIKE "%'.$searchtext.'%" OR **"Rule " + part_num** LIKE "%'.$searchtext.'%" ORDER BY ID';
0
11,542,318
07/18/2012 13:16:33
1,534,863
07/18/2012 13:06:37
1
0
Windows Phone App integration with remote server
What framework exists for Handling data from a Windows Phone to integrate with a server DB? For example, a game score submission. A notification from the server to the WP App. Any framework exists to address this eco-system? Or we need to do from scratch? if yes, what is the preferred way of doing it? Again something similar to SQL Server-ADO stuff ? Also like I've asked, what's the best way to communicate something from Server to client WP App?
windows-phone-7
null
null
null
null
07/18/2012 14:30:15
not constructive
Windows Phone App integration with remote server === What framework exists for Handling data from a Windows Phone to integrate with a server DB? For example, a game score submission. A notification from the server to the WP App. Any framework exists to address this eco-system? Or we need to do from scratch? if yes, what is the preferred way of doing it? Again something similar to SQL Server-ADO stuff ? Also like I've asked, what's the best way to communicate something from Server to client WP App?
4
11,542,320
07/18/2012 13:16:39
435,426
08/30/2010 23:15:57
118
2
Looking for tool to convert an XSD spec into C++ with Concepts
I'm looking for a library that would convert an XSD specification into a C++ concept. I know there's no official spec for concepts and very little implementation of it, but it seems like semantically it maps closely to XML schemas. Thanks in advance.
xsd
c++-concepts
null
null
null
null
open
Looking for tool to convert an XSD spec into C++ with Concepts === I'm looking for a library that would convert an XSD specification into a C++ concept. I know there's no official spec for concepts and very little implementation of it, but it seems like semantically it maps closely to XML schemas. Thanks in advance.
0
11,542,339
07/18/2012 13:17:31
1,385,666
05/09/2012 21:01:16
29
1
post on face book's wall complex message programmatically using iPhone sdk
I've just solved the problem with posting on facebook's wall programmatically using Facebook iOS sdk. It is completely working in my application. Here's the part of code: NSString *messageString=@"test message"; FBRequest *request=[[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:@"me/feed" parameters:[NSDictionary dictionaryWithObject:messageString forKey:@"message"] HTTPMethod:@"POST"]; Now I need to post not only the text message on facebook's wall. I need to post this: ![post on Facebook example][1] [1]: http://i.stack.imgur.com/6C56a.png Here are the parameters which I should use to make my post look similar http://developers.facebook.com/docs/reference/rest/stream.publish/ Help me please to make tether values with parameters (message, link, caption etc.). The very best answer would be `NSDictionary`object which I can pass to my `FBRequest`init method as a `parameters` argument. Thanks you for your attention.
iphone
objective-c
ios
facebook
null
null
open
post on face book's wall complex message programmatically using iPhone sdk === I've just solved the problem with posting on facebook's wall programmatically using Facebook iOS sdk. It is completely working in my application. Here's the part of code: NSString *messageString=@"test message"; FBRequest *request=[[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:@"me/feed" parameters:[NSDictionary dictionaryWithObject:messageString forKey:@"message"] HTTPMethod:@"POST"]; Now I need to post not only the text message on facebook's wall. I need to post this: ![post on Facebook example][1] [1]: http://i.stack.imgur.com/6C56a.png Here are the parameters which I should use to make my post look similar http://developers.facebook.com/docs/reference/rest/stream.publish/ Help me please to make tether values with parameters (message, link, caption etc.). The very best answer would be `NSDictionary`object which I can pass to my `FBRequest`init method as a `parameters` argument. Thanks you for your attention.
0
11,542,340
07/18/2012 13:17:31
1,324,756
04/10/2012 18:03:42
381
15
Linq get data from m to n tables?
I have 2 Tables that is m to n relationships between them. Roles, Moduls, ModulsInRoles. I get current user roles. IAnd I want to get these roles' moduls. I tried to write something. But I cant success. string[] roller = System.Web.Security.Roles.GetRolesForUser(); IEnumerable<TblModuller> moduller = null; IEnumerable<TblModulsInRoles> moduls_in_roles = null; foreach (var rol in roller) { moduls_in_roles = entity.TblModulsInRoles.Where(x => x.Roles.RoleName == rol); foreach(var modul in moduls_in_roles) { //I dont know What should I write or this code is correct. } } for example; My data is like this: Admin Modul1 Admin Modul2 User Modul2 User Modul3 And I want to get this: Modul1 Modul2 Modul3 What is the logic? and Is there some code example or tutorial about this topic. Thanks.
c#
linq
relational-database
null
null
null
open
Linq get data from m to n tables? === I have 2 Tables that is m to n relationships between them. Roles, Moduls, ModulsInRoles. I get current user roles. IAnd I want to get these roles' moduls. I tried to write something. But I cant success. string[] roller = System.Web.Security.Roles.GetRolesForUser(); IEnumerable<TblModuller> moduller = null; IEnumerable<TblModulsInRoles> moduls_in_roles = null; foreach (var rol in roller) { moduls_in_roles = entity.TblModulsInRoles.Where(x => x.Roles.RoleName == rol); foreach(var modul in moduls_in_roles) { //I dont know What should I write or this code is correct. } } for example; My data is like this: Admin Modul1 Admin Modul2 User Modul2 User Modul3 And I want to get this: Modul1 Modul2 Modul3 What is the logic? and Is there some code example or tutorial about this topic. Thanks.
0
11,542,341
07/18/2012 13:17:33
1,442,007
06/07/2012 10:55:54
54
1
Override Android GUI
I am working on a special project of mine that should customize a bit the experience of Android users. The idea is that we should have customized navigation buttons in every Activity that allow the user going back and forth in the application. I understood one basically cannot hide the navigation buttons in Android (especially from 4.x onward); but one could override their behaviour. My question is two-fold: - Can one customize those buttons (changing their look&feel, size, ...) If that cannot be done: - Is it feasible to create a master class that extends Activity and that presents the buttons all the time (so that I could inherit this class whenever I need those buttons)? All feedbacks and criticisms are welcome.<br/> Also, if you have other ideas about how to solve this issue, or if you have done differently in one of your project, please point me in the right (*subjective*) direction. BEST.
android
android-layout
null
null
null
null
open
Override Android GUI === I am working on a special project of mine that should customize a bit the experience of Android users. The idea is that we should have customized navigation buttons in every Activity that allow the user going back and forth in the application. I understood one basically cannot hide the navigation buttons in Android (especially from 4.x onward); but one could override their behaviour. My question is two-fold: - Can one customize those buttons (changing their look&feel, size, ...) If that cannot be done: - Is it feasible to create a master class that extends Activity and that presents the buttons all the time (so that I could inherit this class whenever I need those buttons)? All feedbacks and criticisms are welcome.<br/> Also, if you have other ideas about how to solve this issue, or if you have done differently in one of your project, please point me in the right (*subjective*) direction. BEST.
0
11,542,351
07/18/2012 13:17:51
1,386,782
05/10/2012 10:04:06
35
0
Get only ONE player in kinect
i want to track only one person through the kinect and i wanna track its skeletal data and at the same time i want to show the depth from containing only that player but not the other players. Attached here is the code responsible for that, CAN anyone HELP ?!! void mySensor_AllFramesReady(object sender, AllFramesReadyEventArgs e) { if (closing) return; using (DepthImageFrame depthFrame = e.OpenDepthImageFrame()) { if (depthFrame == null) { return; } byte[] pixels = GenerateDepthImage(depthFrame); int stride = depthFrame.Width * 4; depthImage.Source = BitmapSource.Create(depthFrame.Width, depthFrame.Height, 96, 96, PixelFormats.Bgra32, null, pixels, stride); } //Get a skeleton Skeleton first = GetFirstSkeleton(e); ProcessSkeletalData(first, e); } and here is the method of generating depth image: private byte[] GenerateDepthImage(DepthImageFrame depthFrame) { //get the raw data from kinect with the depth for every pixel short[] rawDepthData = new short[depthFrame.PixelDataLength]; depthFrame.CopyPixelDataTo(rawDepthData); //use depthFrame to create the image to display on-screen //depthFrame contains color information for all pixels in image //Height x Width x 4 (Red, Green, Blue, empty byte) Byte[] pixels = new byte[depthFrame.Height * depthFrame.Width * 4]; //Bgr32 - Blue, Green, Red, empty byte //Bgra32 - Blue, Green, Red, transparency //You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent //hardcoded locations to Blue, Green, Red (BGR) index positions const int BlueIndex = 0; const int GreenIndex = 1; const int RedIndex = 2; const int AlphaIndex = 3; //loop through all distances //pick a RGB color based on distance for (int depthIndex = 0, colorIndex = 0; depthIndex < rawDepthData.Length && colorIndex < pixels.Length; depthIndex++, colorIndex += 4) { //get the player (requires skeleton tracking enabled for values) int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask; //gets the depth value int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth; pixels[colorIndex + BlueIndex] = 255; pixels[colorIndex + GreenIndex] = 255; pixels[colorIndex + RedIndex] = 255; pixels[colorIndex + AlphaIndex] = 0; //Color all players //Debug.WriteLine(player); if (player > 0 ) { pixels[colorIndex + BlueIndex] = 0; pixels[colorIndex + GreenIndex] = 0; pixels[colorIndex + RedIndex] = 0; pixels[colorIndex + AlphaIndex] = 40; } } return pixels; } The problem is here i have all the players UP TO 6 players detected by the depth image while only one by the skeleton tracking and i want to have only one in both, the same player. When i changed from player > 0 to player ==1 it didn't work because the player is not always with id 1. Any idea how to solve the matter ?! Thanks a lot, Michael
c#
wpf
tracking
kinect
skeleton
null
open
Get only ONE player in kinect === i want to track only one person through the kinect and i wanna track its skeletal data and at the same time i want to show the depth from containing only that player but not the other players. Attached here is the code responsible for that, CAN anyone HELP ?!! void mySensor_AllFramesReady(object sender, AllFramesReadyEventArgs e) { if (closing) return; using (DepthImageFrame depthFrame = e.OpenDepthImageFrame()) { if (depthFrame == null) { return; } byte[] pixels = GenerateDepthImage(depthFrame); int stride = depthFrame.Width * 4; depthImage.Source = BitmapSource.Create(depthFrame.Width, depthFrame.Height, 96, 96, PixelFormats.Bgra32, null, pixels, stride); } //Get a skeleton Skeleton first = GetFirstSkeleton(e); ProcessSkeletalData(first, e); } and here is the method of generating depth image: private byte[] GenerateDepthImage(DepthImageFrame depthFrame) { //get the raw data from kinect with the depth for every pixel short[] rawDepthData = new short[depthFrame.PixelDataLength]; depthFrame.CopyPixelDataTo(rawDepthData); //use depthFrame to create the image to display on-screen //depthFrame contains color information for all pixels in image //Height x Width x 4 (Red, Green, Blue, empty byte) Byte[] pixels = new byte[depthFrame.Height * depthFrame.Width * 4]; //Bgr32 - Blue, Green, Red, empty byte //Bgra32 - Blue, Green, Red, transparency //You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent //hardcoded locations to Blue, Green, Red (BGR) index positions const int BlueIndex = 0; const int GreenIndex = 1; const int RedIndex = 2; const int AlphaIndex = 3; //loop through all distances //pick a RGB color based on distance for (int depthIndex = 0, colorIndex = 0; depthIndex < rawDepthData.Length && colorIndex < pixels.Length; depthIndex++, colorIndex += 4) { //get the player (requires skeleton tracking enabled for values) int player = rawDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask; //gets the depth value int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth; pixels[colorIndex + BlueIndex] = 255; pixels[colorIndex + GreenIndex] = 255; pixels[colorIndex + RedIndex] = 255; pixels[colorIndex + AlphaIndex] = 0; //Color all players //Debug.WriteLine(player); if (player > 0 ) { pixels[colorIndex + BlueIndex] = 0; pixels[colorIndex + GreenIndex] = 0; pixels[colorIndex + RedIndex] = 0; pixels[colorIndex + AlphaIndex] = 40; } } return pixels; } The problem is here i have all the players UP TO 6 players detected by the depth image while only one by the skeleton tracking and i want to have only one in both, the same player. When i changed from player > 0 to player ==1 it didn't work because the player is not always with id 1. Any idea how to solve the matter ?! Thanks a lot, Michael
0
5,459,832
03/28/2011 13:40:57
4,376
09/03/2008 09:30:40
5,956
183
How can I make empty tags self-closing with Nokogiri?
I've created an XML template in ERB. I fill it in with data from a database during an export process. In some cases, there is a null value, in which case an element may be empty, like this: <someitem> </someitem> In that case, I'd like it to be converted into a self-closing tag: <someitem/> I'm trying to see how to get Nokogiri to do this, but I don't see it yet. Does anybody know how to make empty XML tags self-closing with Nokogiri?
ruby
xml
nokogiri
null
null
null
open
How can I make empty tags self-closing with Nokogiri? === I've created an XML template in ERB. I fill it in with data from a database during an export process. In some cases, there is a null value, in which case an element may be empty, like this: <someitem> </someitem> In that case, I'd like it to be converted into a self-closing tag: <someitem/> I'm trying to see how to get Nokogiri to do this, but I don't see it yet. Does anybody know how to make empty XML tags self-closing with Nokogiri?
0
5,459,834
03/28/2011 13:41:24
446,262
09/13/2010 11:41:58
93
0
hibernate mapping for list of classes
I have a class A{a_id,other properties List<B>) and class B{b_id,other properties). I have different tables for A and B and mapping table A_B(a_id,b_id,displayorder).Entries in table are constant . We can insert/update/delete from table A. I try to map it in hibernate using list but it is not inserting any row in A_B. What should be the ideal way to map above scenario.
hibernate
list
mapping
null
null
null
open
hibernate mapping for list of classes === I have a class A{a_id,other properties List<B>) and class B{b_id,other properties). I have different tables for A and B and mapping table A_B(a_id,b_id,displayorder).Entries in table are constant . We can insert/update/delete from table A. I try to map it in hibernate using list but it is not inserting any row in A_B. What should be the ideal way to map above scenario.
0
11,472,511
07/13/2012 14:27:25
650,148
03/08/2011 16:31:32
73
5
New row in asp:repeater by java script
In my aspx page I have repeater to show list something, I want to add new row and show it in repeater without postback. I will send date soon. I don't want to use AJAX How to add row to asp:repeater by JavaScript?
javascript
asp.net
repeater
null
null
null
open
New row in asp:repeater by java script === In my aspx page I have repeater to show list something, I want to add new row and show it in repeater without postback. I will send date soon. I don't want to use AJAX How to add row to asp:repeater by JavaScript?
0
11,472,513
07/13/2012 14:27:26
1,131,723
01/05/2012 09:08:02
36
0
UIButton changes position after build
I encountered a weird problem with a UIView in my Application. I placed some UIButtons, UISlider, etc. on a View. Which looks like this: ![storyboard][1] However, on the Simulator and on my iPhone it looks like this: ![simulator][2] The button "+1 min" is not aligned with the other controls anymore. The correct x-coordinate is 236. When I inspect the value in the debugger, I get 243. I already checked the storyboard-file, which has the right value. Why is it affecting only this button? And more importantly how do I fix this? [1]: http://i.stack.imgur.com/AVIwK.png [2]: http://i.stack.imgur.com/lEDrZ.png
xcode
uibutton
uistoryboard
null
null
null
open
UIButton changes position after build === I encountered a weird problem with a UIView in my Application. I placed some UIButtons, UISlider, etc. on a View. Which looks like this: ![storyboard][1] However, on the Simulator and on my iPhone it looks like this: ![simulator][2] The button "+1 min" is not aligned with the other controls anymore. The correct x-coordinate is 236. When I inspect the value in the debugger, I get 243. I already checked the storyboard-file, which has the right value. Why is it affecting only this button? And more importantly how do I fix this? [1]: http://i.stack.imgur.com/AVIwK.png [2]: http://i.stack.imgur.com/lEDrZ.png
0
11,472,519
07/13/2012 14:27:53
595,234
01/29/2011 19:50:30
429
0
Oracle copy data to another table
In the Oracle, I copy data from a backup to a new table, it doesn't work. what is the correct syntax ? Thanks select CODE, MESSAGE into EXCEPTION_CODES (CODE, MESSAGE) from Exception_code_tmp the error is **SQL Error: ORA-00905: missing keyword 00905. 00000 - "missing keyword"**
sql
oracle
null
null
null
null
open
Oracle copy data to another table === In the Oracle, I copy data from a backup to a new table, it doesn't work. what is the correct syntax ? Thanks select CODE, MESSAGE into EXCEPTION_CODES (CODE, MESSAGE) from Exception_code_tmp the error is **SQL Error: ORA-00905: missing keyword 00905. 00000 - "missing keyword"**
0
11,472,502
07/13/2012 14:27:01
1,472,219
06/21/2012 13:18:07
29
0
Why doesn't my regular expression implementation respect time?
html template starts as {@bigfoot} after running it through my code it is {*bigfoot} not Bigfoot, or Sasquatch as he is known in some parts, is a giant ape like man. It is likely that his diet consists of ... See how the second regular expression is getting done before the first? Why? html = html.replace(new RegExp("{@" + prop + "}", "g"), object[prop]); html = html.replace(new RegExp("@", "g"), "*");
javascript
regex
ecma
null
null
07/14/2012 13:24:55
not a real question
Why doesn't my regular expression implementation respect time? === html template starts as {@bigfoot} after running it through my code it is {*bigfoot} not Bigfoot, or Sasquatch as he is known in some parts, is a giant ape like man. It is likely that his diet consists of ... See how the second regular expression is getting done before the first? Why? html = html.replace(new RegExp("{@" + prop + "}", "g"), object[prop]); html = html.replace(new RegExp("@", "g"), "*");
1
11,471,987
07/13/2012 13:58:38
1,278,731
03/19/2012 14:08:06
10
0
display the page source of a web page in php
How do i retrieve the entire page source info of a particular web page in a string variable and echo it in php. i am new to php and have no idea of doing so can any one give me the complete source code of it. Following is my source code: <?php $dom = new DOMDocument; $dom->loadHtmlFile('http://www.google.com'); $xpath = new DOMXPath($dom); $elements = $xpath->query('//input[@name="session_id"]'); if ($elements->length) { echo "found: ", $elements->item(0)->getAttribute('value'); } else { echo "not found"; } } ?>
php
null
null
null
null
null
open
display the page source of a web page in php === How do i retrieve the entire page source info of a particular web page in a string variable and echo it in php. i am new to php and have no idea of doing so can any one give me the complete source code of it. Following is my source code: <?php $dom = new DOMDocument; $dom->loadHtmlFile('http://www.google.com'); $xpath = new DOMXPath($dom); $elements = $xpath->query('//input[@name="session_id"]'); if ($elements->length) { echo "found: ", $elements->item(0)->getAttribute('value'); } else { echo "not found"; } } ?>
0
11,455,243
07/12/2012 15:27:33
1,276,068
03/17/2012 18:01:43
93
10
Product+Profile+allocation or someone else close the app
Hi every one I have the next issue I'm trying to test my app about memory leaks, allocation , etc. But when I make Product+Profile I select Allocation and the profile begin but something wrong happen and the profile stop after 1 second and instantly close the app but dont say me nothing about memory warning ore something about close the app. The app move fine everything is ok don't crash but I when I make the profile with some one like allocation, leaks before the automatic close what I mentioned the app can't be reopened just begin to start and close. Why this happen to me? what can I do?
iphone
objective-c
ios
xcode
ipad
null
open
Product+Profile+allocation or someone else close the app === Hi every one I have the next issue I'm trying to test my app about memory leaks, allocation , etc. But when I make Product+Profile I select Allocation and the profile begin but something wrong happen and the profile stop after 1 second and instantly close the app but dont say me nothing about memory warning ore something about close the app. The app move fine everything is ok don't crash but I when I make the profile with some one like allocation, leaks before the automatic close what I mentioned the app can't be reopened just begin to start and close. Why this happen to me? what can I do?
0
11,455,245
07/12/2012 15:27:45
100,839
05/04/2009 12:09:09
642
16
Is there a way to have cross-project fixVersions in Jira?
We have several, independent teams that have their own priorities and work. Yet the teams are all on the same code-base, so when we deploy, everyone's code goes out at the same time. How have you dealt with this using Jira? A couple of possibilities come to mind: * if there were cross-project fixVersions, that would be ideal, as each release would be synchronized * we could use tags and update all the filters everyone uses to segment what people see * we could manually keep the fixVersions in sync, ug * we could use their API to manage fixVersions, to keep them in sync * something else entirely
jira
null
null
null
null
null
open
Is there a way to have cross-project fixVersions in Jira? === We have several, independent teams that have their own priorities and work. Yet the teams are all on the same code-base, so when we deploy, everyone's code goes out at the same time. How have you dealt with this using Jira? A couple of possibilities come to mind: * if there were cross-project fixVersions, that would be ideal, as each release would be synchronized * we could use tags and update all the filters everyone uses to segment what people see * we could manually keep the fixVersions in sync, ug * we could use their API to manage fixVersions, to keep them in sync * something else entirely
0
11,455,246
07/12/2012 15:27:51
448,250
09/15/2010 09:57:21
82
1
How the packagemanager gets the information in Android?
I came to know that after booting device, all the system apps and market apps( if there) will be loaded right. These all things will be handled by PackageManager means which are the already installed apps, based on that it will load all the apps. But how the PackageManager gets the information about installed apps in the device. I want to know to know more about PackageMAnager. I have gone through developer.android.com, but I want to know more about this. Can anybody help me regarding on the same. Regards Abhilash
android
null
null
null
null
null
open
How the packagemanager gets the information in Android? === I came to know that after booting device, all the system apps and market apps( if there) will be loaded right. These all things will be handled by PackageManager means which are the already installed apps, based on that it will load all the apps. But how the PackageManager gets the information about installed apps in the device. I want to know to know more about PackageMAnager. I have gone through developer.android.com, but I want to know more about this. Can anybody help me regarding on the same. Regards Abhilash
0
11,567,920
07/19/2012 19:27:40
300,887
03/24/2010 14:31:08
32
2
Catching errors in Workflows
I've been playing around with PowerShell Workflows in PS 3.0 RC, and so far, I am in love. However, there are many limitations on the sorts of things you can and can't use inside workflows. The one I'm hung up on currently is the $Error variable. When calling my workflow, I receive the following error: The variable 'Error' cannot be used in a script workflow. Does anyone know how to catch the text of an error inside a workflow, or suggestions on alternative methods of error catching if you aren't familiar with workflows? I've been searching around, and can find almost no information on the specifics of workflows. Thanks! I'm trying to do something like this: workflow Get-LoggedOnUser{ param([array]$computers,[System.Management.Automation.PSCredential]$credential) foreach -parallel($computer in $computers) { $response = $null $errorMessage = $null If (Test-Connection -ComputerName $computer -count 1 -quiet) { Try { $ErrorActionPreference = "Stop" $response = Get-WMIObject -PSCredential $credential -PSComputername $computer -query "Select UserName from Win32_ComputerSystem" $Error } Catch { $errorMessage = $Error[0].exception } Finally { $errorActionPreference = "Continue" } } Else { $errorMessage = "No response" } $output = [PSCustomObject]@{ Name = $computer User = $response.UserName Error = $errorMessage } $output } }
powershell
powershell-v3.0
null
null
null
null
open
Catching errors in Workflows === I've been playing around with PowerShell Workflows in PS 3.0 RC, and so far, I am in love. However, there are many limitations on the sorts of things you can and can't use inside workflows. The one I'm hung up on currently is the $Error variable. When calling my workflow, I receive the following error: The variable 'Error' cannot be used in a script workflow. Does anyone know how to catch the text of an error inside a workflow, or suggestions on alternative methods of error catching if you aren't familiar with workflows? I've been searching around, and can find almost no information on the specifics of workflows. Thanks! I'm trying to do something like this: workflow Get-LoggedOnUser{ param([array]$computers,[System.Management.Automation.PSCredential]$credential) foreach -parallel($computer in $computers) { $response = $null $errorMessage = $null If (Test-Connection -ComputerName $computer -count 1 -quiet) { Try { $ErrorActionPreference = "Stop" $response = Get-WMIObject -PSCredential $credential -PSComputername $computer -query "Select UserName from Win32_ComputerSystem" $Error } Catch { $errorMessage = $Error[0].exception } Finally { $errorActionPreference = "Continue" } } Else { $errorMessage = "No response" } $output = [PSCustomObject]@{ Name = $computer User = $response.UserName Error = $errorMessage } $output } }
0
11,567,923
07/19/2012 19:27:48
1,217,150
02/17/2012 21:02:01
340
7
c# create 7z archive, then Can not open file "name.7z" as an archive
I am trying to zip some folders. They have different paths, will not belong to the same directory. I tested the command line arguments that I would give, and it works, but I can't get it to work from c#: string destination = "some path\\name.7z"; string pathToZip = "path to zip\\7z.exe"; // or 7za.exe ProcessStartInfo p = new ProcessStartInfo(); p.FileName = pathToZip; p.Arguments = "a \"" + destination + "\" \""; // room for the foreach - but even one directory doesn't work right now p.Arguments += directoryPath + "\" \""; p.Arguments += "\" -mx=9 -aoa"; Process x = Process.Start(p); With 7z.exe i get a blink; With 7za.exe, I get the typical command-line zip sequence, with files zipping through, adding to archive, and an archive gets created. Then I go to it and right-click, open or double-click... and I get that it is an invalid archive (`Can not open file "name.7z" as an archive`). Try command line, with 7za, to extract - same thing.
c#
archive
7zip
null
null
null
open
c# create 7z archive, then Can not open file "name.7z" as an archive === I am trying to zip some folders. They have different paths, will not belong to the same directory. I tested the command line arguments that I would give, and it works, but I can't get it to work from c#: string destination = "some path\\name.7z"; string pathToZip = "path to zip\\7z.exe"; // or 7za.exe ProcessStartInfo p = new ProcessStartInfo(); p.FileName = pathToZip; p.Arguments = "a \"" + destination + "\" \""; // room for the foreach - but even one directory doesn't work right now p.Arguments += directoryPath + "\" \""; p.Arguments += "\" -mx=9 -aoa"; Process x = Process.Start(p); With 7z.exe i get a blink; With 7za.exe, I get the typical command-line zip sequence, with files zipping through, adding to archive, and an archive gets created. Then I go to it and right-click, open or double-click... and I get that it is an invalid archive (`Can not open file "name.7z" as an archive`). Try command line, with 7za, to extract - same thing.
0
11,567,927
07/19/2012 19:28:26
372,519
06/21/2010 20:00:43
1,243
1
Ninject MVC3 not working: Object reference not set to an instance of an object
I created an mvc4 project in visual studio 2012 RC, and added the ninject.mvc3 package using nuget. It created the standard NinjectWebCommon.cs file and I edited the RegisterServices method like so: private static void RegisterServices(IKernel kernel) { kernel.Bind<IProfileRepository>().To<ProfileRepository>().InSingletonScope(); } Here is my interface and profile repository class: public interface IProfileRepository { void CreateProfile(UserProfile profile); } public class ProfileRepository : IProfileRepository { private EFDbContext context = new EFDbContext(); public void CreateProfile(UserProfile userProfile) { context.UserProfiles.Add(userProfile); context.SaveChanges(); } } I want to access this my IProfileRepository in my Account Controller like so: private readonly IProfileRepository profileRepository; public AccountController(IProfileRepository repo){ profileRepository = repo; } [AllowAnonymous] [HttpPost] public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user MembershipCreateStatus createStatus; Membership.CreateUser(model.UserName, model.Password, model.Email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus); if (createStatus == MembershipCreateStatus.Success) { profileRepository.CreateProfile(new UserProfile { UserId = (Guid)Membership.GetUser(HttpContext.User.Identity.Name).ProviderUserKey, FirstName = model.FirstName, LastName = model.LastName, School = model.School, Major = model.Major }); FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false); return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", ErrorCodeToString(createStatus)); } } // If we got this far, something failed, redisplay form return View(model); } I get an `Object reference not set to an instance of an object` error when my `profileRepostory` object is called, hence its probably not being injected. Does anyone know whats wrong? Thanks!
c#
asp.net-mvc
dependency-injection
ninject
asp.net-mvc-4
null
open
Ninject MVC3 not working: Object reference not set to an instance of an object === I created an mvc4 project in visual studio 2012 RC, and added the ninject.mvc3 package using nuget. It created the standard NinjectWebCommon.cs file and I edited the RegisterServices method like so: private static void RegisterServices(IKernel kernel) { kernel.Bind<IProfileRepository>().To<ProfileRepository>().InSingletonScope(); } Here is my interface and profile repository class: public interface IProfileRepository { void CreateProfile(UserProfile profile); } public class ProfileRepository : IProfileRepository { private EFDbContext context = new EFDbContext(); public void CreateProfile(UserProfile userProfile) { context.UserProfiles.Add(userProfile); context.SaveChanges(); } } I want to access this my IProfileRepository in my Account Controller like so: private readonly IProfileRepository profileRepository; public AccountController(IProfileRepository repo){ profileRepository = repo; } [AllowAnonymous] [HttpPost] public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user MembershipCreateStatus createStatus; Membership.CreateUser(model.UserName, model.Password, model.Email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus); if (createStatus == MembershipCreateStatus.Success) { profileRepository.CreateProfile(new UserProfile { UserId = (Guid)Membership.GetUser(HttpContext.User.Identity.Name).ProviderUserKey, FirstName = model.FirstName, LastName = model.LastName, School = model.School, Major = model.Major }); FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false); return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", ErrorCodeToString(createStatus)); } } // If we got this far, something failed, redisplay form return View(model); } I get an `Object reference not set to an instance of an object` error when my `profileRepostory` object is called, hence its probably not being injected. Does anyone know whats wrong? Thanks!
0
11,567,929
07/19/2012 19:28:29
1,492,035
06/29/2012 19:42:57
1
0
Need to run a function based on conditional
I'm trying to assign a function to a couple of checkboxes, but I only want them added based on a condition, in this case the step number of the form. This is a roundabout way of making the checkboxes readOnly AFTER they have been selected (or not). So, at step 1 I want the user to choose cb1 or cb2, but at step 2 I want to assign the function that will not let the checkboxes values be changed. What am I doing wrong? function functionOne(){this.checked=!this.checked}; if (document.getElementById("stepNumber").value==2){ document.getElementById("cb1").setAttribute("onkeydown", "functionOne(this)"); document.getElementById("cb2").setAttribute("onkeydown", "functionOne(this)");}
javascript
readonly
null
null
null
null
open
Need to run a function based on conditional === I'm trying to assign a function to a couple of checkboxes, but I only want them added based on a condition, in this case the step number of the form. This is a roundabout way of making the checkboxes readOnly AFTER they have been selected (or not). So, at step 1 I want the user to choose cb1 or cb2, but at step 2 I want to assign the function that will not let the checkboxes values be changed. What am I doing wrong? function functionOne(){this.checked=!this.checked}; if (document.getElementById("stepNumber").value==2){ document.getElementById("cb1").setAttribute("onkeydown", "functionOne(this)"); document.getElementById("cb2").setAttribute("onkeydown", "functionOne(this)");}
0
11,567,930
07/19/2012 19:28:31
969,534
09/28/2011 16:35:45
1,092
61
GTK errors when importing pynotify
When importing pynotify I always get those nasty GTK-Warnings: ** (process:25512): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags' The problem is, I don't know how to suppress them, I tried: >>> import sys >>> from io import BytesIO >>> sys.stderr = BytesIO() >>> sys.stdout = BytesIO() >>> print 's' >>> import pynotify ** (process:25512): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags' Doesn't work, another thing I tried: with warnings.catch_warnings(): warnings.simplefilter('error') import pynotify This also doesn't help. Seems like the GTK messages arrive on a different `stderr`. Any ideas how to suppress them?
python
error-message
gtk
null
null
null
open
GTK errors when importing pynotify === When importing pynotify I always get those nasty GTK-Warnings: ** (process:25512): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags' The problem is, I don't know how to suppress them, I tried: >>> import sys >>> from io import BytesIO >>> sys.stderr = BytesIO() >>> sys.stdout = BytesIO() >>> print 's' >>> import pynotify ** (process:25512): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags' ** (process:25512): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags' Doesn't work, another thing I tried: with warnings.catch_warnings(): warnings.simplefilter('error') import pynotify This also doesn't help. Seems like the GTK messages arrive on a different `stderr`. Any ideas how to suppress them?
0
11,567,933
07/19/2012 19:28:38
1,060,498
11/22/2011 19:30:34
23
0
How can I add an unbounded checkbox column to a gridview that is bounded to a datasource?
The gridview I have is bounded by an SQLDataSource. I want to add a checkbox for each row that is populated. How can I do this and how can I have the checkboxes postback when checked/unchecked? This is my gridview code: <asp:GridView ID="GridView2" runat="server" CellPadding="3" ForeColor="#333333" GridLines="None" DataSourceID="dsWarningDay" AllowSorting="True" SortedAscendingHeaderStyle-CssClass="sortasc-header" SortedDescendingHeaderStyle-CssClass="sortdesc-header" AllowPaging="True" PageSize="17" PagerSettings-Mode="NextPreviousFirstLast" ShowHeaderWhenEmpty="True" PagerStyle-Font-Names="WebDings" PagerStyle-Font-Size="Medium" PagerSettings-FirstPageText=" 7 " PagerSettings-PreviousPageText=" 3 " PagerSettings-NextPageText=" 4 " PagerSettings-LastPageText=" 8 " Font-Size="Small"> <AlternatingRowStyle BackColor="White" ForeColor="#333333" /> <EditRowStyle BackColor="#999999" /> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <PagerSettings FirstPageText=" 7 " LastPageText=" 8 " Mode="NextPreviousFirstLast" NextPageText=" 4 " PreviousPageText=" 3 "></PagerSettings> <PagerStyle BackColor="#5D7B9D" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#DCE2E8" ForeColor="#333333" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingHeaderStyle CssClass="sortasc-header"></SortedAscendingHeaderStyle> <SortedDescendingHeaderStyle CssClass="sortdesc-header"></SortedDescendingHeaderStyle> </asp:GridView>
c#
asp.net
null
null
null
null
open
How can I add an unbounded checkbox column to a gridview that is bounded to a datasource? === The gridview I have is bounded by an SQLDataSource. I want to add a checkbox for each row that is populated. How can I do this and how can I have the checkboxes postback when checked/unchecked? This is my gridview code: <asp:GridView ID="GridView2" runat="server" CellPadding="3" ForeColor="#333333" GridLines="None" DataSourceID="dsWarningDay" AllowSorting="True" SortedAscendingHeaderStyle-CssClass="sortasc-header" SortedDescendingHeaderStyle-CssClass="sortdesc-header" AllowPaging="True" PageSize="17" PagerSettings-Mode="NextPreviousFirstLast" ShowHeaderWhenEmpty="True" PagerStyle-Font-Names="WebDings" PagerStyle-Font-Size="Medium" PagerSettings-FirstPageText=" 7 " PagerSettings-PreviousPageText=" 3 " PagerSettings-NextPageText=" 4 " PagerSettings-LastPageText=" 8 " Font-Size="Small"> <AlternatingRowStyle BackColor="White" ForeColor="#333333" /> <EditRowStyle BackColor="#999999" /> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <PagerSettings FirstPageText=" 7 " LastPageText=" 8 " Mode="NextPreviousFirstLast" NextPageText=" 4 " PreviousPageText=" 3 "></PagerSettings> <PagerStyle BackColor="#5D7B9D" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#DCE2E8" ForeColor="#333333" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingHeaderStyle CssClass="sortasc-header"></SortedAscendingHeaderStyle> <SortedDescendingHeaderStyle CssClass="sortdesc-header"></SortedDescendingHeaderStyle> </asp:GridView>
0
11,567,274
07/19/2012 18:41:27
1,036,284
11/08/2011 19:05:15
13
0
Error loading BuildConfig (Grails 2.1.0)
I've been racking my brain for hours trying to figure this out. Whenever I try to perform any kind of action to my newly created Grails project (with a fresh Grails install), I get this error message: Error There was an error loading the BuildConfig: ivy pattern must be absolute: ${HOME}/.m2/alpha/repository/[organisation]/[module]/[revision]/[module]-[revision](- [classifier]).pom (Use --stacktrace to see the full trace) I can deduce that there's a problem with my installation, but its a fresh install as I said so I'm not sure what could have caused this problem already. I'm running Win7. Any help would be much appreciated.
java
grails
groovy
springsource
null
null
open
Error loading BuildConfig (Grails 2.1.0) === I've been racking my brain for hours trying to figure this out. Whenever I try to perform any kind of action to my newly created Grails project (with a fresh Grails install), I get this error message: Error There was an error loading the BuildConfig: ivy pattern must be absolute: ${HOME}/.m2/alpha/repository/[organisation]/[module]/[revision]/[module]-[revision](- [classifier]).pom (Use --stacktrace to see the full trace) I can deduce that there's a problem with my installation, but its a fresh install as I said so I'm not sure what could have caused this problem already. I'm running Win7. Any help would be much appreciated.
0
11,567,935
07/19/2012 19:28:47
605,803
02/07/2011 00:31:28
61
2
Php and Ajax listener for a remote response
I need a guidance on how to achieve this: User comes to www.mysite.com/submit.php and fill out the form where they need to enter a phone number (for verification purposes) and what I want to happen is when form is submitted: 1. Popup - or some overlay that will tell them... PLEASE WAIT FOR A CALL (and will prevent them from clicking links in the background) 2. In the background request is sent to remote server that will do the call and ask them to enter a pin once they answer the phone. 3. I will get a response from server in GET format like: www.mysite.com/submit.php?pincheck=success 4. Now based on ?pincheck (success or failed) I want to to redirect them to corresponding pages (success.php or failed.php) Any ideas how to do this and what to use ? Ajax.. Jquery ???
jquery
ajax
listener
null
null
null
open
Php and Ajax listener for a remote response === I need a guidance on how to achieve this: User comes to www.mysite.com/submit.php and fill out the form where they need to enter a phone number (for verification purposes) and what I want to happen is when form is submitted: 1. Popup - or some overlay that will tell them... PLEASE WAIT FOR A CALL (and will prevent them from clicking links in the background) 2. In the background request is sent to remote server that will do the call and ask them to enter a pin once they answer the phone. 3. I will get a response from server in GET format like: www.mysite.com/submit.php?pincheck=success 4. Now based on ?pincheck (success or failed) I want to to redirect them to corresponding pages (success.php or failed.php) Any ideas how to do this and what to use ? Ajax.. Jquery ???
0
11,567,936
07/19/2012 19:28:51
878,537
08/04/2011 12:01:24
83
9
Wierd Samsung P1000 getRotation issue
For some reason only on my P1000 device, the getRotation() value returned is wrong.. it's 90 degrees from the value i should get, i can tell by watching the values i get when touching the screen using `adb shell getevent` Did anyone encounter this issue, or know how to deal with it? Thanks, Vlad
android
rotation
value
touchscreen
null
null
open
Wierd Samsung P1000 getRotation issue === For some reason only on my P1000 device, the getRotation() value returned is wrong.. it's 90 degrees from the value i should get, i can tell by watching the values i get when touching the screen using `adb shell getevent` Did anyone encounter this issue, or know how to deal with it? Thanks, Vlad
0
11,734,414
07/31/2012 06:33:44
574,771
01/13/2011 19:31:26
82
3
how do i wait for NSStream to open or fail?
Currently when i open an NSInputStream (for example) I get an event indicating that it has opened completely. Prior to that event, if I poll the stream status, I see it is in the process of opening. But if it fails, there is no event at all. I never get told that the opening failed to complete. What I want to do is write efficient code that waits for either the stream to open or fail to open. Is there any such way using NSStream et al? I also thought of creating an event that I could wait on for a set period of time. If the connection succeeded, the event would signal and pop me out of my wait state. If the timeout occurred, I could test the status and see if it failed or go back into the wait state again. But of course this is plan B, not eloquent and not efficient. Any help would be appreciated.
ios
nsstream
null
null
null
null
open
how do i wait for NSStream to open or fail? === Currently when i open an NSInputStream (for example) I get an event indicating that it has opened completely. Prior to that event, if I poll the stream status, I see it is in the process of opening. But if it fails, there is no event at all. I never get told that the opening failed to complete. What I want to do is write efficient code that waits for either the stream to open or fail to open. Is there any such way using NSStream et al? I also thought of creating an event that I could wait on for a set period of time. If the connection succeeded, the event would signal and pop me out of my wait state. If the timeout occurred, I could test the status and see if it failed or go back into the wait state again. But of course this is plan B, not eloquent and not efficient. Any help would be appreciated.
0
11,734,416
07/31/2012 06:33:51
1,238,164
02/28/2012 15:06:15
295
37
Is it possible to add View into included layout in xml?
I was wondering if the following could be achieved in xml: I have this simple layout like following: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="Address: " android:textSize="14dp" /> </LinearLayout> When I include this layout in other xml, is it possible to add another TextView in it, so the result would look like: Address: Text of another textview. I would like to get this done in xml, not programmatically. Thanks.
android
android-layout
null
null
null
null
open
Is it possible to add View into included layout in xml? === I was wondering if the following could be achieved in xml: I have this simple layout like following: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="Address: " android:textSize="14dp" /> </LinearLayout> When I include this layout in other xml, is it possible to add another TextView in it, so the result would look like: Address: Text of another textview. I would like to get this done in xml, not programmatically. Thanks.
0
11,734,534
07/31/2012 06:44:26
1,564,826
07/31/2012 06:01:53
1
0
how to access all the properties of excel in asp.net like sheet name name, font, colour, bold, italic etc
hey i have done coding to upload and display the excel file in asp.net but the problem is :......................... 1)how to know the sheet name of the excel file (i am taking sheet1 as default sheet but if user is trying to upload excel file having different sheet name then it is showing error ..................................................... 2)how to know the properties of the excel file like the headers of the excel file in which colour the data is having what size and font? So that my output that i am displaying will look the same as in excel file .....................................................................Below is my code ................................................................... using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb; namespace ExcelToAsp { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void BtnUpload_Click(object sender, EventArgs e) { if ((TxtFilePath.HasFile)) { OleDbConnection conn = new OleDbConnection(); OleDbCommand cmd = new OleDbCommand(); OleDbDataAdapter da = new OleDbDataAdapter(); DataSet ds = new DataSet(); string query = null; string connString = ""; string strFileName = DateTime.Now.ToString("ddMMyyyy_HHmmss"); string strFileType = System.IO.Path.GetExtension(TxtFilePath.FileName).ToString().ToLower(); //Check file type if (strFileType == ".xls" || strFileType == ".xlsx") TxtFilePath.SaveAs(Server.MapPath("~/UploadedExcel/" + strFileName + strFileType)); else { LblMsg.Text = "Only excel files allowed"; LblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Visible = true; return; } string strNewPath = Server.MapPath("~/UploadedExcel/" + strFileName + strFileType); //Connection String to Excel Workbook if (strFileType.Trim() == ".xls") { connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strNewPath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""; } else if (strFileType.Trim() == ".xlsx") { connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strNewPath + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\""; } query = "SELECT * FROM [Sheet1$]";//query = "SELECT [Country],[Capital] FROM [Sheet1$] WHERE[Currency]=’Rupee’"//query = "SELECT [Country],[Capital] FROM [Sheet1$]" //Create the connection object conn = new OleDbConnection(connString); //Open connection if (conn.State == ConnectionState.Closed) conn.Open(); //Create the command object cmd = new OleDbCommand(query, conn); da = new OleDbDataAdapter(cmd); ds = new DataSet(); da.Fill(ds); GrvExcelData.DataSource = ds.Tables[0]; GrvExcelData.DataBind(); LblMsg.Text = "Data retrieved successfully! Total Records:" + ds.Tables[0].Rows.Count; LblMsg.ForeColor = System.Drawing.Color.Green; LblMsg.Visible = true; da.Dispose(); conn.Close(); conn.Dispose(); } else { LblMsg.Text = "Please select an excel file first"; LblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Visible = true; } } } }
asp.net
.net
xml
excel
null
null
open
how to access all the properties of excel in asp.net like sheet name name, font, colour, bold, italic etc === hey i have done coding to upload and display the excel file in asp.net but the problem is :......................... 1)how to know the sheet name of the excel file (i am taking sheet1 as default sheet but if user is trying to upload excel file having different sheet name then it is showing error ..................................................... 2)how to know the properties of the excel file like the headers of the excel file in which colour the data is having what size and font? So that my output that i am displaying will look the same as in excel file .....................................................................Below is my code ................................................................... using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb; namespace ExcelToAsp { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void BtnUpload_Click(object sender, EventArgs e) { if ((TxtFilePath.HasFile)) { OleDbConnection conn = new OleDbConnection(); OleDbCommand cmd = new OleDbCommand(); OleDbDataAdapter da = new OleDbDataAdapter(); DataSet ds = new DataSet(); string query = null; string connString = ""; string strFileName = DateTime.Now.ToString("ddMMyyyy_HHmmss"); string strFileType = System.IO.Path.GetExtension(TxtFilePath.FileName).ToString().ToLower(); //Check file type if (strFileType == ".xls" || strFileType == ".xlsx") TxtFilePath.SaveAs(Server.MapPath("~/UploadedExcel/" + strFileName + strFileType)); else { LblMsg.Text = "Only excel files allowed"; LblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Visible = true; return; } string strNewPath = Server.MapPath("~/UploadedExcel/" + strFileName + strFileType); //Connection String to Excel Workbook if (strFileType.Trim() == ".xls") { connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strNewPath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""; } else if (strFileType.Trim() == ".xlsx") { connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strNewPath + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\""; } query = "SELECT * FROM [Sheet1$]";//query = "SELECT [Country],[Capital] FROM [Sheet1$] WHERE[Currency]=’Rupee’"//query = "SELECT [Country],[Capital] FROM [Sheet1$]" //Create the connection object conn = new OleDbConnection(connString); //Open connection if (conn.State == ConnectionState.Closed) conn.Open(); //Create the command object cmd = new OleDbCommand(query, conn); da = new OleDbDataAdapter(cmd); ds = new DataSet(); da.Fill(ds); GrvExcelData.DataSource = ds.Tables[0]; GrvExcelData.DataBind(); LblMsg.Text = "Data retrieved successfully! Total Records:" + ds.Tables[0].Rows.Count; LblMsg.ForeColor = System.Drawing.Color.Green; LblMsg.Visible = true; da.Dispose(); conn.Close(); conn.Dispose(); } else { LblMsg.Text = "Please select an excel file first"; LblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Visible = true; } } } }
0
11,734,627
07/31/2012 06:50:02
1,495,318
07/02/2012 06:53:33
89
7
Do I need to buy SSL certificate or I can use OpenSSL if I'm paying to users?
<p>As I understand from information, that I found I can use OpenSSL when moving my application to production. <p>I need to know is it necessary in my case: my application will be paying users for using some javascript. <p><b>QUESTION: Do I need to buy SSL sertificate or I can use OpenSSL ?</b>
ssl
paypal
openssl
ssl-certificate
null
07/31/2012 13:49:52
off topic
Do I need to buy SSL certificate or I can use OpenSSL if I'm paying to users? === <p>As I understand from information, that I found I can use OpenSSL when moving my application to production. <p>I need to know is it necessary in my case: my application will be paying users for using some javascript. <p><b>QUESTION: Do I need to buy SSL sertificate or I can use OpenSSL ?</b>
2
11,734,628
07/31/2012 06:50:05
1,564,889
07/31/2012 06:38:59
1
0
Implementing Sharedpreference
This is my code. I have a text view and 2 buttons accept and reject. When user clicks the accept button i used a shared preference to save the status as 100. Next time when user log in i need to check if the user has already clicked the accept button. If he has already accepted, then i shoud go to the home activity. Once accepted i dont need this activity to be displayed. Help!! public int kill; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Toast.makeText(Eula.this, "Status of the app is "+kill, Toast.LENGTH_LONG).show(); if(kill==100) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("mobi.infoways.triviavs1_0","mobi.infoways.triviavs1_0.Home")); startActivity(intent); } setContentView(R.layout.eulatxt); Intent i2 = getIntent(); addListenerOnButton(); } private void addListenerOnButton() { TextView t = (TextView) findViewById(R.id.txtv1); t.setText(f); Button Accept = (Button) findViewById(R.id.btn1); Accept.setOnClickListener(startListener); Button Reject = (Button) findViewById(R.id.btn2); Reject.setOnClickListener(startListener); } OnClickListener startListener = new OnClickListener() { public void onClick(View v) { switch (v.getId()) { case R.id.btn1: SharedPreferences prefs = getPreferences(MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("storedInt",100); editor.commit(); kill = prefs.getInt("storedInt", 100); Toast.makeText(Eula.this, "status =" + kill, Toast.LENGTH_LONG).show(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("mobi.infoways.triviavs1_0","mobi.infoways.triviavs1_0.Home")); startActivity(intent); break; case R.id.btn2: Toast.makeText(Eula.this, "button 2 clicked", Toast.LENGTH_SHORT).show(); Eula.this.finish(); break; } }; }
android
sharedpreferences
null
null
null
null
open
Implementing Sharedpreference === This is my code. I have a text view and 2 buttons accept and reject. When user clicks the accept button i used a shared preference to save the status as 100. Next time when user log in i need to check if the user has already clicked the accept button. If he has already accepted, then i shoud go to the home activity. Once accepted i dont need this activity to be displayed. Help!! public int kill; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Toast.makeText(Eula.this, "Status of the app is "+kill, Toast.LENGTH_LONG).show(); if(kill==100) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("mobi.infoways.triviavs1_0","mobi.infoways.triviavs1_0.Home")); startActivity(intent); } setContentView(R.layout.eulatxt); Intent i2 = getIntent(); addListenerOnButton(); } private void addListenerOnButton() { TextView t = (TextView) findViewById(R.id.txtv1); t.setText(f); Button Accept = (Button) findViewById(R.id.btn1); Accept.setOnClickListener(startListener); Button Reject = (Button) findViewById(R.id.btn2); Reject.setOnClickListener(startListener); } OnClickListener startListener = new OnClickListener() { public void onClick(View v) { switch (v.getId()) { case R.id.btn1: SharedPreferences prefs = getPreferences(MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("storedInt",100); editor.commit(); kill = prefs.getInt("storedInt", 100); Toast.makeText(Eula.this, "status =" + kill, Toast.LENGTH_LONG).show(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("mobi.infoways.triviavs1_0","mobi.infoways.triviavs1_0.Home")); startActivity(intent); break; case R.id.btn2: Toast.makeText(Eula.this, "button 2 clicked", Toast.LENGTH_SHORT).show(); Eula.this.finish(); break; } }; }
0
11,734,630
07/31/2012 06:50:09
1,268,559
03/14/2012 09:10:20
4
0
Too Few Parameters Expected 1-MS Access error
I am using front end as Business Objects and backend MS Access database. I have one field with following syntax and when i pull this field in query getting error like "Too Few Parameters Expected 1" Format(Votes.`Vote Received`,"yyyymm") This syntax is parsing but when pulled this object in query giving error. I think it's something related to quotes on field name but this how that field is named. When i am pulling just below field query not giving error. Votes.`Vote Received` Appreciate your inputs..
ms-access
null
null
null
null
null
open
Too Few Parameters Expected 1-MS Access error === I am using front end as Business Objects and backend MS Access database. I have one field with following syntax and when i pull this field in query getting error like "Too Few Parameters Expected 1" Format(Votes.`Vote Received`,"yyyymm") This syntax is parsing but when pulled this object in query giving error. I think it's something related to quotes on field name but this how that field is named. When i am pulling just below field query not giving error. Votes.`Vote Received` Appreciate your inputs..
0
11,734,618
07/31/2012 06:49:16
682,102
03/29/2011 13:12:02
57
1
check if point exists in QPainterPath
I have an application where I place several curves in my scene. I was looking for an easy way to detect if the user pressed on the line. boundingRect() and intersects() were too inaccurate when I was having multiple lines drawn. So I made this funtion, which works like a dream except when the lines are vertical. selectionMargin is a global variable set by the user (default = 0.5). It adjusts the margin for how accurate the selection check should be. Names are based on the linear function for each subline, y = ax + b. Pos is the position from the mousePressEvent. bool GraphApp::pointInPath(QPainterPath path, QPointF pos){ qreal posY = pos.y(); qreal posX = pos.x(); for (int i = 0; i < path.elementCount()-1; ++i) { if(posX < path.elementAt(i+1).x && posX > path.elementAt(i).x){ qreal dy = path.elementAt(i+1).y - path.elementAt(i).y; qreal dx = path.elementAt(i+1).x - path.elementAt(i).x; qreal a = dy / dx; qreal b = path.elementAt(i).y - (path.elementAt(i).x * a); if(selectionMargin==0.0) selectionMargin = 0.5; qreal lowerBound = (a*posX + b) + selectionMargin; qreal upperBound = (a*posX + b) - selectionMargin; if(posY < lowerBound && posY > upperBound){ return true; } } } return false; } So it seems like this function returns false when I send a MousePressEvent from the area coverd by the vertical lines. My first thought is the if-sentence: if(posX < path.elementAt(i+1).x && posX > path.elementAt(i).x) Any other ideas for how I can implement this without the if-sentence? I have also seen other people struggling with finding a nice way to check if a QPainterPath contains a point without the boundingRect() and intersects() functions, so this is maybe to use for other people as well :)
c++
algorithm
qt
null
null
null
open
check if point exists in QPainterPath === I have an application where I place several curves in my scene. I was looking for an easy way to detect if the user pressed on the line. boundingRect() and intersects() were too inaccurate when I was having multiple lines drawn. So I made this funtion, which works like a dream except when the lines are vertical. selectionMargin is a global variable set by the user (default = 0.5). It adjusts the margin for how accurate the selection check should be. Names are based on the linear function for each subline, y = ax + b. Pos is the position from the mousePressEvent. bool GraphApp::pointInPath(QPainterPath path, QPointF pos){ qreal posY = pos.y(); qreal posX = pos.x(); for (int i = 0; i < path.elementCount()-1; ++i) { if(posX < path.elementAt(i+1).x && posX > path.elementAt(i).x){ qreal dy = path.elementAt(i+1).y - path.elementAt(i).y; qreal dx = path.elementAt(i+1).x - path.elementAt(i).x; qreal a = dy / dx; qreal b = path.elementAt(i).y - (path.elementAt(i).x * a); if(selectionMargin==0.0) selectionMargin = 0.5; qreal lowerBound = (a*posX + b) + selectionMargin; qreal upperBound = (a*posX + b) - selectionMargin; if(posY < lowerBound && posY > upperBound){ return true; } } } return false; } So it seems like this function returns false when I send a MousePressEvent from the area coverd by the vertical lines. My first thought is the if-sentence: if(posX < path.elementAt(i+1).x && posX > path.elementAt(i).x) Any other ideas for how I can implement this without the if-sentence? I have also seen other people struggling with finding a nice way to check if a QPainterPath contains a point without the boundingRect() and intersects() functions, so this is maybe to use for other people as well :)
0
11,734,631
07/31/2012 06:50:16
748,393
05/11/2011 09:46:55
94
1
Solution for hosting large amounts of data
I am working on a web application that will handle about 1000 users monthly, the problem is that users will be able to sore files (pictures, videos, office files, pdfs.. and so on) i would like to know what is a approach in situation like this, my hosting provider will give me 40 GB of data to store application and some design files (css, pictures slices, etc..) but think that 40 gb is just not enough and i will need much more, 1-2 TB on my opinion, so i am thinking about dedicated hosting only for my data, and creating api for accesing data, can you suggest me hosting providers for this, or any other ideas would be helpfull..
rest
hosting
web-hosting
null
null
null
open
Solution for hosting large amounts of data === I am working on a web application that will handle about 1000 users monthly, the problem is that users will be able to sore files (pictures, videos, office files, pdfs.. and so on) i would like to know what is a approach in situation like this, my hosting provider will give me 40 GB of data to store application and some design files (css, pictures slices, etc..) but think that 40 gb is just not enough and i will need much more, 1-2 TB on my opinion, so i am thinking about dedicated hosting only for my data, and creating api for accesing data, can you suggest me hosting providers for this, or any other ideas would be helpfull..
0
11,651,005
07/25/2012 13:36:35
105,407
05/12/2009 14:25:38
1,229
20
Can't read appSettings value from Web.Config
I have the following in my web.config: <configuration> <appSettings> <add key="PsychMon" value="true"/> </appSettings> . . . </configuration> I have the following code in my codebehind: System.Configuration.Configuration webConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null) ; However, when I look at webConfig, webConfig.AppSettings.Settings.Count = 0 . Why is it not reading the app setting? What I want to do is be able to get the setting by using: System.Configuration.KeyValueConfigurationElement psych = webConfig.AppSettings.Settings["PsychMon"]; I am using c# 3.5, vs 2008
c#
web-config
null
null
null
null
open
Can't read appSettings value from Web.Config === I have the following in my web.config: <configuration> <appSettings> <add key="PsychMon" value="true"/> </appSettings> . . . </configuration> I have the following code in my codebehind: System.Configuration.Configuration webConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null) ; However, when I look at webConfig, webConfig.AppSettings.Settings.Count = 0 . Why is it not reading the app setting? What I want to do is be able to get the setting by using: System.Configuration.KeyValueConfigurationElement psych = webConfig.AppSettings.Settings["PsychMon"]; I am using c# 3.5, vs 2008
0
11,650,126
07/25/2012 12:50:40
563,832
01/05/2011 11:33:54
436
10
Lucene.Net using Ninject InSingletonScope()
Reading up on Lucene, it seems it's recommeneded to use the same instance of IndexSearcher across all requests. If I have a search class which is injected using ninject public interface IPatientSearch { void DoSearch(ref SearchDTO _search); //... } Would there be any issues binding it using InSingletonScope, which would ensure the same instance is shared across all requests? Bind<IPatientSearch>().To<PatientSearch>().InSingletonScope(); Am I missing any obvious pitfalls of using such an approach?
c#
singleton
ninject
lucene.net
null
null
open
Lucene.Net using Ninject InSingletonScope() === Reading up on Lucene, it seems it's recommeneded to use the same instance of IndexSearcher across all requests. If I have a search class which is injected using ninject public interface IPatientSearch { void DoSearch(ref SearchDTO _search); //... } Would there be any issues binding it using InSingletonScope, which would ensure the same instance is shared across all requests? Bind<IPatientSearch>().To<PatientSearch>().InSingletonScope(); Am I missing any obvious pitfalls of using such an approach?
0
11,650,130
07/25/2012 12:50:52
261,375
01/28/2010 21:23:27
433
11
Google Geocharts: Regions and Markers on same map?
I'm experimenting with Google's [GeoCharts][1]. I have state data and city data that I want to display over the city data. This means I want to use the geochart `regions` and `markers` display mode at the same time. Can this be done, or faked? I can't seem to find a way but was wondering if anyone else has had success. [1]: https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart
google-geochart
null
null
null
null
null
open
Google Geocharts: Regions and Markers on same map? === I'm experimenting with Google's [GeoCharts][1]. I have state data and city data that I want to display over the city data. This means I want to use the geochart `regions` and `markers` display mode at the same time. Can this be done, or faked? I can't seem to find a way but was wondering if anyone else has had success. [1]: https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart
0
11,651,014
07/25/2012 13:36:55
1,030,989
11/05/2011 10:55:16
73
2
How can one develop a chrome extension that accesses google drive?
Is there any examples of a chrome extension that accesses drive? Using [chrome_ex_oauth.js](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/oauth_contacts/chrome_ex_oauth.js?content-type=text/plain): It dances with the docs list scope (`https://docs.google.com/feeds/`), but the `https://www.googleapis.com/auth/drive` scope doesn't seem to work. I've tried changing consumer keys/secrets, et cetera: oauth = ChromeExOAuth.initBackgroundPage({ 'request_url': 'https://www.google.com/accounts/OAuthGetRequestToken', 'authorize_url': 'https://www.google.com/accounts/OAuthAuthorizeToken', 'access_url': 'https://www.google.com/accounts/OAuthGetAccessToken', 'consumer_key': 'anonymous', 'consumer_secret': 'anonymous', 'scope':'https://www.googleapis.com/auth/drive', 'app_name': 'Chrome Extension' }); oauth.authorize(onAuthorizeCallback); If you can get me past oauth, I'm sure I can handle the rest.
google-drive
null
null
null
null
null
open
How can one develop a chrome extension that accesses google drive? === Is there any examples of a chrome extension that accesses drive? Using [chrome_ex_oauth.js](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/oauth_contacts/chrome_ex_oauth.js?content-type=text/plain): It dances with the docs list scope (`https://docs.google.com/feeds/`), but the `https://www.googleapis.com/auth/drive` scope doesn't seem to work. I've tried changing consumer keys/secrets, et cetera: oauth = ChromeExOAuth.initBackgroundPage({ 'request_url': 'https://www.google.com/accounts/OAuthGetRequestToken', 'authorize_url': 'https://www.google.com/accounts/OAuthAuthorizeToken', 'access_url': 'https://www.google.com/accounts/OAuthGetAccessToken', 'consumer_key': 'anonymous', 'consumer_secret': 'anonymous', 'scope':'https://www.googleapis.com/auth/drive', 'app_name': 'Chrome Extension' }); oauth.authorize(onAuthorizeCallback); If you can get me past oauth, I'm sure I can handle the rest.
0
11,651,017
07/25/2012 13:37:18
1,474,333
06/22/2012 08:59:34
31
1
Displaying n'th level category in php
below is my SQL table id parent_id 1 0 2 0 3 1 4 1 5 3 6 5 i want to display n'th level hierarchic relation in array like below array { 1 sub{ 3 sub{ 5 } 4 } } and so on how can i do this in PHP
php
null
null
null
null
null
open
Displaying n'th level category in php === below is my SQL table id parent_id 1 0 2 0 3 1 4 1 5 3 6 5 i want to display n'th level hierarchic relation in array like below array { 1 sub{ 3 sub{ 5 } 4 } } and so on how can i do this in PHP
0
11,651,018
07/25/2012 13:37:18
333,966
05/05/2010 23:57:58
59
7
Show indicators while programmatically scrolling UIScrollView
I am writing a framework which simplifies common (but sometimes tricky) drag and drop tasks in iOS. As part of this framework, when the user drags (and briefly holds) an object near the edge of a scrollView, it will scroll the scrollView programmatically in the direction of the edge. I am able to scroll just fine using -setContentOffset:animated:(passing NO to animated) and an NSTimer, but the scroll indicators do not show up. This leads to a confusing user experience (it can be hard to tell it is scrolling if the background is plain/untextured). I have tried calling -flashScrollIndicators from my NSTimer callback (as the contentOffset is set), but for some reason the indicators wait until the scrolling has completed before flashing. The effect I want is for the indicators to appear while the scrolling is happening and then disappear once it has stopped. Basically, I want the same effect as when the user scrolls the scrollView with their finger to be triggered for my programatic scrolling caused by the drag. Any ideas on how to achieve this?
objective-c
ipad
ios5
uiscrollview
drag-and-drop
null
open
Show indicators while programmatically scrolling UIScrollView === I am writing a framework which simplifies common (but sometimes tricky) drag and drop tasks in iOS. As part of this framework, when the user drags (and briefly holds) an object near the edge of a scrollView, it will scroll the scrollView programmatically in the direction of the edge. I am able to scroll just fine using -setContentOffset:animated:(passing NO to animated) and an NSTimer, but the scroll indicators do not show up. This leads to a confusing user experience (it can be hard to tell it is scrolling if the background is plain/untextured). I have tried calling -flashScrollIndicators from my NSTimer callback (as the contentOffset is set), but for some reason the indicators wait until the scrolling has completed before flashing. The effect I want is for the indicators to appear while the scrolling is happening and then disappear once it has stopped. Basically, I want the same effect as when the user scrolls the scrollView with their finger to be triggered for my programatic scrolling caused by the drag. Any ideas on how to achieve this?
0
11,651,025
07/25/2012 13:37:34
1,531,262
07/17/2012 09:18:37
1
0
how can start intent after finishing download an image from url?
i need to start my intent after finishing the download the image from url without any action from user the application itself. this is my activity which first will download the image after it will start the intent. //download image then start decod intent public void download(View v) { //first download image new MyAsnyc().execute(); //then start this intent final Handler handler=new Handler(); final Runnable r = new Runnable() { public void run() { { Intent intent1 = new Intent(Test_PROJECTActivity.this, DecodeActivity.class); File path = Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); File file = new File(path, "DemoPictureX.png"); Log.d("file", file.getAbsolutePath()); intent1.putExtra("file", file.getAbsolutePath()); try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } startActivity(intent1); } } }; handler.postDelayed(r, 5000); } since the MyAsnyc do fine and download the image correctly but the second part from code which start the intent while downloading the image so the image will be corrupted so it cause an exception . how can i make the intent start ONCE the image will be ready and finished download ??
android
android-intent
android-image
android-internet
android-handler
null
open
how can start intent after finishing download an image from url? === i need to start my intent after finishing the download the image from url without any action from user the application itself. this is my activity which first will download the image after it will start the intent. //download image then start decod intent public void download(View v) { //first download image new MyAsnyc().execute(); //then start this intent final Handler handler=new Handler(); final Runnable r = new Runnable() { public void run() { { Intent intent1 = new Intent(Test_PROJECTActivity.this, DecodeActivity.class); File path = Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); File file = new File(path, "DemoPictureX.png"); Log.d("file", file.getAbsolutePath()); intent1.putExtra("file", file.getAbsolutePath()); try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } startActivity(intent1); } } }; handler.postDelayed(r, 5000); } since the MyAsnyc do fine and download the image correctly but the second part from code which start the intent while downloading the image so the image will be corrupted so it cause an exception . how can i make the intent start ONCE the image will be ready and finished download ??
0
11,350,708
07/05/2012 18:53:47
1,315,447
04/05/2012 13:47:04
32
3
Hibernate using DAO with mySQL DB
I am implementing a Restful Web Service using Jersey. I have a package using hibernate to map the data to DB. I am new to hibernate using DAO : I have a method in GenericDao class : public abstract class GenericDAO<T> extends DAOFactory { public List<T> findByCriteria(List<Criterion> list) throws Exception { Criteria criteria = getSession().createCriteria(classe); for (int i = 0; i < list.size(); i++) criteria.add(list.get(i)); return criteria.list(); } } Then I use this method in a Service class and it works completely fine like this: public Response get(long projectId, String username) { List<Criterion> list = new ArrayList<Criterion>(); Criterion c = Restrictions.eq("project.id", projectId); list.add(c); List<Deliverable> deliverables = deliverableDAO.findByCriteria(list); return deliverables } The problem is in this method in another Service class : public Response get(String username) { List<Criterion> list = new ArrayList<Criterion>(); Criterion c = Restrictions.eq("user.username", username); list.add(c); List<Task> tasks = taskDAO.findByCriteria(list); return tasks; } as you see "Restrictions.eq("project.id", projectId)" works fine for me but "Restrictions.eq("user.username", username)" has a promlem maybe with 'user.username', Any help?
mysql
database
hibernate
jersey
dao
null
open
Hibernate using DAO with mySQL DB === I am implementing a Restful Web Service using Jersey. I have a package using hibernate to map the data to DB. I am new to hibernate using DAO : I have a method in GenericDao class : public abstract class GenericDAO<T> extends DAOFactory { public List<T> findByCriteria(List<Criterion> list) throws Exception { Criteria criteria = getSession().createCriteria(classe); for (int i = 0; i < list.size(); i++) criteria.add(list.get(i)); return criteria.list(); } } Then I use this method in a Service class and it works completely fine like this: public Response get(long projectId, String username) { List<Criterion> list = new ArrayList<Criterion>(); Criterion c = Restrictions.eq("project.id", projectId); list.add(c); List<Deliverable> deliverables = deliverableDAO.findByCriteria(list); return deliverables } The problem is in this method in another Service class : public Response get(String username) { List<Criterion> list = new ArrayList<Criterion>(); Criterion c = Restrictions.eq("user.username", username); list.add(c); List<Task> tasks = taskDAO.findByCriteria(list); return tasks; } as you see "Restrictions.eq("project.id", projectId)" works fine for me but "Restrictions.eq("user.username", username)" has a promlem maybe with 'user.username', Any help?
0
11,350,714
07/05/2012 18:54:10
226,507
12/07/2009 16:43:51
2,427
140
More sophisticated static file serving under Express
Best explained by an example. Say I have a directory /images, where I have images a.png, b.png, and c.png. Then I have a directory /foo/images, which has an image b.png, which is different than the b.png in /images. I want it so if a request comes in for http://mydomain.com/foo/images/a.png, it will serve the image /images/a.png. But if a request comes in for http://mydomain.com/foo/images/b.png, it will get the version of b.png in /foo/images. That is, it first checks foo/images/ and if there is not file by that name, it falls back on /images. I could do this using res.sendfile(), but I'd prefer use built-in functionality if it exists, or someone's optimized module, while not losing the benefits (caching, etc) that might be provided by the middleware.
node.js
express
null
null
null
null
open
More sophisticated static file serving under Express === Best explained by an example. Say I have a directory /images, where I have images a.png, b.png, and c.png. Then I have a directory /foo/images, which has an image b.png, which is different than the b.png in /images. I want it so if a request comes in for http://mydomain.com/foo/images/a.png, it will serve the image /images/a.png. But if a request comes in for http://mydomain.com/foo/images/b.png, it will get the version of b.png in /foo/images. That is, it first checks foo/images/ and if there is not file by that name, it falls back on /images. I could do this using res.sendfile(), but I'd prefer use built-in functionality if it exists, or someone's optimized module, while not losing the benefits (caching, etc) that might be provided by the middleware.
0
11,350,752
07/05/2012 18:56:16
833,302
07/07/2011 10:09:35
3
0
raw bitmap data to jpeg or png C++
I have bytearray where every three bytes describes 1 pixel (RGB). The task is to convert it to jpeg or png. Actually, I am using Zint (open source lib for generating barcodes) that uses libpng to generate image file and save it to file system, but in libpng the function png_plot() except generating image also save it on disk which is undesirable. As result I think there two ways: 1. from bitmap bytearray to bmp -> jpeg / png (using some other lib) 2. writing hook or some similar to png_plot() Can you give me some advices? Thank you.
c++
bitmap
png
jpeg
libpng
null
open
raw bitmap data to jpeg or png C++ === I have bytearray where every three bytes describes 1 pixel (RGB). The task is to convert it to jpeg or png. Actually, I am using Zint (open source lib for generating barcodes) that uses libpng to generate image file and save it to file system, but in libpng the function png_plot() except generating image also save it on disk which is undesirable. As result I think there two ways: 1. from bitmap bytearray to bmp -> jpeg / png (using some other lib) 2. writing hook or some similar to png_plot() Can you give me some advices? Thank you.
0
11,350,755
07/05/2012 18:56:20
1,006,010
10/20/2011 20:24:21
2,182
29
Haskell wall-time oscilator
I'm looking for a Haskell function which yield a value which slowly changes as wall-time elapses (and possibly wraps around after a while). I don't really mind whether it's `IO Integer` or `IO Double` or what. I just want a value that slowly changes as wall-time elapses. Presumably there is an answer buried somewhere in the depths of the `time` package. (Or maybe `old-time`, but I presume that's deprecated?) However, the `time` package seems really, _really_ complicated. And I don't actually _care_ about timezones or human-readable time representations or anything. I just want a number that changes as wall-time elapses. Can anybody show me a simple code snippet to do that? (Without me spending three days trying to figure out the complexities of the `time` package...)
haskell
time
null
null
null
null
open
Haskell wall-time oscilator === I'm looking for a Haskell function which yield a value which slowly changes as wall-time elapses (and possibly wraps around after a while). I don't really mind whether it's `IO Integer` or `IO Double` or what. I just want a value that slowly changes as wall-time elapses. Presumably there is an answer buried somewhere in the depths of the `time` package. (Or maybe `old-time`, but I presume that's deprecated?) However, the `time` package seems really, _really_ complicated. And I don't actually _care_ about timezones or human-readable time representations or anything. I just want a number that changes as wall-time elapses. Can anybody show me a simple code snippet to do that? (Without me spending three days trying to figure out the complexities of the `time` package...)
0
11,350,760
07/05/2012 18:56:44
1,432,813
06/02/2012 19:41:50
8
0
Image wrap collision xcode
I have an application that involves pressing a button to activate an object. The button is oddly shaped but the device obviously thinks its rectangular. How would I go about wrapping it so that the actual lines are the boundaries and parameters for detection. All help greatly appreciated!
xcode
image
parameters
wrap
null
null
open
Image wrap collision xcode === I have an application that involves pressing a button to activate an object. The button is oddly shaped but the device obviously thinks its rectangular. How would I go about wrapping it so that the actual lines are the boundaries and parameters for detection. All help greatly appreciated!
0