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,628,095
07/24/2012 09:38:21
1,548,198
07/24/2012 09:29:06
1
0
sbt.ResolveException: unresolved dependency:
it seems to that Play do not find my local repository. I have declared resolvers += "Local Maven Repository" at "file://"+"/Users/branco"+"/.m2/repository" in file plugins.sbt for my project. and in file Build.scala val appDependencies = Seq( "linkedin" % "linkedin_api" % "1.0-SNAPSHOT" ) (im using play20)
maven
playframework
null
null
null
null
open
sbt.ResolveException: unresolved dependency: === it seems to that Play do not find my local repository. I have declared resolvers += "Local Maven Repository" at "file://"+"/Users/branco"+"/.m2/repository" in file plugins.sbt for my project. and in file Build.scala val appDependencies = Seq( "linkedin" % "linkedin_api" % "1.0-SNAPSHOT" ) (im using play20)
0
11,628,109
07/24/2012 09:39:09
1,544,897
07/23/2012 03:58:20
1
0
flex datagrid sorting which contain itemrenderer
I'm quite newbies of flex, may I have some question to anyone who can suggest please. I have grid for monitor CPU status and It look like this CPU | CPU dif<br/> --------------<br/> 5.9 | +0.2 ^<br/> 4.0 | -0.6 v<br/> 12.7| -1.5 v<br/> which ^ , v is the picture that use [s:itemrenderer] <br/><br/> The problem is the column "CPU dif" cannot normally sorting , so I use sortCompareFunction like this public static function compareCPU(typeOne:Object, typeTwo:Object ,grid:Object):int { return ObjectUtil.numericCompare(Number(typeOne.cpu), Number(typeTwo.cpu) ); } public static function compareCPUdif(typeOne:Object, typeTwo:Object ,grid:Object):int { return ObjectUtil.numericCompare(Number(typeOne.cpu_dif), Number(typeTwo.cpu_dif) ); } AND <s:GridColumn headerText="Cpu%" dataField="cpu" sortCompareFunction="compareCPU"/> <s:GridColumn width="90" headerText="Cpu% Dif" sortCompareFunction="compareCPUdif"> <s:itemRenderer> <fx:Component> <s:GridItemRenderer width="100%" height="100%"> <s:HGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="left"> <s:HGroup width="50%" paddingLeft="5" horizontalAlign="left"> <s:Label text="{data.cpu_dif}"/> </s:HGroup> <s:HGroup width="50%" paddingRight="5" horizontalAlign="right"> <mx:Image source="{outerDocument.statusArrow.getItemAt(data.pic)as String}"/> </s:HGroup> </s:HGroup> </s:GridItemRenderer> </fx:Component> </s:itemRenderer> </s:GridColumn> it's strange that it works for a half , it can sort correctly only one way (asc)<br/> when i click it again, it nothing happen. could you guys can solve this issue , highest thanks in advance
flex
sorting
datagrid
itemrenderer
null
null
open
flex datagrid sorting which contain itemrenderer === I'm quite newbies of flex, may I have some question to anyone who can suggest please. I have grid for monitor CPU status and It look like this CPU | CPU dif<br/> --------------<br/> 5.9 | +0.2 ^<br/> 4.0 | -0.6 v<br/> 12.7| -1.5 v<br/> which ^ , v is the picture that use [s:itemrenderer] <br/><br/> The problem is the column "CPU dif" cannot normally sorting , so I use sortCompareFunction like this public static function compareCPU(typeOne:Object, typeTwo:Object ,grid:Object):int { return ObjectUtil.numericCompare(Number(typeOne.cpu), Number(typeTwo.cpu) ); } public static function compareCPUdif(typeOne:Object, typeTwo:Object ,grid:Object):int { return ObjectUtil.numericCompare(Number(typeOne.cpu_dif), Number(typeTwo.cpu_dif) ); } AND <s:GridColumn headerText="Cpu%" dataField="cpu" sortCompareFunction="compareCPU"/> <s:GridColumn width="90" headerText="Cpu% Dif" sortCompareFunction="compareCPUdif"> <s:itemRenderer> <fx:Component> <s:GridItemRenderer width="100%" height="100%"> <s:HGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="left"> <s:HGroup width="50%" paddingLeft="5" horizontalAlign="left"> <s:Label text="{data.cpu_dif}"/> </s:HGroup> <s:HGroup width="50%" paddingRight="5" horizontalAlign="right"> <mx:Image source="{outerDocument.statusArrow.getItemAt(data.pic)as String}"/> </s:HGroup> </s:HGroup> </s:GridItemRenderer> </fx:Component> </s:itemRenderer> </s:GridColumn> it's strange that it works for a half , it can sort correctly only one way (asc)<br/> when i click it again, it nothing happen. could you guys can solve this issue , highest thanks in advance
0
11,628,110
07/24/2012 09:39:11
1,448,157
06/11/2012 04:42:01
13
1
Stored procedure for 3 tables. Not working.
I have 3 tables- 1. Country (CountryName, CID (PK- AutoIncrement)) 2. State (SID(PK- AutoIncrement), StateName, CID (FK to Country) 3. City (CityName, CID, SID (FK to State) Now I need to insert only the name into the three tables with CountryName, StateName and CityName.. The IDs need to get updated. Create PROCEDURE sp_place( @CountryName char(50), @StateName varchar(50), @CityName nchar(20) ) AS DECLARE @CountryID int, @StateID int, @CityID int; Set NOCOUNT OFF BEGIN TRANSACTION INSERT INTO dbo.Country VALUES (@CountryName); SET @CountryID = SCOPE_IDENTITY(); IF @@ERROR <> 0 BEGIN ROLLBACK RETURN END Insert into dbo.State VALUES (@StateName, @CountryID); SET @StateID = SCOPE_IDENTITY(); IF @@ERROR <> 0 BEGIN ROLLBACK RETURN END Insert into dbo.City VALUES (@CityName, @StateID); SET @CityID= SCOPE_IDENTITY(); Commit When I Enter Country twice, the value shouldn't get changed. Eg: If I enter India the value of CountryID=1, when I again enter India, the value of CountryID shouldn't get increased. How'd I perform that? My SP changes for every insertion.
asp.net
sql-server-2008
null
null
null
null
open
Stored procedure for 3 tables. Not working. === I have 3 tables- 1. Country (CountryName, CID (PK- AutoIncrement)) 2. State (SID(PK- AutoIncrement), StateName, CID (FK to Country) 3. City (CityName, CID, SID (FK to State) Now I need to insert only the name into the three tables with CountryName, StateName and CityName.. The IDs need to get updated. Create PROCEDURE sp_place( @CountryName char(50), @StateName varchar(50), @CityName nchar(20) ) AS DECLARE @CountryID int, @StateID int, @CityID int; Set NOCOUNT OFF BEGIN TRANSACTION INSERT INTO dbo.Country VALUES (@CountryName); SET @CountryID = SCOPE_IDENTITY(); IF @@ERROR <> 0 BEGIN ROLLBACK RETURN END Insert into dbo.State VALUES (@StateName, @CountryID); SET @StateID = SCOPE_IDENTITY(); IF @@ERROR <> 0 BEGIN ROLLBACK RETURN END Insert into dbo.City VALUES (@CityName, @StateID); SET @CityID= SCOPE_IDENTITY(); Commit When I Enter Country twice, the value shouldn't get changed. Eg: If I enter India the value of CountryID=1, when I again enter India, the value of CountryID shouldn't get increased. How'd I perform that? My SP changes for every insertion.
0
11,471,731
07/13/2012 13:45:09
1,398,431
05/16/2012 11:00:26
1
0
SplitView not aligned at left?
On a button click action tabbarcontroller gets loaded.In Tabbar all the tab items are splitview controller. By default splitview of the first tab item aligned towards right. So we get a small empty space at left side. But on clicking second tab splitview aligned from the origin.Someone please give us solution .
ipad
uisplitviewcontroller
null
null
null
null
open
SplitView not aligned at left? === On a button click action tabbarcontroller gets loaded.In Tabbar all the tab items are splitview controller. By default splitview of the first tab item aligned towards right. So we get a small empty space at left side. But on clicking second tab splitview aligned from the origin.Someone please give us solution .
0
11,471,944
07/13/2012 13:56:18
1,399,096
05/16/2012 16:03:02
1
0
Send Javascript objects to Webmethod not working
I am passing a few arrays of objects and another single object to a webmethod on my codebehind page and for some reason the webmethod isn't being executed. I have walked through my javascript with firebug and it appears that everything gets created correctly but the webmethod isn't working. I had this working at one point and now I just can't seem to figure out what is broken. Any help here would be greatly appreciated. Javascript - function saveForm(){ var estimate = { }; estimate.foo = $('#<%= txt_foo.ClientID %>').val(); estimate.bar = $('#<%= txt_bar.ClientID %>').val(); if($('#<%= check_foobar.ClientID %>').is(':checked')) { estimate.foobar = true; } var comps = new Array(); var options = new Array(); var stocks = new Array(); var compNum = parseInt(document.getElementById('<%= compNumber.ClientID %>').value); var optNum = parseInt(document.getElementById('<%= optionNumber.ClientID %>').value); var stockNum = parseInt(document.getElementById('<%= stockNumber.ClientID %>').value); for(i = 1; i < compNum; i++) { var component = { }; // Set component values. for(j = 1; j < optNum; j++) { var option = { }; // Set option values options[j-1] = option; for(k = 1; k < stockNum; k++) { var stock = { }; // Set stock values stocks[k-1] = stock; } } comps[ind] = component; } var DTO = { 'estimate': estimate, 'components': comps, 'options': options, 'stocks': stocks }; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "EstRequest.aspx/saveForm", data: JSON.stringify(DTO), dataType: "json" }); } -C#/Webmethod [WebMethod] public static void saveForm(Estimate estimate, Object[] components, Object[] options, Object[] stocks) { foreach (Object comp in components) { Component component = new JavaScriptSerializer().ConvertToType<Component>(comp); foreach (Object opt in options) { Component.Option option = new JavaScriptSerializer().ConvertToType<Component.Option>(opt); if (Convert.ToInt32(option.compID) == Convert.ToInt32(component.compID)) { component.AddOption(option); foreach (Object st in stocks) { Component.Stock stock = new JavaScriptSerializer().ConvertToType<Component.Stock>(st); if (Convert.ToInt32(stock.optID) == (Convert.ToInt32(option.optID))) { option.AddStock(stock); } } } } estimate.addComponent(component); } estimate.saveEstimate(); } }
c#
javascript
jquery
jquery-ajax
webmethod
null
open
Send Javascript objects to Webmethod not working === I am passing a few arrays of objects and another single object to a webmethod on my codebehind page and for some reason the webmethod isn't being executed. I have walked through my javascript with firebug and it appears that everything gets created correctly but the webmethod isn't working. I had this working at one point and now I just can't seem to figure out what is broken. Any help here would be greatly appreciated. Javascript - function saveForm(){ var estimate = { }; estimate.foo = $('#<%= txt_foo.ClientID %>').val(); estimate.bar = $('#<%= txt_bar.ClientID %>').val(); if($('#<%= check_foobar.ClientID %>').is(':checked')) { estimate.foobar = true; } var comps = new Array(); var options = new Array(); var stocks = new Array(); var compNum = parseInt(document.getElementById('<%= compNumber.ClientID %>').value); var optNum = parseInt(document.getElementById('<%= optionNumber.ClientID %>').value); var stockNum = parseInt(document.getElementById('<%= stockNumber.ClientID %>').value); for(i = 1; i < compNum; i++) { var component = { }; // Set component values. for(j = 1; j < optNum; j++) { var option = { }; // Set option values options[j-1] = option; for(k = 1; k < stockNum; k++) { var stock = { }; // Set stock values stocks[k-1] = stock; } } comps[ind] = component; } var DTO = { 'estimate': estimate, 'components': comps, 'options': options, 'stocks': stocks }; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "EstRequest.aspx/saveForm", data: JSON.stringify(DTO), dataType: "json" }); } -C#/Webmethod [WebMethod] public static void saveForm(Estimate estimate, Object[] components, Object[] options, Object[] stocks) { foreach (Object comp in components) { Component component = new JavaScriptSerializer().ConvertToType<Component>(comp); foreach (Object opt in options) { Component.Option option = new JavaScriptSerializer().ConvertToType<Component.Option>(opt); if (Convert.ToInt32(option.compID) == Convert.ToInt32(component.compID)) { component.AddOption(option); foreach (Object st in stocks) { Component.Stock stock = new JavaScriptSerializer().ConvertToType<Component.Stock>(st); if (Convert.ToInt32(stock.optID) == (Convert.ToInt32(option.optID))) { option.AddStock(stock); } } } } estimate.addComponent(component); } estimate.saveEstimate(); } }
0
11,471,353
07/13/2012 13:20:58
978,461
10/04/2011 12:53:14
207
0
Android PlistParser example
I have been searching for the net for plist parser for android, and ofc i found some but i just cant implement to my project. Can somebody give me suggestions? Im a beginner, and i currently use my own (very shity version which is very slow and has a lot of issue.) I found Akos Cz's PlistParser and i would like to ask is there anyone who can throw me some suggestions how to use this with a plist? So here is the PlistParser: package com.paperlit.reader.util; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Stack; import org.xmlpull.v1.XmlPullParser; //import android.util.Log; import android.util.Xml; /** * This class will parse a plist xml file and store the contents in a * hierarchical HashMap of <String, Object> tuples, where the Object value * could be another HashMap, an ArrayList, String or Integer value. * * Use the getConfiguration methods to retrieve the values from the parsed plist file. * * The key names for nested dictionary references must be of the form : * Dict1KeyName.Dict2KeyName.ElementKeyName * * @author akoscz * */ public class XMLPropertyListConfiguration { //private static final String TAG = "plist"; /** * The nested (hierarchical) HashMap which holds our key-value pairs of our plist file. */ protected HashMap<String, Object> mPlistHashMap; /** * Constructor. * Parse a plist file from the given InputStream. * * @param inputStream The InputStream which has the bytes of the plist file we need to parse. */ public XMLPropertyListConfiguration(InputStream inputStream) { mPlistHashMap = new HashMap<String, Object>(); parse(inputStream); } /** * Get an String configuration value for the given key. * * @param keyName The name of the key to look up in the configuration dictionary. * @return The String value of the specified key. */ public String getConfiguration(String keyName) { return (String)getConfigurationObject(keyName); } /** * Get a String configuration value for the given key. * If there is no value for the given key, then return the default value. * @param keyName The name of the key to look up in the configuration dictionary. * @param defaultValue The default value to return if they key has no associated value. * @return The String value of the specified key, or defaultValue if the value for keyName is null. */ public String getConfigurationWithDefault(String keyName, String defaultValue) { String value = getConfiguration(keyName); if(value == null) { return defaultValue; } return value; } /** * Get an Integer configuration value for the given key. * * @param keyName The name of the key to look up in the configuration dictionary. * @return The Integer value of the specified key. */ public Integer getConfigurationInteger(String keyName) { return (Integer)getConfigurationObject(keyName); } /** * Get an Integer configuration value for the given key. * If there is no value for the given key, then return the default value. * @param keyName The name of the key to look up in the configuration dictionary. * @param defaultValue The default value to return if they key has no associated value. * @return The Integer value of the specified key, or defaultValue if the value for keyName is null. */ public Integer getConfigurationIntegerWithDefault(String keyName, Integer defaultValue) { Integer value = getConfigurationInteger(keyName); if(value == null) { return defaultValue; } return value; } /** * Utility method which uses a XmlPullParser to iterate through the XML elements * and build up a hierarchical HashMap representing the key-value pairs of the * plist configuration file. * * @param inputStream The InputStream which contains the plist XML file. */ public void parse(InputStream inputStream) { XmlPullParser parser = Xml.newPullParser(); try { parser.setInput(inputStream, null); int eventType = parser.getEventType(); boolean done = false; boolean parsingArray = false; String name = null; String key = null; Stack<HashMap<String, Object>> stack = new Stack<HashMap<String, Object>>(); HashMap<String, Object> dict = null; ArrayList<Object> array = null; while (eventType != XmlPullParser.END_DOCUMENT && !done) { switch(eventType) { case XmlPullParser.START_DOCUMENT: //Log.d(TAG, "START_DOCUMENT"); break; case XmlPullParser.START_TAG: name = parser.getName(); if(name.equalsIgnoreCase("dict")) { // root dict element if(key == null) { mPlistHashMap.clear(); dict = mPlistHashMap; } else if(parsingArray) { //Log.d(TAG, "START_TAG dict : inside array"); HashMap<String, Object> childDict = new HashMap<String, Object>(); array.add(childDict); stack.push(dict); dict = childDict; } else { //Log.d(TAG, "START_TAG dict : " + key); HashMap<String, Object> childDict = new HashMap<String, Object>(); dict.put(key, childDict); stack.push(dict); dict = childDict; } } else if(name.equalsIgnoreCase("key")) { key = parser.nextText(); } else if(name.equalsIgnoreCase("integer")) { dict.put(key, new Integer(parser.nextText())); } else if(name.equalsIgnoreCase("string")) { if(parsingArray) { array.add(parser.nextText()); } else { dict.put(key, parser.nextText()); } } else if(name.equalsIgnoreCase("array")) { parsingArray = true; array = new ArrayList<Object>(); dict.put(key, array); } break; case XmlPullParser.END_TAG: name = parser.getName(); if(name.equalsIgnoreCase("dict")) { //Log.d(TAG, "END_TAG dict"); if(!stack.empty()) { dict = stack.pop(); } } else if(name.equalsIgnoreCase("array")) { parsingArray = false; } else if(name.equalsIgnoreCase("plist")) { done = true; } break; case XmlPullParser.END_DOCUMENT: //Log.d(TAG, "END_DOCUMENT"); break; } eventType = parser.next(); } }catch (Exception ex){ ex.printStackTrace(); } } /** * Utility method which tokenizes the given keyName using * the "." delimiter and then looks up each token in the * configuration dictionary. If the token key points to a * dictionary then it proceeds to the next token key and * looks up value of the token key in the dictionary it found * from the previous token key. * * @param keyName The fully qualified key name. * @return The Object value associated with the given key, or null if the key does not exist. */ @SuppressWarnings("unchecked") private Object getConfigurationObject(String keyName) { String[] tokens = keyName.split("\\."); if(tokens.length > 1) { HashMap<String,Object> dict = mPlistHashMap; Object obj; for(int i = 0; i < tokens.length; i++) { obj = dict.get(tokens[i]); if(obj instanceof HashMap<?, ?>) { dict = (HashMap<String, Object>) obj; continue; } return obj; } } return mPlistHashMap.get(keyName); } }
android
plist
android-xml
null
null
null
open
Android PlistParser example === I have been searching for the net for plist parser for android, and ofc i found some but i just cant implement to my project. Can somebody give me suggestions? Im a beginner, and i currently use my own (very shity version which is very slow and has a lot of issue.) I found Akos Cz's PlistParser and i would like to ask is there anyone who can throw me some suggestions how to use this with a plist? So here is the PlistParser: package com.paperlit.reader.util; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Stack; import org.xmlpull.v1.XmlPullParser; //import android.util.Log; import android.util.Xml; /** * This class will parse a plist xml file and store the contents in a * hierarchical HashMap of <String, Object> tuples, where the Object value * could be another HashMap, an ArrayList, String or Integer value. * * Use the getConfiguration methods to retrieve the values from the parsed plist file. * * The key names for nested dictionary references must be of the form : * Dict1KeyName.Dict2KeyName.ElementKeyName * * @author akoscz * */ public class XMLPropertyListConfiguration { //private static final String TAG = "plist"; /** * The nested (hierarchical) HashMap which holds our key-value pairs of our plist file. */ protected HashMap<String, Object> mPlistHashMap; /** * Constructor. * Parse a plist file from the given InputStream. * * @param inputStream The InputStream which has the bytes of the plist file we need to parse. */ public XMLPropertyListConfiguration(InputStream inputStream) { mPlistHashMap = new HashMap<String, Object>(); parse(inputStream); } /** * Get an String configuration value for the given key. * * @param keyName The name of the key to look up in the configuration dictionary. * @return The String value of the specified key. */ public String getConfiguration(String keyName) { return (String)getConfigurationObject(keyName); } /** * Get a String configuration value for the given key. * If there is no value for the given key, then return the default value. * @param keyName The name of the key to look up in the configuration dictionary. * @param defaultValue The default value to return if they key has no associated value. * @return The String value of the specified key, or defaultValue if the value for keyName is null. */ public String getConfigurationWithDefault(String keyName, String defaultValue) { String value = getConfiguration(keyName); if(value == null) { return defaultValue; } return value; } /** * Get an Integer configuration value for the given key. * * @param keyName The name of the key to look up in the configuration dictionary. * @return The Integer value of the specified key. */ public Integer getConfigurationInteger(String keyName) { return (Integer)getConfigurationObject(keyName); } /** * Get an Integer configuration value for the given key. * If there is no value for the given key, then return the default value. * @param keyName The name of the key to look up in the configuration dictionary. * @param defaultValue The default value to return if they key has no associated value. * @return The Integer value of the specified key, or defaultValue if the value for keyName is null. */ public Integer getConfigurationIntegerWithDefault(String keyName, Integer defaultValue) { Integer value = getConfigurationInteger(keyName); if(value == null) { return defaultValue; } return value; } /** * Utility method which uses a XmlPullParser to iterate through the XML elements * and build up a hierarchical HashMap representing the key-value pairs of the * plist configuration file. * * @param inputStream The InputStream which contains the plist XML file. */ public void parse(InputStream inputStream) { XmlPullParser parser = Xml.newPullParser(); try { parser.setInput(inputStream, null); int eventType = parser.getEventType(); boolean done = false; boolean parsingArray = false; String name = null; String key = null; Stack<HashMap<String, Object>> stack = new Stack<HashMap<String, Object>>(); HashMap<String, Object> dict = null; ArrayList<Object> array = null; while (eventType != XmlPullParser.END_DOCUMENT && !done) { switch(eventType) { case XmlPullParser.START_DOCUMENT: //Log.d(TAG, "START_DOCUMENT"); break; case XmlPullParser.START_TAG: name = parser.getName(); if(name.equalsIgnoreCase("dict")) { // root dict element if(key == null) { mPlistHashMap.clear(); dict = mPlistHashMap; } else if(parsingArray) { //Log.d(TAG, "START_TAG dict : inside array"); HashMap<String, Object> childDict = new HashMap<String, Object>(); array.add(childDict); stack.push(dict); dict = childDict; } else { //Log.d(TAG, "START_TAG dict : " + key); HashMap<String, Object> childDict = new HashMap<String, Object>(); dict.put(key, childDict); stack.push(dict); dict = childDict; } } else if(name.equalsIgnoreCase("key")) { key = parser.nextText(); } else if(name.equalsIgnoreCase("integer")) { dict.put(key, new Integer(parser.nextText())); } else if(name.equalsIgnoreCase("string")) { if(parsingArray) { array.add(parser.nextText()); } else { dict.put(key, parser.nextText()); } } else if(name.equalsIgnoreCase("array")) { parsingArray = true; array = new ArrayList<Object>(); dict.put(key, array); } break; case XmlPullParser.END_TAG: name = parser.getName(); if(name.equalsIgnoreCase("dict")) { //Log.d(TAG, "END_TAG dict"); if(!stack.empty()) { dict = stack.pop(); } } else if(name.equalsIgnoreCase("array")) { parsingArray = false; } else if(name.equalsIgnoreCase("plist")) { done = true; } break; case XmlPullParser.END_DOCUMENT: //Log.d(TAG, "END_DOCUMENT"); break; } eventType = parser.next(); } }catch (Exception ex){ ex.printStackTrace(); } } /** * Utility method which tokenizes the given keyName using * the "." delimiter and then looks up each token in the * configuration dictionary. If the token key points to a * dictionary then it proceeds to the next token key and * looks up value of the token key in the dictionary it found * from the previous token key. * * @param keyName The fully qualified key name. * @return The Object value associated with the given key, or null if the key does not exist. */ @SuppressWarnings("unchecked") private Object getConfigurationObject(String keyName) { String[] tokens = keyName.split("\\."); if(tokens.length > 1) { HashMap<String,Object> dict = mPlistHashMap; Object obj; for(int i = 0; i < tokens.length; i++) { obj = dict.get(tokens[i]); if(obj instanceof HashMap<?, ?>) { dict = (HashMap<String, Object>) obj; continue; } return obj; } } return mPlistHashMap.get(keyName); } }
0
11,471,946
07/13/2012 13:56:26
784,597
06/05/2011 09:07:37
929
3
java : Using Static Method for obtaining Database Connection
I am working on a Existing J2EE based application , where there is a following Method , for connecting to Database public static java.sql.Connection connectionToDataBase(String jndiName,boolean flag)throws Exception { DataSource ds =(javax.sql.DataSource) initCtx.lookup(jndiName); return ds.getConnection(); } catch (NamingException ne) { throw ne; } finally { try { if (initCtx != null) initCtx.close(); } catch (NamingException ne) { throw ne; } } } **My question is that , is using a static Method for connecting to Database is correct ??**
java
null
null
null
null
null
open
java : Using Static Method for obtaining Database Connection === I am working on a Existing J2EE based application , where there is a following Method , for connecting to Database public static java.sql.Connection connectionToDataBase(String jndiName,boolean flag)throws Exception { DataSource ds =(javax.sql.DataSource) initCtx.lookup(jndiName); return ds.getConnection(); } catch (NamingException ne) { throw ne; } finally { try { if (initCtx != null) initCtx.close(); } catch (NamingException ne) { throw ne; } } } **My question is that , is using a static Method for connecting to Database is correct ??**
0
11,471,949
07/13/2012 13:56:32
1,503,665
07/05/2012 10:18:37
1
0
when listview starts loading new data the scrolling hangs it neither goes upward not downwards till data get loaded.?
when my listview starts loading new data the scrolling hangs it neither goes upward not downwards till data get loaded. Is there any way to slove this issue???
android
listview
scrollbar
null
null
null
open
when listview starts loading new data the scrolling hangs it neither goes upward not downwards till data get loaded.? === when my listview starts loading new data the scrolling hangs it neither goes upward not downwards till data get loaded. Is there any way to slove this issue???
0
11,471,952
07/13/2012 13:56:44
686,054
03/31/2011 15:37:45
613
4
NFC used as mifare, is it possible?
We have a mifare card system and are looking into the possibility of using NFC chips in phones as mifare cards. I have done a bit of research into NFC but the question that I cannot answer is do NFC chips in mobile phoned have a unique identifier that I can read like a mifare card has ? Also if the NFC chip dies have a unique code can I just read it using the NFC reader or do I need an application on the phone to put it into card-emulation mode ?
nfc
mifare
null
null
null
null
open
NFC used as mifare, is it possible? === We have a mifare card system and are looking into the possibility of using NFC chips in phones as mifare cards. I have done a bit of research into NFC but the question that I cannot answer is do NFC chips in mobile phoned have a unique identifier that I can read like a mifare card has ? Also if the NFC chip dies have a unique code can I just read it using the NFC reader or do I need an application on the phone to put it into card-emulation mode ?
0
11,471,957
07/13/2012 13:56:58
1,523,739
07/13/2012 13:50:31
1
0
Android OpenGL ES 2.0 change position of Shapes
i try to learn OpenGL with big problems in moving Shapes, i have not found a tutorial which really explains that. What i figured out is that i have to use the Matrix.translateM(...) method, but it didnt worked... the second problem i have is how can i position the shape in pixel and not in this [-1.0f;1.0f] Interval? public void onDrawFrame(GL10 gl) { // Draw background color GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); // Set the camera position (View matrix) Matrix.setLookAtM(mVMatrix, 0, 0, 0, -10, 0f, 0f, 0f, 0f, 1.0f, 0.0f); // Calculate the projection and view transformation Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0); Matrix.setIdentityM(mTranslationMatrix, 0); Matrix.translateM(mTranslationMatrix, 0, 0.0f, 0.5f, 0.0f); Matrix.multiplyMM(mMVPMatrix, 0, mTranslationMatrix, 0, mMVPMatrix, 0); // Draw square mSquare.draw(mMVPMatrix); // Calculate the projection and view transformation Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0); // Create a rotation for the triangle long time = SystemClock.uptimeMillis() % 4000L; float angle = 0.090f * ((int) time); Matrix.setRotateM(mRotationMatrix, 0, angle, 0, 0, -1.0f); // Combine the rotation matrix with the projection and camera view Matrix.multiplyMM(mMVPMatrix, 0, mRotationMatrix, 0, mMVPMatrix, 0); // Draw triangle mTriangle.draw(mMVPMatrix); }
android
opengl
matrix
translation
null
null
open
Android OpenGL ES 2.0 change position of Shapes === i try to learn OpenGL with big problems in moving Shapes, i have not found a tutorial which really explains that. What i figured out is that i have to use the Matrix.translateM(...) method, but it didnt worked... the second problem i have is how can i position the shape in pixel and not in this [-1.0f;1.0f] Interval? public void onDrawFrame(GL10 gl) { // Draw background color GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); // Set the camera position (View matrix) Matrix.setLookAtM(mVMatrix, 0, 0, 0, -10, 0f, 0f, 0f, 0f, 1.0f, 0.0f); // Calculate the projection and view transformation Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0); Matrix.setIdentityM(mTranslationMatrix, 0); Matrix.translateM(mTranslationMatrix, 0, 0.0f, 0.5f, 0.0f); Matrix.multiplyMM(mMVPMatrix, 0, mTranslationMatrix, 0, mMVPMatrix, 0); // Draw square mSquare.draw(mMVPMatrix); // Calculate the projection and view transformation Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0); // Create a rotation for the triangle long time = SystemClock.uptimeMillis() % 4000L; float angle = 0.090f * ((int) time); Matrix.setRotateM(mRotationMatrix, 0, angle, 0, 0, -1.0f); // Combine the rotation matrix with the projection and camera view Matrix.multiplyMM(mMVPMatrix, 0, mRotationMatrix, 0, mMVPMatrix, 0); // Draw triangle mTriangle.draw(mMVPMatrix); }
0
11,471,958
07/13/2012 13:57:01
1,523,469
07/13/2012 11:54:30
11
0
How to increase TCP negiotiated window size in solaris?
The TCP negiotiated window size directly determines the TCP throughput and depends on a lot of parameters like send buffer, receive buffer, congestion window. But irrespective of me tuning the send and/or receive buffer, the tcp negiotiated window size(got from TCP dump) remains the same. Are there any specific OS/system call to order to solaris/linux to set the negiotiated window size? If not, are there any specific reasons why it is not configurable? thanks,
networking
tcp
null
null
null
null
open
How to increase TCP negiotiated window size in solaris? === The TCP negiotiated window size directly determines the TCP throughput and depends on a lot of parameters like send buffer, receive buffer, congestion window. But irrespective of me tuning the send and/or receive buffer, the tcp negiotiated window size(got from TCP dump) remains the same. Are there any specific OS/system call to order to solaris/linux to set the negiotiated window size? If not, are there any specific reasons why it is not configurable? thanks,
0
11,471,774
07/13/2012 13:47:11
1,523,680
07/13/2012 13:28:57
1
0
Django userena raises SiteProfileNotAvailable unpredictably
My project uses userena, which in some place called django.db.models.get_model. It is uses for getting profile model, which places in profiles.Profile. It is in INSTALLED_APPS, so it should returns fine, but sometimes (seems unpredictable, mostly after apache restart) get_model returns None for this model (profiles.Profile). And userena raises SiteProfileNotAvailable error. AUTH_PROFILE_MODULE = 'profiles.Profile' At first I thought userena passes wrong parameters to the get_model, but I double check this and it is really passes app_label='profile' and model_name='Profile'. Then I tried to open python manage.py shell, import get_model and call it: `get_model('profile', 'Profile')` and it returns valid Profile model. And after doing this, site magically do work. Maybe this action updated cache, I don't know. On my local machine it is never happened, so I think it's somehow connected with apache.
django
apache
null
null
null
null
open
Django userena raises SiteProfileNotAvailable unpredictably === My project uses userena, which in some place called django.db.models.get_model. It is uses for getting profile model, which places in profiles.Profile. It is in INSTALLED_APPS, so it should returns fine, but sometimes (seems unpredictable, mostly after apache restart) get_model returns None for this model (profiles.Profile). And userena raises SiteProfileNotAvailable error. AUTH_PROFILE_MODULE = 'profiles.Profile' At first I thought userena passes wrong parameters to the get_model, but I double check this and it is really passes app_label='profile' and model_name='Profile'. Then I tried to open python manage.py shell, import get_model and call it: `get_model('profile', 'Profile')` and it returns valid Profile model. And after doing this, site magically do work. Maybe this action updated cache, I don't know. On my local machine it is never happened, so I think it's somehow connected with apache.
0
11,471,775
07/13/2012 13:47:13
438,254
09/02/2010 18:02:11
1
1
Smooth jQuery-UI interactions in SVG foreignObject?
An exemplar of this not working is in this fiddle: http://jsfiddle.net/sP3UZ/ If you remove the SVG wrapper, everything works fine, but as soon as it's wrapped, everything gets choppy and unpredictable. I see different but always broken results in chrome and firefox.
jquery-ui
svg
null
null
null
null
open
Smooth jQuery-UI interactions in SVG foreignObject? === An exemplar of this not working is in this fiddle: http://jsfiddle.net/sP3UZ/ If you remove the SVG wrapper, everything works fine, but as soon as it's wrapped, everything gets choppy and unpredictable. I see different but always broken results in chrome and firefox.
0
11,471,935
07/13/2012 13:55:38
1,464,110
06/18/2012 15:30:48
11
0
Auto margin for input float left
<div style="width:500px"> <input type="text"><input type="text"><input type="text"> </div> Inputs have width 31% and i will, that they fill the parent div in 100%. Auto margin for first two inputs. Like this: http://imageshack.us/f/809/inputs.png/
input
width
margin
fill
null
null
open
Auto margin for input float left === <div style="width:500px"> <input type="text"><input type="text"><input type="text"> </div> Inputs have width 31% and i will, that they fill the parent div in 100%. Auto margin for first two inputs. Like this: http://imageshack.us/f/809/inputs.png/
0
11,571,670
07/20/2012 01:32:24
933,864
09/08/2011 01:16:42
139
2
Use jQuery to change the background image effect
I am trying to use jQuery to change the effect of my background picture. Here is my jquery: $("#piceffect").change(function() { $('#backgroundpicture').css({'background-image': 'repeat'} }); How would I go about getting the background image in my div "backgroundpicture" to repeat when the id "piceffect" changes. I have tried a lot and what I have above is the best that I can do. Any help would greatly be appreciated. Thanks!
javascript
jquery
null
null
null
null
open
Use jQuery to change the background image effect === I am trying to use jQuery to change the effect of my background picture. Here is my jquery: $("#piceffect").change(function() { $('#backgroundpicture').css({'background-image': 'repeat'} }); How would I go about getting the background image in my div "backgroundpicture" to repeat when the id "piceffect" changes. I have tried a lot and what I have above is the best that I can do. Any help would greatly be appreciated. Thanks!
0
11,571,675
07/20/2012 01:33:21
205,245
11/06/2009 21:12:11
955
48
"PolicyException: Required permissions cannot be acquired" in Full Trust — can't see why
This is a two-part question, of sorts. I'm trying to set up a new part of our Production (Live) hosting architecture, so I'm trying to point our Staging webserver to the new Production content share (a UNC path on another server in the same subnet). I'm currently getting the dreaded _PolicyException: Required permissions cannot be acquired_ message. * The user context has Modify rights over the full hierarchy of the contents share. * I have added `<trust level="Full" originUrl="" />` to the Web.config (and I'm pretty sure it was already the case, ayway) * I have [run `caspol`](http://stackoverflow.com/a/9552246/205245) * I have [checked the AppPool settings](http://stackoverflow.com/a/1848756/205245) — the Identity is set to the appropriate username and Load User Profile is set to True * I have only just set up the content share and the IIS site, so I know the usernames and passwords are all in sync (and I did double-check). More confusing is that the assembly that's complaining is one of our internal code libraries. Decompiling it in [ILSpy](http://wiki.sharpdevelop.net/ILSpy.ashx), I can see a reference to <!-- language: lang-cs --> [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] , except I don't remember ever adding any code-access security into that assembly. None of the classes that reference `Security` has anything declarative in it and certainly no reference to [AllowPartiallyTrustedCallersAttribute or CodeAccessPermission.Assert](http://msdn.microsoft.com/en-us/library/ms998326.aspx#paght000017_wrappingprivilegedcode). I have full administrative access to all the servers involved (both the webserver and the server holding the content share). So how do I make this problem go away? (And can we turn [question #1846816](http://stackoverflow.com/questions/1846816/iis7-failed-to-grant-minimum-permission-requests) into a community wiki with all the possible answers in, rather than having to read zillions of questions with undescriptive titles and far too many hits on Google? ;o)
asp.net
iis7
web-security
code-access-security
null
null
open
"PolicyException: Required permissions cannot be acquired" in Full Trust — can't see why === This is a two-part question, of sorts. I'm trying to set up a new part of our Production (Live) hosting architecture, so I'm trying to point our Staging webserver to the new Production content share (a UNC path on another server in the same subnet). I'm currently getting the dreaded _PolicyException: Required permissions cannot be acquired_ message. * The user context has Modify rights over the full hierarchy of the contents share. * I have added `<trust level="Full" originUrl="" />` to the Web.config (and I'm pretty sure it was already the case, ayway) * I have [run `caspol`](http://stackoverflow.com/a/9552246/205245) * I have [checked the AppPool settings](http://stackoverflow.com/a/1848756/205245) — the Identity is set to the appropriate username and Load User Profile is set to True * I have only just set up the content share and the IIS site, so I know the usernames and passwords are all in sync (and I did double-check). More confusing is that the assembly that's complaining is one of our internal code libraries. Decompiling it in [ILSpy](http://wiki.sharpdevelop.net/ILSpy.ashx), I can see a reference to <!-- language: lang-cs --> [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] , except I don't remember ever adding any code-access security into that assembly. None of the classes that reference `Security` has anything declarative in it and certainly no reference to [AllowPartiallyTrustedCallersAttribute or CodeAccessPermission.Assert](http://msdn.microsoft.com/en-us/library/ms998326.aspx#paght000017_wrappingprivilegedcode). I have full administrative access to all the servers involved (both the webserver and the server holding the content share). So how do I make this problem go away? (And can we turn [question #1846816](http://stackoverflow.com/questions/1846816/iis7-failed-to-grant-minimum-permission-requests) into a community wiki with all the possible answers in, rather than having to read zillions of questions with undescriptive titles and far too many hits on Google? ;o)
0
11,571,629
07/20/2012 01:26:00
93,966
04/21/2009 19:00:56
18,413
982
concatenate all values in NSMutableDictionary cast to int, NSInteger and NSString
so I have a couple NSMutableDictionarys and each key/valeu pair for a specific dictionary hold either a string or integer value. I would like to know if there is a way to iterate through the dictionary and concatenate the values. In PHP I could do something like this using an array // either the dictionary holds all integers or all string values $integer_array = array( 'a' => 2, 'b' => 9, 'c' => 2, 'd' => 0, 'e' => 1 ); foreach( $integer_array as $key => $value ) { $concatenated_value .= $value; } // prints: 29201 echo $concatenated_value; // cast to int $concatenated_value = ( int ) $concatenated_value; is there something like this for iOS Objective-C?
objective-c
ios
casting
concatenation
nsmutabledictionary
null
open
concatenate all values in NSMutableDictionary cast to int, NSInteger and NSString === so I have a couple NSMutableDictionarys and each key/valeu pair for a specific dictionary hold either a string or integer value. I would like to know if there is a way to iterate through the dictionary and concatenate the values. In PHP I could do something like this using an array // either the dictionary holds all integers or all string values $integer_array = array( 'a' => 2, 'b' => 9, 'c' => 2, 'd' => 0, 'e' => 1 ); foreach( $integer_array as $key => $value ) { $concatenated_value .= $value; } // prints: 29201 echo $concatenated_value; // cast to int $concatenated_value = ( int ) $concatenated_value; is there something like this for iOS Objective-C?
0
11,571,630
07/20/2012 01:26:01
1,454,340
06/13/2012 17:26:21
17
0
CLLocationCoordinate2D to MKAnnotation
I have a MapView that I'm trying to add an Annotation at the current Coordinates. My Code in viewWillAppear: CLLocationCoordinate2D location; location.latitude = [maps.barLat doubleValue]; location.longitude = [maps.barLong doubleValue]; [_mapView addAnnotation:location]; I'm getting an error on the `addAnnotation` that says 'Sending CLLocationCoordinate2D to parameter of incompatible type MKAnnotation. All the other examples I see have no problem with this code, what am I missing?
iphone
ios
xcode
null
null
null
open
CLLocationCoordinate2D to MKAnnotation === I have a MapView that I'm trying to add an Annotation at the current Coordinates. My Code in viewWillAppear: CLLocationCoordinate2D location; location.latitude = [maps.barLat doubleValue]; location.longitude = [maps.barLong doubleValue]; [_mapView addAnnotation:location]; I'm getting an error on the `addAnnotation` that says 'Sending CLLocationCoordinate2D to parameter of incompatible type MKAnnotation. All the other examples I see have no problem with this code, what am I missing?
0
11,571,678
07/20/2012 01:34:01
204,255
11/05/2009 22:46:22
886
8
Integrating with external portlets using WSRP from non-portlet webapp: Is it possible? How?
We are planning to rewrite an existing portlet-based application and are trying to find out if we can just rewrite it as a normal webapp (using Spring MVC). Most of us on the team think that the use of portlets for the app is overkill since most pages are forms-based and only have one portlet per page. However, the app also integrates with externally-deployed portlets using WSRP. If we were going to be using portlets again, then integrating with other portlets would be a no-brainer. But from a non-portlet webapp, how would we integrate with the WSRP portlets? Would it basically be the same as any other SOAP web service? Would it also return CSS in its response, or do we have to set this up manually? How would we go about authenticating with the WSRP portlet (our systems use Siteminder for SSO).
web-applications
servlets
integration
portlet
wsrp
null
open
Integrating with external portlets using WSRP from non-portlet webapp: Is it possible? How? === We are planning to rewrite an existing portlet-based application and are trying to find out if we can just rewrite it as a normal webapp (using Spring MVC). Most of us on the team think that the use of portlets for the app is overkill since most pages are forms-based and only have one portlet per page. However, the app also integrates with externally-deployed portlets using WSRP. If we were going to be using portlets again, then integrating with other portlets would be a no-brainer. But from a non-portlet webapp, how would we integrate with the WSRP portlets? Would it basically be the same as any other SOAP web service? Would it also return CSS in its response, or do we have to set this up manually? How would we go about authenticating with the WSRP portlet (our systems use Siteminder for SSO).
0
11,571,680
07/20/2012 01:34:07
1,255,746
03/07/2012 21:32:34
49
1
Android Development - Graphical Layout looks different from actual XML
Alright so I quickly created an XML file with the following contents: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ScrollView android:id="@+id/scrollView1" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Text View 1" android:textSize="30dp" /> <ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Text View 2" android:textSize="30dp" /> <ListView android:id="@+id/listView2" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> <TextView android:id="@+id/textView3" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Text View 3" android:textSize="30dp" /> <ListView android:id="@+id/listView3" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> </LinearLayout> </ScrollView> </LinearLayout> And the question is, is that why does it look so much different when I click on the "Graphical Layout" tab? What I imagined the graphical layout to look like would basically be 3 labels right under each other (this is because I set everything to wrap content, and because there are no items inside either of the ListViews, so I'd think that it wouldn't even be visible). But anyway, the graphical layout shows it to be: ![Graphical Layout][1] [1]: http://i.stack.imgur.com/NJ4PW.png I'm not sure if that's correct or not, and if I run it will it look like I imagine it to look? I basically want (everything inside 1 ScrollView) 3 TextView's, and 1 ListView immediately following each TextView. So the layout will look like this: ScrollView TextView ListView TextView ListView TextView ListView End of ScrollView Something exactly like the layout shown above. Could someone please tell me what is wrong within my XML file for all the other labels not be showing on it? Note: When I click on the components on the side, it seems that a few things are shifting. (When I tried clicking on the TextView2 (to try to search for the blue bounds box) it seemed like the TextView1 label got pushed down a bit, and the second TextView was still not visible. If anyone could please help me achieve the layout that I want, it would be greatly appreciated.
android
android-layout
android-emulator
null
null
null
open
Android Development - Graphical Layout looks different from actual XML === Alright so I quickly created an XML file with the following contents: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ScrollView android:id="@+id/scrollView1" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Text View 1" android:textSize="30dp" /> <ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Text View 2" android:textSize="30dp" /> <ListView android:id="@+id/listView2" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> <TextView android:id="@+id/textView3" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Text View 3" android:textSize="30dp" /> <ListView android:id="@+id/listView3" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> </LinearLayout> </ScrollView> </LinearLayout> And the question is, is that why does it look so much different when I click on the "Graphical Layout" tab? What I imagined the graphical layout to look like would basically be 3 labels right under each other (this is because I set everything to wrap content, and because there are no items inside either of the ListViews, so I'd think that it wouldn't even be visible). But anyway, the graphical layout shows it to be: ![Graphical Layout][1] [1]: http://i.stack.imgur.com/NJ4PW.png I'm not sure if that's correct or not, and if I run it will it look like I imagine it to look? I basically want (everything inside 1 ScrollView) 3 TextView's, and 1 ListView immediately following each TextView. So the layout will look like this: ScrollView TextView ListView TextView ListView TextView ListView End of ScrollView Something exactly like the layout shown above. Could someone please tell me what is wrong within my XML file for all the other labels not be showing on it? Note: When I click on the components on the side, it seems that a few things are shifting. (When I tried clicking on the TextView2 (to try to search for the blue bounds box) it seemed like the TextView1 label got pushed down a bit, and the second TextView was still not visible. If anyone could please help me achieve the layout that I want, it would be greatly appreciated.
0
11,350,015
07/05/2012 18:05:34
1,489,250
06/28/2012 16:42:58
26
3
Encoding error in opening the links in Android
I am using the follwoing code to make text clickable in android text.setText("http://www.youtube.com/watch?v=Ii2FHbtVJzc"); android:autoLink="web" android:linksClickable="true" I am not able to open the link because the above link opens as http://www.youtube.com/E2%80%bwatch?v=Ii2FHbtVJzc in the browser %80% are extra characters .
android
android-layout
null
null
null
null
open
Encoding error in opening the links in Android === I am using the follwoing code to make text clickable in android text.setText("http://www.youtube.com/watch?v=Ii2FHbtVJzc"); android:autoLink="web" android:linksClickable="true" I am not able to open the link because the above link opens as http://www.youtube.com/E2%80%bwatch?v=Ii2FHbtVJzc in the browser %80% are extra characters .
0
11,349,963
07/05/2012 18:02:00
884,162
08/08/2011 13:29:48
248
11
Objective-C visibleCells and indexPathsForVisibleRows
How do I read intValue of an array of NSIndexpaths through indexPathsForVisibleRows? By the way, why do visibleCells and indexPathsForVisibleRows not work before if (cell == nil) function?
objective-c
uitableview
uitableviewcell
nsindexpath
null
null
open
Objective-C visibleCells and indexPathsForVisibleRows === How do I read intValue of an array of NSIndexpaths through indexPathsForVisibleRows? By the way, why do visibleCells and indexPathsForVisibleRows not work before if (cell == nil) function?
0
11,349,964
07/05/2012 18:02:08
760,746
05/19/2011 09:21:35
1,627
70
Changing some MMU translation table entries - the right way?
What are the steps to update entries in the translation table? I use the MMU of an ARM920T to get some memory protection. When I switch between processes I need to change some of the entries to protect the memory of the other processes. After updating the table (in memory) I issue a full TLB invalidation (just to be sure) but the new process still has access to the data of the previous one. When I traverse the table everything looks like it should (meaning the other process areas are set to not accessible in USR mode).
c
arm
virtual-memory
tlb
null
null
open
Changing some MMU translation table entries - the right way? === What are the steps to update entries in the translation table? I use the MMU of an ARM920T to get some memory protection. When I switch between processes I need to change some of the entries to protect the memory of the other processes. After updating the table (in memory) I issue a full TLB invalidation (just to be sure) but the new process still has access to the data of the previous one. When I traverse the table everything looks like it should (meaning the other process areas are set to not accessible in USR mode).
0
11,350,017
07/05/2012 18:05:43
986,894
10/09/2011 23:57:25
101
0
Getting precision of a float in Perl?
Let's say I had a Perl variable: `my $string = "40.23";` `my $convert_to_num = $string * 1;` Is there a way I can find the precision of this float value? My solution so far was to simply just loop through the string, find the first instance of '.', and just start counting how many decimal places, returning 2 in this case. I'm just wondering if there was a more elegant or built-in function for this sort of thing. Thanks!
string
perl
floating-point
decimal
null
null
open
Getting precision of a float in Perl? === Let's say I had a Perl variable: `my $string = "40.23";` `my $convert_to_num = $string * 1;` Is there a way I can find the precision of this float value? My solution so far was to simply just loop through the string, find the first instance of '.', and just start counting how many decimal places, returning 2 in this case. I'm just wondering if there was a more elegant or built-in function for this sort of thing. Thanks!
0
11,350,019
07/05/2012 18:05:51
921,075
08/31/2011 06:45:54
47
0
Django with Windows: Double backslash or front slash?
So, I'm a beginner trying to learn django right now with "Practical Django Projects" with windows in eclipse pydev. Anyways, main issue is I use windows and it seems to suggest I should use front slash in the comments for settings.py. But by default, the databases is already set to: 'NAME': 'C:\\Users\\dtc\\Documents\\Eclipse\\cms\\sqlite.db' And while I was going through the book, it wants me to add this: url(r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': '/path/to/tiny_mce/' }), But that path didn't work until I changed to double backslash \\\path\\\to\\\\...so I'm thinking I should just not worry about using double backslash. It would be great if someone gave me a little insight on this because it's giving me a total headache while trying to learn django.
windows
django
syntax
null
null
null
open
Django with Windows: Double backslash or front slash? === So, I'm a beginner trying to learn django right now with "Practical Django Projects" with windows in eclipse pydev. Anyways, main issue is I use windows and it seems to suggest I should use front slash in the comments for settings.py. But by default, the databases is already set to: 'NAME': 'C:\\Users\\dtc\\Documents\\Eclipse\\cms\\sqlite.db' And while I was going through the book, it wants me to add this: url(r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': '/path/to/tiny_mce/' }), But that path didn't work until I changed to double backslash \\\path\\\to\\\\...so I'm thinking I should just not worry about using double backslash. It would be great if someone gave me a little insight on this because it's giving me a total headache while trying to learn django.
0
11,350,020
07/05/2012 18:05:56
688,161
04/01/2011 19:24:22
579
28
How can I improve my model for a vocabulary list?
I am programming a small **vocabulary viewer** in Java. You can - add vocabulary to a language - switch between languages - see an overview for each language (with many vocabulary) - watch vocabulary in detail The interesting thing is that I want to display the translation for **all languages** if a vocabulary has been added in many languages (I know that this can lead to wrong connections in terms of linguistics, but it’s just for training my Java skills anyway). Currently I have the following classes: - `VocabularyList (Observable)`, which is just a list implementation for many `<Vocabulary>` with additional methods for retrieving by language etc. This list is observed by all my overview page, when something in this list changes, it refreshes the view. - `Vocabulary` which uses `HashMap<Language, ArrayList<String>> meanings` to save all meanings **in all languages** (so e.g. I could say that *helfen* in German means the same as *help* or *aid* in English). - `Language` which is only a class for representing a language (by ISO code and name) I also store everything in the **same serialization file** at the moment. I would like serialization instead of database to keep the whole thing easy. However, I have the feeling that this model is totally wrong, because: - I cannot access vocabulary for each languages separately (even though I have a selection field for the language in my program), so I have to iterate through the whole list each time the user watches the overview page - I always carry the overhead for all languages around even if somebody only watches the overview (and not a detail page with translations for all languages) However, I do not really know how I should implement it better, if I want to keep the relation between all different vocabulary languages. The next idea is: - Create one vocabulary list for **each** language But then the whole relationship stuff would be difficult. E.g. if I deleted a vocabulary from the *Russian list* I would have to delete all links to it from all other language lists. What model design would you suggest? Am I totally of the way or is it already somehow correct? As web developer I have only worked with databases all the time (mostly relational), where in such a case I would just have to delete an entry in a many-to-many relationship table. But when working with objects everything seems different.
java
null
null
null
null
null
open
How can I improve my model for a vocabulary list? === I am programming a small **vocabulary viewer** in Java. You can - add vocabulary to a language - switch between languages - see an overview for each language (with many vocabulary) - watch vocabulary in detail The interesting thing is that I want to display the translation for **all languages** if a vocabulary has been added in many languages (I know that this can lead to wrong connections in terms of linguistics, but it’s just for training my Java skills anyway). Currently I have the following classes: - `VocabularyList (Observable)`, which is just a list implementation for many `<Vocabulary>` with additional methods for retrieving by language etc. This list is observed by all my overview page, when something in this list changes, it refreshes the view. - `Vocabulary` which uses `HashMap<Language, ArrayList<String>> meanings` to save all meanings **in all languages** (so e.g. I could say that *helfen* in German means the same as *help* or *aid* in English). - `Language` which is only a class for representing a language (by ISO code and name) I also store everything in the **same serialization file** at the moment. I would like serialization instead of database to keep the whole thing easy. However, I have the feeling that this model is totally wrong, because: - I cannot access vocabulary for each languages separately (even though I have a selection field for the language in my program), so I have to iterate through the whole list each time the user watches the overview page - I always carry the overhead for all languages around even if somebody only watches the overview (and not a detail page with translations for all languages) However, I do not really know how I should implement it better, if I want to keep the relation between all different vocabulary languages. The next idea is: - Create one vocabulary list for **each** language But then the whole relationship stuff would be difficult. E.g. if I deleted a vocabulary from the *Russian list* I would have to delete all links to it from all other language lists. What model design would you suggest? Am I totally of the way or is it already somehow correct? As web developer I have only worked with databases all the time (mostly relational), where in such a case I would just have to delete an entry in a many-to-many relationship table. But when working with objects everything seems different.
0
11,350,026
07/05/2012 18:06:11
1,188,511
02/03/2012 21:50:23
84
3
Replace infinite thread loop (message pump) with Tasks
In my application I have to listen on multiple different queues and deserialize/dispatch incoming messages received on queues. Actually, what I am doing to achieve this is that each QueueConnector object creates a new thread on construction, which executes a infinite loop with a blocking call to queue.Receive() to receive next message in queue as exposed by the code below : // Instantiate message pump thread msmqPumpThread = new Thread(() => while (true) { // Blocking call (infinite timeout) // Wait for a new message to come in queue and get it var message = queue.Receive(); // Deserialize/Dispatch message DeserializeAndDispatchMessage(message); }).Start(); I'd like to know if this "message pump" can be replaced using Task(s) instead of going through an infinite loop on a new Thread. I made a task already for the Message receiving part (see below) but I don't really see how to use it for a message pump (Can I recall the same task on completion over and over again, with continuations, replacing infinite loop in separate thread as in the code above ?) Task<Message> GetMessageFromQueueAsync() { var tcs = new TaskCompletionSource<Message>(); ReceiveCompletedEventHandler receiveCompletedHandler = null; receiveCompletedHandler = (s, e) => { queue.ReceiveCompleted -= receiveCompletedHandler; tcs.SetResult(e.Message); }; queue.BeginReceive(); return tcs.Task; } Will I gain anything by using Tasks instead of an infinite loop in a separate thread (with a blocking call => blocking thread) in this context ? And if yes, how to do it properly ? **EDIT :** Please note that this application don't have a lot of QueueConnector objects, and won't have (maybe 10 connectors MAX), meaning ten Threads max through the first solution, so memory footprint / performance starting threads is not an issue here. I was rather thinking about scheduling performance / CPU usage. Will there be any difference ? If my question is unclear or lack details, please let me know. Thanks !
c#
asynchronous
task-parallel-library
null
null
null
open
Replace infinite thread loop (message pump) with Tasks === In my application I have to listen on multiple different queues and deserialize/dispatch incoming messages received on queues. Actually, what I am doing to achieve this is that each QueueConnector object creates a new thread on construction, which executes a infinite loop with a blocking call to queue.Receive() to receive next message in queue as exposed by the code below : // Instantiate message pump thread msmqPumpThread = new Thread(() => while (true) { // Blocking call (infinite timeout) // Wait for a new message to come in queue and get it var message = queue.Receive(); // Deserialize/Dispatch message DeserializeAndDispatchMessage(message); }).Start(); I'd like to know if this "message pump" can be replaced using Task(s) instead of going through an infinite loop on a new Thread. I made a task already for the Message receiving part (see below) but I don't really see how to use it for a message pump (Can I recall the same task on completion over and over again, with continuations, replacing infinite loop in separate thread as in the code above ?) Task<Message> GetMessageFromQueueAsync() { var tcs = new TaskCompletionSource<Message>(); ReceiveCompletedEventHandler receiveCompletedHandler = null; receiveCompletedHandler = (s, e) => { queue.ReceiveCompleted -= receiveCompletedHandler; tcs.SetResult(e.Message); }; queue.BeginReceive(); return tcs.Task; } Will I gain anything by using Tasks instead of an infinite loop in a separate thread (with a blocking call => blocking thread) in this context ? And if yes, how to do it properly ? **EDIT :** Please note that this application don't have a lot of QueueConnector objects, and won't have (maybe 10 connectors MAX), meaning ten Threads max through the first solution, so memory footprint / performance starting threads is not an issue here. I was rather thinking about scheduling performance / CPU usage. Will there be any difference ? If my question is unclear or lack details, please let me know. Thanks !
0
11,350,032
07/05/2012 18:06:41
1,504,744
07/05/2012 17:18:35
1
0
How to make a resizable menu centered on the middle?
Pls help!!! CSS: body { margin: 0px; padding: 0px; } body #header { width:100%; clear:both; height:90px; /*overflow:hidden*/; box-shadow: 1px 0px 10px 2px #000; } body #header #h_l { width: 30%; height: 90px; background-image: linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -o-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -moz-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -webkit-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -ms-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(40%, #e1e1e1), color-stop(99%, #9d9d9d)); /* Safari 4+, Chrome 2+ */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e1e1e1', endColorstr='#9d9d9d'); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#e1e1e1', endColorstr='#9d9d9d')"; /* IE8+ */ background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0.40, #e1e1e1), color-stop(0.99, #9d9d9d) ); float:left; } body #header #h_l #logo { float: right; /*-ms-interpolation-mode:bicubic; */ max-width: 100%; width: auto\9; /* ie8 */ } body #header #h_r { width: 70%; height: 90px; background: #747474; float: right; } body #header #h_r #menu { position: relative; left: -50px; float:left; /*-ms-interpolation-mode:bicubic; */ max-width: 100%; width: auto\9; /* ie8 */ } HTML: <body > <div id="header"> <div id="h_l"> <img id="logo" title="logo" alt="logo" src="{HTTP}{WEBSITE}/images/newlook/MM/logo_plus100px_right.png" > </div> <div id="h_r"> <span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Home_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Solutions_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Support_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Company_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Contact_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Blog_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Reseller_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Apps_but.png" ></span> </div> </div> </body> Why do the elements from the menu on the right keep going on a new row one by one on browser window resizing?? How can i make it stop doing that and enable it to just resize like the image on the left, upon browser window resizing (as if the whole menu would be a full block)? Can it be done in CSS or do i need to make a javascript? Thanks to anyone who answers!
css
css-float
positioning
relativelayout
css-menu
null
open
How to make a resizable menu centered on the middle? === Pls help!!! CSS: body { margin: 0px; padding: 0px; } body #header { width:100%; clear:both; height:90px; /*overflow:hidden*/; box-shadow: 1px 0px 10px 2px #000; } body #header #h_l { width: 30%; height: 90px; background-image: linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -o-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -moz-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -webkit-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -ms-linear-gradient(top, #e1e1e1 40%, #9d9d9d 99%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(40%, #e1e1e1), color-stop(99%, #9d9d9d)); /* Safari 4+, Chrome 2+ */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e1e1e1', endColorstr='#9d9d9d'); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#e1e1e1', endColorstr='#9d9d9d')"; /* IE8+ */ background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0.40, #e1e1e1), color-stop(0.99, #9d9d9d) ); float:left; } body #header #h_l #logo { float: right; /*-ms-interpolation-mode:bicubic; */ max-width: 100%; width: auto\9; /* ie8 */ } body #header #h_r { width: 70%; height: 90px; background: #747474; float: right; } body #header #h_r #menu { position: relative; left: -50px; float:left; /*-ms-interpolation-mode:bicubic; */ max-width: 100%; width: auto\9; /* ie8 */ } HTML: <body > <div id="header"> <div id="h_l"> <img id="logo" title="logo" alt="logo" src="{HTTP}{WEBSITE}/images/newlook/MM/logo_plus100px_right.png" > </div> <div id="h_r"> <span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Home_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Solutions_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Support_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Company_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Contact_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Blog_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Reseller_but.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Divider_1.png" ></span><span ><img id="menu" title="" alt="" src="{HTTP}{WEBSITE}/images/newlook/MM/Apps_but.png" ></span> </div> </div> </body> Why do the elements from the menu on the right keep going on a new row one by one on browser window resizing?? How can i make it stop doing that and enable it to just resize like the image on the left, upon browser window resizing (as if the whole menu would be a full block)? Can it be done in CSS or do i need to make a javascript? Thanks to anyone who answers!
0
11,350,034
07/05/2012 18:06:48
1,504,821
07/05/2012 17:58:00
1
0
How to hide and send keystrokes to a command prompt window using perl?
I have written a perl script using Win32::GUItest to send keystrokes to a command prompt window in windows, now when my script runs, it uses the system function in perl and opens a new cmd.exe file and keystrokes are sent to it. everything work fine till here but i dont want that command prompt window to be visible and users manually running the script. I want the keystrokes to be sent into the cmd.exe window in the background. i want to schedule the script using schtasks using windows 64 bit server. Please do not suggest me to use Proc::background, Win32::service and win32::Daemon unless you have really tried this task working fine for you using them.
windows
perl
background
null
null
null
open
How to hide and send keystrokes to a command prompt window using perl? === I have written a perl script using Win32::GUItest to send keystrokes to a command prompt window in windows, now when my script runs, it uses the system function in perl and opens a new cmd.exe file and keystrokes are sent to it. everything work fine till here but i dont want that command prompt window to be visible and users manually running the script. I want the keystrokes to be sent into the cmd.exe window in the background. i want to schedule the script using schtasks using windows 64 bit server. Please do not suggest me to use Proc::background, Win32::service and win32::Daemon unless you have really tried this task working fine for you using them.
0
11,499,807
07/16/2012 07:25:24
1,528,146
07/16/2012 07:16:58
1
0
A certain parameter has 3 possible values, and there are n such parameters with 3 values each. Need to create scenarios by randomly changing them
A certain parameter has ***3*** possible values, and there are ***n*** such parameters with 3 values each. Need to create scenarios by randomly changing them and save each scenario as a text file, without any duplicated scenarios.
c
matlab
null
null
null
null
open
A certain parameter has 3 possible values, and there are n such parameters with 3 values each. Need to create scenarios by randomly changing them === A certain parameter has ***3*** possible values, and there are ***n*** such parameters with 3 values each. Need to create scenarios by randomly changing them and save each scenario as a text file, without any duplicated scenarios.
0
11,499,808
07/16/2012 07:25:24
1,124,946
01/01/2012 08:28:56
309
0
How to modify the QTreeWidget?
I want to non-display the space between parent `QWidgetItem` and child-Item... How can i do that. `style-Sheet` ?.. thank you!!! this is a `QTreeWidget`. ![enter image description here][1] [1]: http://i.stack.imgur.com/rMBv0.jpg
qt
null
null
null
null
null
open
How to modify the QTreeWidget? === I want to non-display the space between parent `QWidgetItem` and child-Item... How can i do that. `style-Sheet` ?.. thank you!!! this is a `QTreeWidget`. ![enter image description here][1] [1]: http://i.stack.imgur.com/rMBv0.jpg
0
11,499,809
07/16/2012 07:25:32
361,768
06/08/2010 20:04:37
1
0
WPF MVVM structure and performance
I have a requirement to create a simple menu/selection design tool - the idea is to have a selection of categories and a larger selection of choices which are filtered by a category selected. Ultimately this will run in a Kiosk-style environment. I'm using MVVM and my design consists of a view containing 2 grids inside two ItemsControls - one for the categories (2 rows by 10 columns) and one for the choices (10 x 10). In my ViewModel these ItemsControls are both bound to ObservableCollection<T> objects with some details (caption, colour etc.) bound to properties of the <T> part. The DataTemplate is bound to an item class in a seperate assembly as I want to reuse them in the kiosk app too. I've used a "ModifiedBehaviours" class to map right and left clicks on my grid objects to commands picked up by the ViewModel similar to this http://stackoverflow.com/questions/926451/how-can-i-attach-two-attached-behaviors-to-one-xaml-element The design seems "clean" from what I have read (relatively new to MVVM here) in that the code-behind of the view has nothing in it except assigning the ViewModel to the window's DataContext, no x:name= tags in the view and the ViewModel doesn't interract with the view directly. However I do have a problem with performance. When the user clicks on a category I create a new ObservableCollection containing the detail items for it - I also fill in the blanks in design mode so I end up with 100 choices, the empty ones having "Right click to edit" in them. The time to create this collection is tiny - < 0.01 secs on a 1.6 Ghz netbook (the Kiosk PC will be slow so I'm testing on slowish hardware). However once the collection the control is bound to is refreshed the UI takes about 2 seconds to update which is far slower than the older app I'm recreating - that is written in very old Delphi. I've tried various things. Firstly I simplified my XAML by removing some gradients and other stuff to make it as simple as possible - eventually coming down to a single textblock. Then when refreshing the collection I create it seperately and then assign it to the bound one so the update happens "all at once". Thirdly I broke my design slightly and added a BeginInit() and EndInit() around the update code for the window and the grid. None of these made the slightest improvement. The following did - which leads to my question(s). 1. I removed one of the command behaviours from the item control - I need both though for right and left click. Could the fact this has to bind the event for each item cell (100 of them) to the command cause the problem ? Is there an alternative approach to right and left click for each grid cell ? 2. <- this is 2 in my markup! I copied the XAML for the item (a border, a textblock and the commands) from the seperate assembly into the main window XAML. This gave the largest, simple improvement but I don't understand why. Both seperately made a difference, both together make the performance "acceptable" - still very sluggish though. Is there anything else I can be looking at ? My control looks like this (in a seperate assembly). Before anyone points out as stated above I've tried removing a lot of this and even cutting this right down to just be a textblock. <Control.Resources> <Style x:Key="MyBorderStyle" TargetType="Border"> <Style.Triggers> <DataTrigger Binding="{Binding IsSelected}" Value="True"> <Setter Property="BorderBrush" Value="Red"/> <Setter Property="BorderThickness" Value="3"/> </DataTrigger> <DataTrigger Binding="{Binding IsSelected}" Value="False"> <Setter Property="BorderBrush" Value="{Binding BackColour}"/> <Setter Property="BorderThickness" Value="0"/> </DataTrigger> </Style.Triggers> </Style> </Control.Resources> <Grid> <Border Margin="1" Style="{StaticResource MyBorderStyle}" CornerRadius="8"> <CommandBehaviour:CommandBehaviorCollection.Behaviors> <CommandBehaviour:BehaviorBinding Event="MouseLeftButtonDown" Command="{Binding DataContext.SelectLeftCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding ItemKey}"/> <CommandBehaviour:BehaviorBinding Event="MouseRightButtonDown" Command="{Binding DataContext.SelectRightCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding ItemKey}"/> </CommandBehaviour:CommandBehaviorCollection.Behaviors> <Border.Background> <LinearGradientBrush StartPoint="0.7,0" EndPoint="0.7,1"> <GradientStop Color="{Binding BackColour}" Offset="0"/> <GradientStop Color="#33333333" Offset="1.5"/> </LinearGradientBrush> </Border.Background> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{Binding ForeColour}" Text="{Binding Description}"/> </Border> </Grid> I can leave a lot of this in place when I copy it to the ItemsTemplate in the main window and the performance improvement sticks. Statement-Rant One of the biggest problems with WPF seems to be that a lot of the performance (and other) issues are "down the rabbit hole" somewhere - in code behind the scenes - which makes it very difficult to work out what is happening without external and sometimes quite complex perf and profiling tools and the time to download, install and learn them. Which is pants really. And breathe... End of Statement-Rant
c#
.net
wpf
mvvm
null
null
open
WPF MVVM structure and performance === I have a requirement to create a simple menu/selection design tool - the idea is to have a selection of categories and a larger selection of choices which are filtered by a category selected. Ultimately this will run in a Kiosk-style environment. I'm using MVVM and my design consists of a view containing 2 grids inside two ItemsControls - one for the categories (2 rows by 10 columns) and one for the choices (10 x 10). In my ViewModel these ItemsControls are both bound to ObservableCollection<T> objects with some details (caption, colour etc.) bound to properties of the <T> part. The DataTemplate is bound to an item class in a seperate assembly as I want to reuse them in the kiosk app too. I've used a "ModifiedBehaviours" class to map right and left clicks on my grid objects to commands picked up by the ViewModel similar to this http://stackoverflow.com/questions/926451/how-can-i-attach-two-attached-behaviors-to-one-xaml-element The design seems "clean" from what I have read (relatively new to MVVM here) in that the code-behind of the view has nothing in it except assigning the ViewModel to the window's DataContext, no x:name= tags in the view and the ViewModel doesn't interract with the view directly. However I do have a problem with performance. When the user clicks on a category I create a new ObservableCollection containing the detail items for it - I also fill in the blanks in design mode so I end up with 100 choices, the empty ones having "Right click to edit" in them. The time to create this collection is tiny - < 0.01 secs on a 1.6 Ghz netbook (the Kiosk PC will be slow so I'm testing on slowish hardware). However once the collection the control is bound to is refreshed the UI takes about 2 seconds to update which is far slower than the older app I'm recreating - that is written in very old Delphi. I've tried various things. Firstly I simplified my XAML by removing some gradients and other stuff to make it as simple as possible - eventually coming down to a single textblock. Then when refreshing the collection I create it seperately and then assign it to the bound one so the update happens "all at once". Thirdly I broke my design slightly and added a BeginInit() and EndInit() around the update code for the window and the grid. None of these made the slightest improvement. The following did - which leads to my question(s). 1. I removed one of the command behaviours from the item control - I need both though for right and left click. Could the fact this has to bind the event for each item cell (100 of them) to the command cause the problem ? Is there an alternative approach to right and left click for each grid cell ? 2. <- this is 2 in my markup! I copied the XAML for the item (a border, a textblock and the commands) from the seperate assembly into the main window XAML. This gave the largest, simple improvement but I don't understand why. Both seperately made a difference, both together make the performance "acceptable" - still very sluggish though. Is there anything else I can be looking at ? My control looks like this (in a seperate assembly). Before anyone points out as stated above I've tried removing a lot of this and even cutting this right down to just be a textblock. <Control.Resources> <Style x:Key="MyBorderStyle" TargetType="Border"> <Style.Triggers> <DataTrigger Binding="{Binding IsSelected}" Value="True"> <Setter Property="BorderBrush" Value="Red"/> <Setter Property="BorderThickness" Value="3"/> </DataTrigger> <DataTrigger Binding="{Binding IsSelected}" Value="False"> <Setter Property="BorderBrush" Value="{Binding BackColour}"/> <Setter Property="BorderThickness" Value="0"/> </DataTrigger> </Style.Triggers> </Style> </Control.Resources> <Grid> <Border Margin="1" Style="{StaticResource MyBorderStyle}" CornerRadius="8"> <CommandBehaviour:CommandBehaviorCollection.Behaviors> <CommandBehaviour:BehaviorBinding Event="MouseLeftButtonDown" Command="{Binding DataContext.SelectLeftCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding ItemKey}"/> <CommandBehaviour:BehaviorBinding Event="MouseRightButtonDown" Command="{Binding DataContext.SelectRightCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding ItemKey}"/> </CommandBehaviour:CommandBehaviorCollection.Behaviors> <Border.Background> <LinearGradientBrush StartPoint="0.7,0" EndPoint="0.7,1"> <GradientStop Color="{Binding BackColour}" Offset="0"/> <GradientStop Color="#33333333" Offset="1.5"/> </LinearGradientBrush> </Border.Background> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{Binding ForeColour}" Text="{Binding Description}"/> </Border> </Grid> I can leave a lot of this in place when I copy it to the ItemsTemplate in the main window and the performance improvement sticks. Statement-Rant One of the biggest problems with WPF seems to be that a lot of the performance (and other) issues are "down the rabbit hole" somewhere - in code behind the scenes - which makes it very difficult to work out what is happening without external and sometimes quite complex perf and profiling tools and the time to download, install and learn them. Which is pants really. And breathe... End of Statement-Rant
0
11,499,829
07/16/2012 07:27:51
1,486,349
06/27/2012 16:36:21
14
0
WP search function to search custom table
Now here's something I can't even find on google. Does anyone here know how I can change the search function in wordpress to search only inside one custom table with a few fields? I've been wrecking my brain over this. I can't even find a plugin that lets you define your own table and fields in the db. Can anyone help? (by the way I think that might be a really handy plugin, if it doesn't already exist.) Thanks in advance!
wordpress
search
customization
null
null
null
open
WP search function to search custom table === Now here's something I can't even find on google. Does anyone here know how I can change the search function in wordpress to search only inside one custom table with a few fields? I've been wrecking my brain over this. I can't even find a plugin that lets you define your own table and fields in the db. Can anyone help? (by the way I think that might be a really handy plugin, if it doesn't already exist.) Thanks in advance!
0
11,499,836
07/16/2012 07:28:33
82,062
03/24/2009 15:01:30
14,108
569
How to stub base class method that takes multiple arguments in RSpec?
I would like to test that instance of ChildClass calls something_interesting while omitting call to BaseClass.my_method class BaseClass def my_method *args, &block end end class ChildClass def my_method *args, &block something_interesting super 1, 2, *block end end If I write my test like this: subject = ChildClass.new subject.should_receive :something_interesting BaseClass.any_instance.stub :my_method subject.my_method I get error: >ArgumentError: wrong number of arguments (3 for 2) Any ideas why is that so? How to stub it out correctly?
ruby
rspec
null
null
null
null
open
How to stub base class method that takes multiple arguments in RSpec? === I would like to test that instance of ChildClass calls something_interesting while omitting call to BaseClass.my_method class BaseClass def my_method *args, &block end end class ChildClass def my_method *args, &block something_interesting super 1, 2, *block end end If I write my test like this: subject = ChildClass.new subject.should_receive :something_interesting BaseClass.any_instance.stub :my_method subject.my_method I get error: >ArgumentError: wrong number of arguments (3 for 2) Any ideas why is that so? How to stub it out correctly?
0
11,499,837
07/16/2012 07:28:35
1,282,832
03/21/2012 08:15:53
31
4
Multidimensional Vector wouldn't let me remove an item
I am using this definition of a multidimensional vector: Vector<Vector<sp<InputWindowHandle> > > mWindowHandles; It works fine almost everywhere in the code except in this line: (mWindowHandles[displayId]).removeAt(i--); I don't understand why. Isn't a single entry of Vector<Vector> should be a vector? This is the compiling error I am getting: passing 'const android::Vector<android::sp<android::InputWindowHandle> >' as 'this' argument of 'ssize_t android::Vector<TYPE>::removeAt(size_t) [with TYPE = android::sp<android::InputWindowHandle>]' discards qualifiers Can you please tell me what am I doing wrong?
android
c++
vector
null
null
null
open
Multidimensional Vector wouldn't let me remove an item === I am using this definition of a multidimensional vector: Vector<Vector<sp<InputWindowHandle> > > mWindowHandles; It works fine almost everywhere in the code except in this line: (mWindowHandles[displayId]).removeAt(i--); I don't understand why. Isn't a single entry of Vector<Vector> should be a vector? This is the compiling error I am getting: passing 'const android::Vector<android::sp<android::InputWindowHandle> >' as 'this' argument of 'ssize_t android::Vector<TYPE>::removeAt(size_t) [with TYPE = android::sp<android::InputWindowHandle>]' discards qualifiers Can you please tell me what am I doing wrong?
0
11,499,842
07/16/2012 07:28:48
1,517,509
07/11/2012 10:47:34
1
0
Aplication crashes while attempting to take a picture
I have 2 problems with my app: -it crashes when taking a picture -it crashes when I rotate the device cameraPreview.java: public class CameraPreview extends Activity implements SurfaceHolder.Callback { Camera camera; SurfaceView preview; SurfaceHolder holder; LayoutInflater controlInflater = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_camera_preview); getWindow().setFormat(PixelFormat.UNKNOWN); preview = (SurfaceView) findViewById(R.id.surface1); holder = preview.getHolder(); holder.addCallback(this); //holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); controlInflater = LayoutInflater.from(getBaseContext()); View viewControl = controlInflater.inflate(R.layout.control, null); LayoutParams layoutParamsControl = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT); this.addContentView(viewControl, layoutParamsControl); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Camera camera = Camera.open(); Configuration c = getResources().getConfiguration(); if(c.orientation == Configuration.ORIENTATION_PORTRAIT) { camera.setDisplayOrientation(90); } if(camera!=null) { try { camera.setPreviewDisplay(holder); } catch (IOException e) { e.printStackTrace(); } camera.startPreview(); }} public void surfaceCreated(SurfaceHolder holder) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { if(camera!=null) { camera.stopPreview(); camera.setPreviewCallback(null); camera.release(); camera=null; } } PictureCallback myPictureCallback_JPG = new PictureCallback() { @Override public void onPictureTaken(byte[] arg0, Camera arg1) { Bitmap bitmapPicture = BitmapFactory.decodeByteArray(arg0, 0, arg0.length); } }; public void take_picture_onClick(View view) { camera.takePicture(null, null, myPictureCallback_JPG); } } AndroidManifest.xml: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.paparazzi" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.camera" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" android:debuggable="true" > <activity android:name=".MainActivity" android:label="@string/title_activity_main" > </activity> <activity android:name=".CameraPreview" android:configChanges="orientation" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> At first i thought that the second issue might be caused by lack of this part: public void surfaceDestroyed(SurfaceHolder holder) { if(camera!=null) { camera.stopPreview(); camera.setPreviewCallback(null); camera.release(); camera=null; } } But nothing changed after adding it. As for the first issue I have no idea what's wrong. The app was tested on 3 different devices. I would appreciate any suggestions.
android
crash
camera
null
null
null
open
Aplication crashes while attempting to take a picture === I have 2 problems with my app: -it crashes when taking a picture -it crashes when I rotate the device cameraPreview.java: public class CameraPreview extends Activity implements SurfaceHolder.Callback { Camera camera; SurfaceView preview; SurfaceHolder holder; LayoutInflater controlInflater = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_camera_preview); getWindow().setFormat(PixelFormat.UNKNOWN); preview = (SurfaceView) findViewById(R.id.surface1); holder = preview.getHolder(); holder.addCallback(this); //holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); controlInflater = LayoutInflater.from(getBaseContext()); View viewControl = controlInflater.inflate(R.layout.control, null); LayoutParams layoutParamsControl = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT); this.addContentView(viewControl, layoutParamsControl); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Camera camera = Camera.open(); Configuration c = getResources().getConfiguration(); if(c.orientation == Configuration.ORIENTATION_PORTRAIT) { camera.setDisplayOrientation(90); } if(camera!=null) { try { camera.setPreviewDisplay(holder); } catch (IOException e) { e.printStackTrace(); } camera.startPreview(); }} public void surfaceCreated(SurfaceHolder holder) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { if(camera!=null) { camera.stopPreview(); camera.setPreviewCallback(null); camera.release(); camera=null; } } PictureCallback myPictureCallback_JPG = new PictureCallback() { @Override public void onPictureTaken(byte[] arg0, Camera arg1) { Bitmap bitmapPicture = BitmapFactory.decodeByteArray(arg0, 0, arg0.length); } }; public void take_picture_onClick(View view) { camera.takePicture(null, null, myPictureCallback_JPG); } } AndroidManifest.xml: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.paparazzi" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.camera" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" android:debuggable="true" > <activity android:name=".MainActivity" android:label="@string/title_activity_main" > </activity> <activity android:name=".CameraPreview" android:configChanges="orientation" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> At first i thought that the second issue might be caused by lack of this part: public void surfaceDestroyed(SurfaceHolder holder) { if(camera!=null) { camera.stopPreview(); camera.setPreviewCallback(null); camera.release(); camera=null; } } But nothing changed after adding it. As for the first issue I have no idea what's wrong. The app was tested on 3 different devices. I would appreciate any suggestions.
0
11,499,850
07/16/2012 07:29:38
993,164
10/13/2011 09:49:55
1
0
Undefined method '<' for [0, 0] :Array <NoMethodError>
I am beginner of Ruby programming. My program is count number of even length of words in a given string. But it's shows the following Error **Undefined method '<' for [0, 0] :Array <NoMethodError>** Here is My code def even(words, n) i = 0, m = 0 while i < n do count = count + words[i].length if count%2 == 0 then m = m + 1 end i = i + 1 end return m end prinnt "Enter The String:" s = gets.chomp words = s.split() n = words.length x = even(words, n) puts x
ruby-on-rails
ruby
null
null
null
null
open
Undefined method '<' for [0, 0] :Array <NoMethodError> === I am beginner of Ruby programming. My program is count number of even length of words in a given string. But it's shows the following Error **Undefined method '<' for [0, 0] :Array <NoMethodError>** Here is My code def even(words, n) i = 0, m = 0 while i < n do count = count + words[i].length if count%2 == 0 then m = m + 1 end i = i + 1 end return m end prinnt "Enter The String:" s = gets.chomp words = s.split() n = words.length x = even(words, n) puts x
0
11,499,863
07/16/2012 07:30:14
988,809
10/11/2011 04:19:49
1
2
ambiguous partial specializations with std::enable_if
I have a problem encountered at a condtion like below: #include <iostream> #include <type_traits> #define TRACE void operator()() const { std::cerr << "@" << __LINE__ << std::endl; } template <class T> struct check : std::true_type {}; template <class F, class T, class Check=void> struct convert { TRACE;// first case }; template <class F, class T> struct convert<F*, T, typename std::enable_if<(check<F>::value && check<T>::value), void>::type> { TRACE; // second case }; template <class T> struct convert<int*, T, typename std::enable_if<(check<T>::value), void>::type> { TRACE; // third case }; Then convert<int*, int> c; c(); will report ambiguous class template instantiation in g++-4.5, g++-4.6, g++-4.7 and clang++-3.1(all with option -std=c++0x) But if i replace the check in third case to typename std::enable_if<(check<int>::value && check<T>::value), void>:type Then clang++-3.1 works fine. Is it compilers bug or by standard?
c++
templates
null
null
null
null
open
ambiguous partial specializations with std::enable_if === I have a problem encountered at a condtion like below: #include <iostream> #include <type_traits> #define TRACE void operator()() const { std::cerr << "@" << __LINE__ << std::endl; } template <class T> struct check : std::true_type {}; template <class F, class T, class Check=void> struct convert { TRACE;// first case }; template <class F, class T> struct convert<F*, T, typename std::enable_if<(check<F>::value && check<T>::value), void>::type> { TRACE; // second case }; template <class T> struct convert<int*, T, typename std::enable_if<(check<T>::value), void>::type> { TRACE; // third case }; Then convert<int*, int> c; c(); will report ambiguous class template instantiation in g++-4.5, g++-4.6, g++-4.7 and clang++-3.1(all with option -std=c++0x) But if i replace the check in third case to typename std::enable_if<(check<int>::value && check<T>::value), void>:type Then clang++-3.1 works fine. Is it compilers bug or by standard?
0
11,650,595
07/25/2012 13:17:08
871,877
07/31/2011 20:01:40
27
2
C# while statement ignoring response value
I have a command line asking the user to say (Y/N) and this value is passed to the checkResponse method. For some reason the while loop ignores the value even though when I debug it's showing the value is "Y". It also continues to loop when the value is set to "N". If I move the if statements below the while statement, the program half way works. I can send up an initial value of "Y" and the while statement will ignore it and start running the code inside of it. Any idea what I'm missing or over-looking? Thanks in advance. public void checkResponse(string response, string confirmValue) { #region Make sure person has confirmed they want to make the change. Console.WriteLine(response); Console.WriteLine(response); if (response == "Y") { return; } else if (response == "N") { Environment.Exit(0); } else { while ((response != "Y") || (response != "N")) { Console.Clear(); Console.WriteLine("\"" + response + "\" is not a valid response."); Console.WriteLine(); Console.WriteLine("You entered:" + confirmValue); Console.WriteLine("Is this correct? (Y/N)"); response = Console.ReadLine().ToUpper(); } } #endregion }
c#
if-statement
command
while-loops
line
null
open
C# while statement ignoring response value === I have a command line asking the user to say (Y/N) and this value is passed to the checkResponse method. For some reason the while loop ignores the value even though when I debug it's showing the value is "Y". It also continues to loop when the value is set to "N". If I move the if statements below the while statement, the program half way works. I can send up an initial value of "Y" and the while statement will ignore it and start running the code inside of it. Any idea what I'm missing or over-looking? Thanks in advance. public void checkResponse(string response, string confirmValue) { #region Make sure person has confirmed they want to make the change. Console.WriteLine(response); Console.WriteLine(response); if (response == "Y") { return; } else if (response == "N") { Environment.Exit(0); } else { while ((response != "Y") || (response != "N")) { Console.Clear(); Console.WriteLine("\"" + response + "\" is not a valid response."); Console.WriteLine(); Console.WriteLine("You entered:" + confirmValue); Console.WriteLine("Is this correct? (Y/N)"); response = Console.ReadLine().ToUpper(); } } #endregion }
0
11,650,596
07/25/2012 13:17:10
325,442
04/25/2010 15:57:01
182
11
Application rebrands - when should a branching strategy be employed?
**Note:** *In case it matters, we are using **git**, (so branching and merging is a breeze), and this is an Android application (**Java** - so conditional compilation is not really applicable).* Similar to this question [here][1], but what if you have more than just UI differences between different rebrands of a single version of your software? For example, what if an entire feature or subsystem should not be compiled into one of the rebrands (e.g. it contains code that is intellectual property of one company and should not be available to others)? Should a separate branch be created for each rebrand in this case? If so, is there any use for a main/master branch, since it will just become code-storage and not compile into any useful application (weird)? But not having a main/master branch means having to cherry-pick (individually select) commits to merge across rebrands, which seems like a bad approach. Or is there another way to solve this that doesn't involve branches? [1]: http://stackoverflow.com/questions/4381523/branching-strategy-for-configurable-software
java
git
branch
branching-and-merging
branding
null
open
Application rebrands - when should a branching strategy be employed? === **Note:** *In case it matters, we are using **git**, (so branching and merging is a breeze), and this is an Android application (**Java** - so conditional compilation is not really applicable).* Similar to this question [here][1], but what if you have more than just UI differences between different rebrands of a single version of your software? For example, what if an entire feature or subsystem should not be compiled into one of the rebrands (e.g. it contains code that is intellectual property of one company and should not be available to others)? Should a separate branch be created for each rebrand in this case? If so, is there any use for a main/master branch, since it will just become code-storage and not compile into any useful application (weird)? But not having a main/master branch means having to cherry-pick (individually select) commits to merge across rebrands, which seems like a bad approach. Or is there another way to solve this that doesn't involve branches? [1]: http://stackoverflow.com/questions/4381523/branching-strategy-for-configurable-software
0
11,650,600
07/25/2012 13:17:33
1,034,957
11/08/2011 04:49:12
6
0
Can be record voice message in blackberry
Is there any way to record voice message and save in SDCard in blackberry application development. if it is possible than kindly guide me how to achieve this functionality. any help would be appreciated. Thanks, Manoj Gupta
message
voice
null
null
null
null
open
Can be record voice message in blackberry === Is there any way to record voice message and save in SDCard in blackberry application development. if it is possible than kindly guide me how to achieve this functionality. any help would be appreciated. Thanks, Manoj Gupta
0
11,650,602
07/25/2012 13:17:48
1,353,497
04/24/2012 11:01:46
48
9
Yii framework, bootstrap widget BootTabbable does not work with Chrome or Safari
I am using [bootstrap extention][1] with Yii framework to have tabs for the content. [Here is an example][2]. The tabs work fine in firefox, however in Google Chrome and Safari the tabs behave differently, they load with the page load but after clicking on the tabs they get selectet but the content does not show. Here is the code for these tabs: <?php $this->widget('bootstrap.widgets.BootTabbable', array( 'type'=>'tabs', // 'tabs' or 'pills' 'tabs'=>array( array('label'=>'Marionettisti', 'content'=>$this->renderPartial('staff/_view_staff_marionettisti', array('model'=>$model),$this),'active'=>true), array('label'=>'Voci e Musica', 'content'=>$this->renderPartial('staff/_view_staff_vociemusica', array('model'=>$model),$this)), array('label'=>'Laboratorio', 'content'=>$this->renderPartial('staff/_view_staff_laboratorio', array('model'=>$model),$this)), array('label'=>'Direttore Artistico', 'content'=>$this->renderPartial('staff/_view_staff_direttore_artistico', array('model'=>$model),$this)), ), )); ?> Any idea? [1]: http://www.yiiframework.com/extension/bootstrap/ [2]: http://marionette-cola.linkmesrl.com/compania/viewstoria
google-chrome
safari
yii
twitter-bootstrap
null
null
open
Yii framework, bootstrap widget BootTabbable does not work with Chrome or Safari === I am using [bootstrap extention][1] with Yii framework to have tabs for the content. [Here is an example][2]. The tabs work fine in firefox, however in Google Chrome and Safari the tabs behave differently, they load with the page load but after clicking on the tabs they get selectet but the content does not show. Here is the code for these tabs: <?php $this->widget('bootstrap.widgets.BootTabbable', array( 'type'=>'tabs', // 'tabs' or 'pills' 'tabs'=>array( array('label'=>'Marionettisti', 'content'=>$this->renderPartial('staff/_view_staff_marionettisti', array('model'=>$model),$this),'active'=>true), array('label'=>'Voci e Musica', 'content'=>$this->renderPartial('staff/_view_staff_vociemusica', array('model'=>$model),$this)), array('label'=>'Laboratorio', 'content'=>$this->renderPartial('staff/_view_staff_laboratorio', array('model'=>$model),$this)), array('label'=>'Direttore Artistico', 'content'=>$this->renderPartial('staff/_view_staff_direttore_artistico', array('model'=>$model),$this)), ), )); ?> Any idea? [1]: http://www.yiiframework.com/extension/bootstrap/ [2]: http://marionette-cola.linkmesrl.com/compania/viewstoria
0
11,650,612
07/25/2012 13:18:13
518,708
02/22/2010 10:18:21
140
0
product display as mind map
I have the following requirement in the project.I need to have a feature to show the related products for a product.The view of the related products should be like mind map view.When a user clicks on a product i need to show the other related products expanded like a mindmap view.enter image description here So the related products will expand or collapse when clicked on the parent product.Is it possible to accomplish this using javascript/jquery. I am using asp.net mvc 3 for development purpose. Also we should design this without a requirement for plugin like flash or Silverlight, if possible. Thanks.
testing
null
null
null
null
07/26/2012 04:17:56
not a real question
product display as mind map === I have the following requirement in the project.I need to have a feature to show the related products for a product.The view of the related products should be like mind map view.When a user clicks on a product i need to show the other related products expanded like a mindmap view.enter image description here So the related products will expand or collapse when clicked on the parent product.Is it possible to accomplish this using javascript/jquery. I am using asp.net mvc 3 for development purpose. Also we should design this without a requirement for plugin like flash or Silverlight, if possible. Thanks.
1
11,650,614
07/25/2012 13:18:15
1,271,612
03/15/2012 13:14:30
61
2
phpDoc - Documenting for private members holding class instances
I have a class to document. There is a variable holding class instance which will be initialized in the constructor. I want to know how I can document (or put the tags) so that variable type is reflected properly. I have done this so far: /** * Holds the instance of ParseMessage class * * @access private * @var ParseMessage */ private $_parse_message; The Doc generated for this member looks like this: Holds the instance of ParseMessage class $_parse_message : **\ParseMessage** I want to remove this '\' before the type of the variable.
php
phpdoc
null
null
null
null
open
phpDoc - Documenting for private members holding class instances === I have a class to document. There is a variable holding class instance which will be initialized in the constructor. I want to know how I can document (or put the tags) so that variable type is reflected properly. I have done this so far: /** * Holds the instance of ParseMessage class * * @access private * @var ParseMessage */ private $_parse_message; The Doc generated for this member looks like this: Holds the instance of ParseMessage class $_parse_message : **\ParseMessage** I want to remove this '\' before the type of the variable.
0
11,650,615
07/25/2012 13:18:19
1,551,713
07/25/2012 13:08:06
1
0
Using perlbrew is it possible to do multiple installs by architecture?
I would like to be able to install multiple versions of Perl but I need to have them by architecture as well. I know that I can use perlbrew to get installs by version: 5.10.1, 5.12.3, 5.16.0, etc. I couldn't find a way to also have installs by architecture, Solaris-sparc, Solaris-x86, Linux-i686, Linux-x86_64, etc. Do a [hand install][1] I can do this [1]: http://stackoverflow.com/questions/3486665/how-can-install-multiple-perl-versions-without-them-tripping-over-each-others-x It's no big deal doing hand installs but perlbrew makes some things easier regarding management and such.
perl
architecture
multiple-versions
perlbrew
null
null
open
Using perlbrew is it possible to do multiple installs by architecture? === I would like to be able to install multiple versions of Perl but I need to have them by architecture as well. I know that I can use perlbrew to get installs by version: 5.10.1, 5.12.3, 5.16.0, etc. I couldn't find a way to also have installs by architecture, Solaris-sparc, Solaris-x86, Linux-i686, Linux-x86_64, etc. Do a [hand install][1] I can do this [1]: http://stackoverflow.com/questions/3486665/how-can-install-multiple-perl-versions-without-them-tripping-over-each-others-x It's no big deal doing hand installs but perlbrew makes some things easier regarding management and such.
0
11,387,333
07/08/2012 22:46:50
1,138,694
01/09/2012 12:53:53
10
0
PHP different servers and security
I currently have several servers, the main ones a web server and an internal storage server. Data is stored in a SQL server database. Without giving too much access to the user, how would I pull a specific document from the storage server for display to the user from the web server? For example, I have document c:/memberID/info.pdf on the storage server and I want to display it to the client via PHP without giving them access to the internal storage server. I hope this makes sense!
php
mysql
multiple
internal
server
null
open
PHP different servers and security === I currently have several servers, the main ones a web server and an internal storage server. Data is stored in a SQL server database. Without giving too much access to the user, how would I pull a specific document from the storage server for display to the user from the web server? For example, I have document c:/memberID/info.pdf on the storage server and I want to display it to the client via PHP without giving them access to the internal storage server. I hope this makes sense!
0
11,387,261
07/08/2012 22:33:33
1,510,646
07/08/2012 22:30:04
1
0
Set up PHP server for public access
I'm new to PHP but I can't find good examples - mostly they are for local setups or advanced stuff. I created a PHP page on an EC2 server. It works fine when accessing it locally, however, what do I need to do to make it publically accessible from a different network? Can this work from both Apache and IIS?
php
client-server
null
null
null
null
open
Set up PHP server for public access === I'm new to PHP but I can't find good examples - mostly they are for local setups or advanced stuff. I created a PHP page on an EC2 server. It works fine when accessing it locally, however, what do I need to do to make it publically accessible from a different network? Can this work from both Apache and IIS?
0
11,387,339
07/08/2012 22:48:09
1,474,410
06/22/2012 09:31:52
6
0
How to search for all points inside all polygons in Postgres
I want to search for all points of a specific user inside all polygons and display the polygons these are my tables users id points 1 1 1 2 1 3 1 4 2 3 3 1 poly polygon-points poly-name (1,2,4,5) store (1,3) shoop I wrote this code BEGIN FOR poly-name IN SELECT poly-name FROM poly LOOP FOR points IN SELECT * FROM users LOOP points@poly-name END LOOP; END LOOP; RETURN; END
postgresql
null
null
null
null
null
open
How to search for all points inside all polygons in Postgres === I want to search for all points of a specific user inside all polygons and display the polygons these are my tables users id points 1 1 1 2 1 3 1 4 2 3 3 1 poly polygon-points poly-name (1,2,4,5) store (1,3) shoop I wrote this code BEGIN FOR poly-name IN SELECT poly-name FROM poly LOOP FOR points IN SELECT * FROM users LOOP points@poly-name END LOOP; END LOOP; RETURN; END
0
11,387,340
07/08/2012 22:48:27
330,396
05/01/2010 14:26:00
93
1
CSS List Style has random space
I am trying to code a page, and for some reason i have a random css spacing issue for my list that i created. On the bottom right i have a random space between the list and its div. ![][1] I am styling it fine i think but my code is here at [jsFiddle][2] and it works fine there for some reason. Any ideas? If needed i can supply the entire page link. I want that whole entire css list to span accross the entire div but it has a huge gap between the left wall of the div and its list. [1]: http://i.stack.imgur.com/s2nFD.png [2]: http://jsfiddle.net/myjDs/8/
html
css
null
null
null
null
open
CSS List Style has random space === I am trying to code a page, and for some reason i have a random css spacing issue for my list that i created. On the bottom right i have a random space between the list and its div. ![][1] I am styling it fine i think but my code is here at [jsFiddle][2] and it works fine there for some reason. Any ideas? If needed i can supply the entire page link. I want that whole entire css list to span accross the entire div but it has a huge gap between the left wall of the div and its list. [1]: http://i.stack.imgur.com/s2nFD.png [2]: http://jsfiddle.net/myjDs/8/
0
11,387,341
07/08/2012 22:48:28
795,319
06/13/2011 02:49:32
2,251
78
Why doesn't my java compiler level match my installed project facet?
I made a simple Java Google AppEngine application called Guestbook in Eclipse and am trying to run it. However, I am encountering an error that lacks a quick fix: Description Resource Path Location Type Java compiler level does not match the version of the installed Java project facet. Guestbook Unknown Faceted Project Problem (Java Version Mismatch) I tried navigating to <i>Project | Properties</i> to change my project facet. However, I could not find a setting that dealt with "facet." ![enter image description here][1] What does "installed Java project facet" mean, and how do I fix this? [1]: http://i.stack.imgur.com/2N4Mp.png
eclipse
google-app-engine
null
null
null
null
open
Why doesn't my java compiler level match my installed project facet? === I made a simple Java Google AppEngine application called Guestbook in Eclipse and am trying to run it. However, I am encountering an error that lacks a quick fix: Description Resource Path Location Type Java compiler level does not match the version of the installed Java project facet. Guestbook Unknown Faceted Project Problem (Java Version Mismatch) I tried navigating to <i>Project | Properties</i> to change my project facet. However, I could not find a setting that dealt with "facet." ![enter image description here][1] What does "installed Java project facet" mean, and how do I fix this? [1]: http://i.stack.imgur.com/2N4Mp.png
0
11,387,342
07/08/2012 22:48:32
416,631
04/21/2010 23:52:31
3,329
117
FileConveyor - cumulus - Files not showing up on CloudFiles
I've installed FileConveyor and django cumulus (which is the replacement for mosso). I created a test directory at `/home/drupal/conveyortest` which I use as the scanPath. When I start the FileConveyor daemon, I'm told that the js and css files are being sync'd (and deleted). When I look on my CloudFiles container, I see the `static/views_slideshow_galleria` folder has been created, but there are no files inside it. There should be one css file and one js file, but there are none. What am I doing wrong? - WARNING - Created 'cumulus' transporter for the 'cloudfiles' server. - WARNING - Deleted '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.css' as per the 'CSS, JS, images and Flash' rule. - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.css' (CREATED). - WARNING - Deleted '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.js' as per the 'CSS, JS, images and Flash' rule. - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.js' (CREATED). - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.css' (DELETED). - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.js' (DELETED). Here is my config.xml: <?xml version="1.0" encoding="UTF-8"?> <config> <!-- Sources --> <sources ignoredDirs="CVS:.svn"> <source name="drupal" scanPath="/home/drupal/conveyortest" documentRoot="/home/drupal/conveyortest" basePath="/" /> </sources> <!-- Servers --> <servers> <server name="cloudfiles" transporter="cumulus"> <username>myusername</username> <api_key>myapikey</api_key> <container>FileConveyorTest</container> </server> </servers> <!-- Rules --> <rules> <rule for="drupal" label="CSS, JS, images and Flash"> <filter> <extensions>ico:js:css:gif:png:jpg:jpeg:svg:swf</extensions> </filter> <processorChain> <processor name="filename.SpacesToDashes" /> </processorChain> <destinations> <destination server="cloudfiles" path="static" /> </destinations> </rule> </rules> </config>
cloudfiles
django-storage
null
null
null
null
open
FileConveyor - cumulus - Files not showing up on CloudFiles === I've installed FileConveyor and django cumulus (which is the replacement for mosso). I created a test directory at `/home/drupal/conveyortest` which I use as the scanPath. When I start the FileConveyor daemon, I'm told that the js and css files are being sync'd (and deleted). When I look on my CloudFiles container, I see the `static/views_slideshow_galleria` folder has been created, but there are no files inside it. There should be one css file and one js file, but there are none. What am I doing wrong? - WARNING - Created 'cumulus' transporter for the 'cloudfiles' server. - WARNING - Deleted '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.css' as per the 'CSS, JS, images and Flash' rule. - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.css' (CREATED). - WARNING - Deleted '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.js' as per the 'CSS, JS, images and Flash' rule. - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.js' (CREATED). - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.css' (DELETED). - WARNING - Synced: '/home/drupal/conveyortest/views_slideshow_galleria/views_slideshow_galleria.js' (DELETED). Here is my config.xml: <?xml version="1.0" encoding="UTF-8"?> <config> <!-- Sources --> <sources ignoredDirs="CVS:.svn"> <source name="drupal" scanPath="/home/drupal/conveyortest" documentRoot="/home/drupal/conveyortest" basePath="/" /> </sources> <!-- Servers --> <servers> <server name="cloudfiles" transporter="cumulus"> <username>myusername</username> <api_key>myapikey</api_key> <container>FileConveyorTest</container> </server> </servers> <!-- Rules --> <rules> <rule for="drupal" label="CSS, JS, images and Flash"> <filter> <extensions>ico:js:css:gif:png:jpg:jpeg:svg:swf</extensions> </filter> <processorChain> <processor name="filename.SpacesToDashes" /> </processorChain> <destinations> <destination server="cloudfiles" path="static" /> </destinations> </rule> </rules> </config>
0
11,387,345
07/08/2012 22:49:19
848,814
07/17/2011 15:55:09
31
2
How to refresh the weather layer?
Does anyone know if there is a way to refresh the Weather Layer in Google Maps javascript API? To give a little background, we have an application which stays open in the browser and updates some information on the map every few minutes. We let the users open the weather layer on the map, but the weather only loads once, when the layer is created. After a while, it gets outdated and we'd like it to stay current. I've tried everything from recreating the layer and setting the map to null, then back to the current map, but temperatures never reload. Any suggestions would really help. Thanks!
javascript
google-maps-api-3
null
null
null
null
open
How to refresh the weather layer? === Does anyone know if there is a way to refresh the Weather Layer in Google Maps javascript API? To give a little background, we have an application which stays open in the browser and updates some information on the map every few minutes. We let the users open the weather layer on the map, but the weather only loads once, when the layer is created. After a while, it gets outdated and we'd like it to stay current. I've tried everything from recreating the layer and setting the map to null, then back to the current map, but temperatures never reload. Any suggestions would really help. Thanks!
0
11,387,144
07/08/2012 22:10:24
1,188,600
02/03/2012 22:57:16
59
0
Alert Dialog doesnt come up
**Confusion** On my emulator everything works correctly, the dialog comes up and works perfectly. However on my galxy tab running 3.0 android when I open the same app as I did on the emulator on this tablet nothing happens... What is up with that? **Code** public void disconnectOtherUser() { AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.titleTextStyle)); builder.setMessage("Do you want to disconnect the other user?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Talk1028("X"); ConnectionTV.setText("Other user disconnected"); dialog.cancel(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } I call this method in a different spot in my code in order to make the dialog come up.
android
dialog
alert
android-alertdialog
null
null
open
Alert Dialog doesnt come up === **Confusion** On my emulator everything works correctly, the dialog comes up and works perfectly. However on my galxy tab running 3.0 android when I open the same app as I did on the emulator on this tablet nothing happens... What is up with that? **Code** public void disconnectOtherUser() { AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.titleTextStyle)); builder.setMessage("Do you want to disconnect the other user?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Talk1028("X"); ConnectionTV.setText("Other user disconnected"); dialog.cancel(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } I call this method in a different spot in my code in order to make the dialog come up.
0
11,387,348
07/08/2012 22:49:42
796,231
06/13/2011 15:53:50
428
12
Eclipse won't start after crash
I received an error about how Eclipse was caught in a loop and something about garbage collecting...after I finally got it closed, I tried reopening and it won't work. I tried the following from the command line: eclipse -clean and it still doesn't work. I posted the error log at https://docs.google.com/document/d/1EPwYgHujbD8fX-W-b1DatJutgNv-ZnIkm8SP180R4XQ/edit This is a fresh error log (single attempt to open eclipse) Anyone know about eclipse errors that can help me out?
eclipse
startup
start
null
null
null
open
Eclipse won't start after crash === I received an error about how Eclipse was caught in a loop and something about garbage collecting...after I finally got it closed, I tried reopening and it won't work. I tried the following from the command line: eclipse -clean and it still doesn't work. I posted the error log at https://docs.google.com/document/d/1EPwYgHujbD8fX-W-b1DatJutgNv-ZnIkm8SP180R4XQ/edit This is a fresh error log (single attempt to open eclipse) Anyone know about eclipse errors that can help me out?
0
11,401,411
07/09/2012 19:04:24
1,489,001
06/28/2012 15:16:42
1
0
Android NDK Video Capturing
I currently have an algorithm which basically processes every preview frames. I have tried to capture the video using MediaRecorder of SDK, however, apparently I can't access the preview frames while MediaRecorder is capturing the video. First question is; is it possible to do this using NDK? I mean capturing the video and processing the frames in the mean time. Second question is; if it is possible, I have failed to find any good source to start this part of the project. Can anyone give any directions for the most feasible manner to achieve this goal? Thanks a lot.
android
video
android-ndk
processing
null
null
open
Android NDK Video Capturing === I currently have an algorithm which basically processes every preview frames. I have tried to capture the video using MediaRecorder of SDK, however, apparently I can't access the preview frames while MediaRecorder is capturing the video. First question is; is it possible to do this using NDK? I mean capturing the video and processing the frames in the mean time. Second question is; if it is possible, I have failed to find any good source to start this part of the project. Can anyone give any directions for the most feasible manner to achieve this goal? Thanks a lot.
0
11,401,413
07/09/2012 19:04:52
410,899
08/04/2010 14:31:40
133
0
Regexp matches and captures in pry, rubular, but not from script
So, I have a regexp that I have tested on Rubular and from the CLI (using the `pry` gem). This parses a custom Apache log format. When I feed input to it in pry, it works as expected (e.g. `$~` is populated.) Rubular also reports correct matching and grouping for various lines of input. When run from the code below, no matches. I have also tried messing with `String.chomp!` and the `\n` character, in case that was throwing off the match, but various permutations have no effect. I'm sure it's something a more experienced Rubyist could shed some light on. Rubular link: http://www.rubular.com/r/fycHVYZdZz Here is the relevant code, regex, and input -- and thanks in advance: log_regex = %r{ (?<ip>(([0-9]{1,3}\.){3}[0-9]{1,3})) \s-\s (?<src_ip>.*) -\s (?<date>\[.*\]) \s (?<url>".+") \s (?<response>\d{3}) \s (?<length>\d+) \s (?<referer>".+") \s (?<useragent>".*") \s(?<host>.*)? /ix } logfile = ARGV[0] def process_log(log_regex,logfile) IO.foreach(logfile, 'r') do |line| line.chomp! log_regex.match(line) do |m| puts m['ip'] end end end process_log(log_regex,logfile) Sample input: 209.123.123.123 - - [05/Jul/2012:11:02:01 -0700] "GET /url/mma/rss2.0.xml HTTP/1.1" 301 0 "-" "FeedBurner/1.0 (http://www.FeedBurner.com)" xml.somewhere.com
ruby
regex
null
null
null
null
open
Regexp matches and captures in pry, rubular, but not from script === So, I have a regexp that I have tested on Rubular and from the CLI (using the `pry` gem). This parses a custom Apache log format. When I feed input to it in pry, it works as expected (e.g. `$~` is populated.) Rubular also reports correct matching and grouping for various lines of input. When run from the code below, no matches. I have also tried messing with `String.chomp!` and the `\n` character, in case that was throwing off the match, but various permutations have no effect. I'm sure it's something a more experienced Rubyist could shed some light on. Rubular link: http://www.rubular.com/r/fycHVYZdZz Here is the relevant code, regex, and input -- and thanks in advance: log_regex = %r{ (?<ip>(([0-9]{1,3}\.){3}[0-9]{1,3})) \s-\s (?<src_ip>.*) -\s (?<date>\[.*\]) \s (?<url>".+") \s (?<response>\d{3}) \s (?<length>\d+) \s (?<referer>".+") \s (?<useragent>".*") \s(?<host>.*)? /ix } logfile = ARGV[0] def process_log(log_regex,logfile) IO.foreach(logfile, 'r') do |line| line.chomp! log_regex.match(line) do |m| puts m['ip'] end end end process_log(log_regex,logfile) Sample input: 209.123.123.123 - - [05/Jul/2012:11:02:01 -0700] "GET /url/mma/rss2.0.xml HTTP/1.1" 301 0 "-" "FeedBurner/1.0 (http://www.FeedBurner.com)" xml.somewhere.com
0
11,401,351
07/09/2012 18:59:07
819,813
06/28/2011 19:07:39
16
1
screen capture to video: glReadPixels from a frame buffer object flipped
I am trying to capture the current ongoing (ios) app screens onto an array of textures, use glReadPixels to get them into a pixel buffer and then pass them onto AVAssetWriter to encode them as quicktime video. There is the flip problem due to the co-ordinate mismatch between pixelbuffer co-ordinate system and opengl. I was wondering what would be the fastest way to either capture straight onto a cvpixelbuffer or capture onto a (GLuint) buffer, flip and then assign onto a pixelbuffer. Please find the code attached. Any help is appreciated. add_image(float t, framebuffer* fb) { // Wait till video writer is ready while (!m_impl->video_input.readyForMoreMediaData); // Create a pixel buffer CVPixelBufferRef pixel_buffer = 0; GLuint* buffer = (GLuint*) malloc(data_length); if (!buffer) log_debug("Error initializing buffer"); int height = 768; int width = 1024; const NSInteger data_length = height * width * 4; // Copy data from framebuffer to pixel buffer fb->bind(); glReadPixels(0, 0, 1024, 768, GL_RGBA, GL_UNSIGNED_BYTE, buffer); //***THIS PART*** // gl renders "upside down" so swap top to bottom (flip). CVReturn status = CVPixelBufferCreateWithBytes(NULL, width, height, kCVPixelFormatType_32BGRA, buffer, 4 * width, NULL, NULL, NULL, &pixel_buffer); if (status != kCVReturnSuccess) log_debug("Error creating pixel buffer"); // Add pixel buffer to video writer if (![m_impl->video_input_frame_adaptor appendPixelBuffer: pixel_buffer withPresentationTime: CMTimeMakeWithSeconds(t, 60)]) log_debug("Could not append pixel buffer to video writer"); // Release pixel buffer CVPixelBufferRelease(pixel_buffer); }
flip
avassetwriter
glreadpixels
null
null
null
open
screen capture to video: glReadPixels from a frame buffer object flipped === I am trying to capture the current ongoing (ios) app screens onto an array of textures, use glReadPixels to get them into a pixel buffer and then pass them onto AVAssetWriter to encode them as quicktime video. There is the flip problem due to the co-ordinate mismatch between pixelbuffer co-ordinate system and opengl. I was wondering what would be the fastest way to either capture straight onto a cvpixelbuffer or capture onto a (GLuint) buffer, flip and then assign onto a pixelbuffer. Please find the code attached. Any help is appreciated. add_image(float t, framebuffer* fb) { // Wait till video writer is ready while (!m_impl->video_input.readyForMoreMediaData); // Create a pixel buffer CVPixelBufferRef pixel_buffer = 0; GLuint* buffer = (GLuint*) malloc(data_length); if (!buffer) log_debug("Error initializing buffer"); int height = 768; int width = 1024; const NSInteger data_length = height * width * 4; // Copy data from framebuffer to pixel buffer fb->bind(); glReadPixels(0, 0, 1024, 768, GL_RGBA, GL_UNSIGNED_BYTE, buffer); //***THIS PART*** // gl renders "upside down" so swap top to bottom (flip). CVReturn status = CVPixelBufferCreateWithBytes(NULL, width, height, kCVPixelFormatType_32BGRA, buffer, 4 * width, NULL, NULL, NULL, &pixel_buffer); if (status != kCVReturnSuccess) log_debug("Error creating pixel buffer"); // Add pixel buffer to video writer if (![m_impl->video_input_frame_adaptor appendPixelBuffer: pixel_buffer withPresentationTime: CMTimeMakeWithSeconds(t, 60)]) log_debug("Could not append pixel buffer to video writer"); // Release pixel buffer CVPixelBufferRelease(pixel_buffer); }
0
11,401,352
07/09/2012 18:59:09
690,045
04/03/2011 17:16:38
11
0
Eclipse plug-in development, expose plug-in's classes in java project
I'm trying to build an annotation processor as eclipse plug-in. This is the first time I'm writing a plug-in for eclipse so I'm not sure I'm using the correct terminology and I'm sorry if I'm not perfectly clear. My goal is to have a plug-in that generate code from annotated Java classes, I would like the plug-in to contains all the annotations, so beside installing the plug-in the user's project doesn't need to have additional dependencies, i.e. the user install the plug-in write some classes, annotate them with some annotations (packed inside the plug-in) and gets the generated code. Is it possible to do what I'm trying to do ? I've seen some other plug-ins (Xtent for example) that add their own libraries. 10x
eclipse
eclipse-plugin
annotations
apt
annotation-processing
null
open
Eclipse plug-in development, expose plug-in's classes in java project === I'm trying to build an annotation processor as eclipse plug-in. This is the first time I'm writing a plug-in for eclipse so I'm not sure I'm using the correct terminology and I'm sorry if I'm not perfectly clear. My goal is to have a plug-in that generate code from annotated Java classes, I would like the plug-in to contains all the annotations, so beside installing the plug-in the user's project doesn't need to have additional dependencies, i.e. the user install the plug-in write some classes, annotate them with some annotations (packed inside the plug-in) and gets the generated code. Is it possible to do what I'm trying to do ? I've seen some other plug-ins (Xtent for example) that add their own libraries. 10x
0
11,401,420
07/09/2012 19:05:35
925,927
09/02/2011 19:55:15
142
3
Avoiding Anemic Domain
I have a column in a database that looks like "Country/Province/City", e.g. "Canada/Ontario/Toronto". I need to split those and map them into 3 separate Java Bean properties. I am wondering where best to do this? (1) DAO as the rows are retrieved (2) Domain (Bean) as the setters are getters are called (3) A SQL function to parse the rows in the query I am leaning towards #2 since the "Anemic Domain" anti-pattern seems to indicate that the Bean is an appropriate place for this.
java
design-patterns
null
null
null
null
open
Avoiding Anemic Domain === I have a column in a database that looks like "Country/Province/City", e.g. "Canada/Ontario/Toronto". I need to split those and map them into 3 separate Java Bean properties. I am wondering where best to do this? (1) DAO as the rows are retrieved (2) Domain (Bean) as the setters are getters are called (3) A SQL function to parse the rows in the query I am leaning towards #2 since the "Anemic Domain" anti-pattern seems to indicate that the Bean is an appropriate place for this.
0
11,410,572
07/10/2012 09:42:22
643,626
03/03/2011 20:07:11
1
0
jQuery Instances Overwriting Eachother
I have the above code which runs and changes icons to loading icons and then to other icons if its successful. Anyway, it works absolutely fine on a single instance; however, the moment I click two (or more) for example, it will leave the first instance with the loading icon and then the last instance will get its icon changed twice. I think I understand whats happening and that is that my variables are getting over-written with new values. How do I fix this? Shouldnt each instance of the function have its own set of variables? Right now it seems to me that the variables (init_elem,closest_td,closest_tr) are global and hence being overwritten? "$(this)" loses its context and hence the reason why I am assigning it to variables. I am using this on jqGrid and hence the need for .on() because having it 'normally' doesnt work. I have tried to use $.proxy; but I have never used it before and I cant seem to get it work properly since console.log'ing $(this).html() is showing the dialog html instead of the anchor html. $(document).ready(function() { $("#acquire-dialog").dialog({ autoOpen: false, modal: true }); }); $(document).on('click','.acquire-confirmation', function(event) { event.preventDefault(); init_elem = $(this); closest_td = $(init_elem).closest("td"); closest_tr = $(init_elem).closest("tr"); process_id = $(this).attr("rel"); $("#acquire-dialog").dialog('option', 'buttons', { "Confirm" : function() { restore_html = $(init_elem).closest("td").html(); $(closest_td).html('<img class="qmark" title="Loading..." src="images/loading.gif">'); $.post( 'includes/_add_ajax.php', {section: 'acquire_document', process_id: process_id}, function(data){ $("#ajax_notifications").freeow(data.subject,data.message,{classes: [data.type] }); if (data.type == 'success') { $(closest_tr).find("div:first") .removeClass('icon_status_0') .addClass('icon_status_2') .attr('title','You have acquired access to this document.'); if (typeof data.status !== "undefined") { var document_status = ['A','B','C']; $(closest_td).prev().html(document_status[data.status]); if (data.status == 1) $(closest_td).html('<a class="qmark" target="_blank" title="Generate a return for this document." href="includes/generate_return.php?id='+ process_id +'"><img src="images/icon_pdf.png" border="0" /></a>'); else $(closest_td).html('<img class="qmark" title="You can only generate a return for a document once its been served or a return of non-service has been issued." src="images/icon_question.png">'); } } else $(init_elem).closest("td").html(restore_html); }, 'json' ); $(this).dialog("close"); }, "Cancel" : function() { $(this).dialog("close"); } }); $("#acquire-dialog").dialog("open"); }); This is what Ive tried in regards to $.proxy(): $.proxy($("#acquire-dialog").dialog("open"),this); and $.proxy($("#acquire-dialog").dialog("open"),$(this)); and lastly on the event bind as well, though I dont think this is right: $(document).on('click','.acquire-confirmation', $.proxy(function(event) { ... },this)); // and $(this)
jquery
jqgrid
instances
null
null
null
open
jQuery Instances Overwriting Eachother === I have the above code which runs and changes icons to loading icons and then to other icons if its successful. Anyway, it works absolutely fine on a single instance; however, the moment I click two (or more) for example, it will leave the first instance with the loading icon and then the last instance will get its icon changed twice. I think I understand whats happening and that is that my variables are getting over-written with new values. How do I fix this? Shouldnt each instance of the function have its own set of variables? Right now it seems to me that the variables (init_elem,closest_td,closest_tr) are global and hence being overwritten? "$(this)" loses its context and hence the reason why I am assigning it to variables. I am using this on jqGrid and hence the need for .on() because having it 'normally' doesnt work. I have tried to use $.proxy; but I have never used it before and I cant seem to get it work properly since console.log'ing $(this).html() is showing the dialog html instead of the anchor html. $(document).ready(function() { $("#acquire-dialog").dialog({ autoOpen: false, modal: true }); }); $(document).on('click','.acquire-confirmation', function(event) { event.preventDefault(); init_elem = $(this); closest_td = $(init_elem).closest("td"); closest_tr = $(init_elem).closest("tr"); process_id = $(this).attr("rel"); $("#acquire-dialog").dialog('option', 'buttons', { "Confirm" : function() { restore_html = $(init_elem).closest("td").html(); $(closest_td).html('<img class="qmark" title="Loading..." src="images/loading.gif">'); $.post( 'includes/_add_ajax.php', {section: 'acquire_document', process_id: process_id}, function(data){ $("#ajax_notifications").freeow(data.subject,data.message,{classes: [data.type] }); if (data.type == 'success') { $(closest_tr).find("div:first") .removeClass('icon_status_0') .addClass('icon_status_2') .attr('title','You have acquired access to this document.'); if (typeof data.status !== "undefined") { var document_status = ['A','B','C']; $(closest_td).prev().html(document_status[data.status]); if (data.status == 1) $(closest_td).html('<a class="qmark" target="_blank" title="Generate a return for this document." href="includes/generate_return.php?id='+ process_id +'"><img src="images/icon_pdf.png" border="0" /></a>'); else $(closest_td).html('<img class="qmark" title="You can only generate a return for a document once its been served or a return of non-service has been issued." src="images/icon_question.png">'); } } else $(init_elem).closest("td").html(restore_html); }, 'json' ); $(this).dialog("close"); }, "Cancel" : function() { $(this).dialog("close"); } }); $("#acquire-dialog").dialog("open"); }); This is what Ive tried in regards to $.proxy(): $.proxy($("#acquire-dialog").dialog("open"),this); and $.proxy($("#acquire-dialog").dialog("open"),$(this)); and lastly on the event bind as well, though I dont think this is right: $(document).on('click','.acquire-confirmation', $.proxy(function(event) { ... },this)); // and $(this)
0
11,398,458
07/09/2012 15:39:58
1,512,324
07/09/2012 14:54:23
1
0
Tracking Leaky Memory from a Windows WCF Service using MEF & 3rd party components
I have the following Scenario: **WCF Windows Service 1** - Calls WCF Service 2 when there is work to complete - Updates Database with result **WCF Windows Service 2** - Uses Managed Extensibility Framework (MEF) to compose a part (Plugin) dynamically in a new App domain. - The Plugin then creates an instance of Watin (open source .net testing framework) which in turn creates a new IE process, does some WWW navigation does some screen scraping, takes a screen shot - Everything is returned to the caller. I am seeing a gradual memory leak in the WCF Windows Service 2 and have to restart it every few days. Having profiled the service in my development environment (in isolation) using perfmon I don't seem to be able to see the memory leak. I have tried to use .Net Memory Profiler but also don't seem to be getting anything conclusive. IDispose is implemented and being called. I'm starting to think that it is the interaction between the two WCF Windows Services that maybe holding onto object references and preventing IDispose from being called. Has anyone else seen this behaviour? or am I barking up the wrong tree? and before anyone mentions... I understand what is being done is mad...
.net
wcf
memory-leaks
mef
null
null
open
Tracking Leaky Memory from a Windows WCF Service using MEF & 3rd party components === I have the following Scenario: **WCF Windows Service 1** - Calls WCF Service 2 when there is work to complete - Updates Database with result **WCF Windows Service 2** - Uses Managed Extensibility Framework (MEF) to compose a part (Plugin) dynamically in a new App domain. - The Plugin then creates an instance of Watin (open source .net testing framework) which in turn creates a new IE process, does some WWW navigation does some screen scraping, takes a screen shot - Everything is returned to the caller. I am seeing a gradual memory leak in the WCF Windows Service 2 and have to restart it every few days. Having profiled the service in my development environment (in isolation) using perfmon I don't seem to be able to see the memory leak. I have tried to use .Net Memory Profiler but also don't seem to be getting anything conclusive. IDispose is implemented and being called. I'm starting to think that it is the interaction between the two WCF Windows Services that maybe holding onto object references and preventing IDispose from being called. Has anyone else seen this behaviour? or am I barking up the wrong tree? and before anyone mentions... I understand what is being done is mad...
0
11,410,554
07/10/2012 09:41:22
755,319
05/16/2011 08:05:52
38
11
How to perform MySQL spatial buffer function successfully?
Does anyone ever use MySQL spatial buffer function successfully? I've read the documentation here: http://dev.mysql.com/doc/refman/5.0/en/functions-that-create-new-geometries-from-existing-ones.html#function_buffer As stated in the documentation, buffer function has 2 parameters. The first one is geometry typed, the second one is distance. I've try to make a geometry variable mysql> set @g1 = geomfromtext('POINT(1 1)'); Query OK, 0 rows affected (0.00 sec) Then, to ensure that my variable is correctly set, I perform a query. If the variable not correctly set, such a query will return NULL. In this case, it is confirmed that my variable is correctly set mysql> select astext(@g1); +-------------+ | astext(@g1) | +-------------+ | POINT(1 1) | +-------------+ 1 row in set (0.00 sec) I run a query to select a buffer as stated in documentation mysql> select astext(buffer(@g1, 5)); ERROR 1305 (42000): FUNCTION module_devel.buffer does not exist Do I miss something here?
mysql
spatial-query
null
null
null
null
open
How to perform MySQL spatial buffer function successfully? === Does anyone ever use MySQL spatial buffer function successfully? I've read the documentation here: http://dev.mysql.com/doc/refman/5.0/en/functions-that-create-new-geometries-from-existing-ones.html#function_buffer As stated in the documentation, buffer function has 2 parameters. The first one is geometry typed, the second one is distance. I've try to make a geometry variable mysql> set @g1 = geomfromtext('POINT(1 1)'); Query OK, 0 rows affected (0.00 sec) Then, to ensure that my variable is correctly set, I perform a query. If the variable not correctly set, such a query will return NULL. In this case, it is confirmed that my variable is correctly set mysql> select astext(@g1); +-------------+ | astext(@g1) | +-------------+ | POINT(1 1) | +-------------+ 1 row in set (0.00 sec) I run a query to select a buffer as stated in documentation mysql> select astext(buffer(@g1, 5)); ERROR 1305 (42000): FUNCTION module_devel.buffer does not exist Do I miss something here?
0
11,410,556
07/10/2012 09:41:38
1,376,569
05/05/2012 09:45:29
13
0
how to apply different format or style to popup window
I display a popup window in a simple format. I want to apply different format of opening popup a window. How can I apply format or style so that it looks very good when pop window opens? The following is my source code: `<div onMouseOver="show('healing')" onMouseOut="hide('healing')"> ` `<div id="healing" class="bgdiv" >` `<div id ="title" class="Title"> Healing</div>` `<img class="img" src="images/healing.bmp">` `<div class="description" >Welcome Sir.</div>` `</div> </div>` css `<style type="text/css"> ` `#showhealing, #innovations, #div3 ` { visibility: hidden; } `</style>` javascript `<script language="JavaScript">` `function show(id)` { document.getElementById(id).style.visibility = "visible"; } `</script> `
javascript
html
javascript-events
null
null
null
open
how to apply different format or style to popup window === I display a popup window in a simple format. I want to apply different format of opening popup a window. How can I apply format or style so that it looks very good when pop window opens? The following is my source code: `<div onMouseOver="show('healing')" onMouseOut="hide('healing')"> ` `<div id="healing" class="bgdiv" >` `<div id ="title" class="Title"> Healing</div>` `<img class="img" src="images/healing.bmp">` `<div class="description" >Welcome Sir.</div>` `</div> </div>` css `<style type="text/css"> ` `#showhealing, #innovations, #div3 ` { visibility: hidden; } `</style>` javascript `<script language="JavaScript">` `function show(id)` { document.getElementById(id).style.visibility = "visible"; } `</script> `
0
11,410,500
07/10/2012 09:38:03
1,199,940
02/09/2012 15:02:55
24
1
Wicket - AjaxFormComponentUpdatingBehavior and backspace
I have a TextField where I have added an AjaxFormComponentUpdatingBehavior to get the current value when user write some string. filterByObject = new TextField<String>("filterByObject", true, new PropertyModel<String>(searchParams, "objectFilter")); AjaxFormComponentUpdatingBehavior changeFilterBinded = new AjaxFormComponentUpdatingBehavior ("onkeyup") { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(componentToUpdate); } }; filterByObject.add(changeFilterBinded); When I put some chars inside textfield, onUpdate method is correctly call and my component, based on the current state of searchParams, change correctly. Unfortunally when I use backspace to cancel what I have inserted, the onUpdate is not called. I tried changing event (onkeypress, onkeydown, onchange etc...) but it doesent work. Only onChange works but I have to change focus to another component. How can I save the day?
wicket
backspace
null
null
null
null
open
Wicket - AjaxFormComponentUpdatingBehavior and backspace === I have a TextField where I have added an AjaxFormComponentUpdatingBehavior to get the current value when user write some string. filterByObject = new TextField<String>("filterByObject", true, new PropertyModel<String>(searchParams, "objectFilter")); AjaxFormComponentUpdatingBehavior changeFilterBinded = new AjaxFormComponentUpdatingBehavior ("onkeyup") { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(componentToUpdate); } }; filterByObject.add(changeFilterBinded); When I put some chars inside textfield, onUpdate method is correctly call and my component, based on the current state of searchParams, change correctly. Unfortunally when I use backspace to cancel what I have inserted, the onUpdate is not called. I tried changing event (onkeypress, onkeydown, onchange etc...) but it doesent work. Only onChange works but I have to change focus to another component. How can I save the day?
0
11,410,502
07/10/2012 09:38:05
1,514,331
07/10/2012 09:30:57
1
0
jcarousel auto make other embed flash blink
help me when I turn on auto option in jcarousel it make every embed flash below that carousel blink each time it "auto".
flash
jcarousel
null
null
null
null
open
jcarousel auto make other embed flash blink === help me when I turn on auto option in jcarousel it make every embed flash below that carousel blink each time it "auto".
0
11,410,577
07/10/2012 09:42:48
961,434
09/23/2011 15:00:06
19
0
Form Scaled property set to False, but controls still scaling
I am trying to stop a Delphi 7 application from scaling when the computer has its fonts set to 125% on Windows 7. I have gone through all the forms and set the scaled property to False on them all, which solves the problem on most of the forms, but there are a few that have dynamically created controls on them, where the control is still being scaled, so I have a mix of some scaled and some not scaled controls on the same form. Any suggestions why these controls are still being scaled? As an example, we have a groupbox control on the form. During the form create, another control is dynamically created with the groupbox as its parent. It is this control which is still being scaled. The groupbox appears as it should (ie not scaled).
delphi-7
null
null
null
null
null
open
Form Scaled property set to False, but controls still scaling === I am trying to stop a Delphi 7 application from scaling when the computer has its fonts set to 125% on Windows 7. I have gone through all the forms and set the scaled property to False on them all, which solves the problem on most of the forms, but there are a few that have dynamically created controls on them, where the control is still being scaled, so I have a mix of some scaled and some not scaled controls on the same form. Any suggestions why these controls are still being scaled? As an example, we have a groupbox control on the form. During the form create, another control is dynamically created with the groupbox as its parent. It is this control which is still being scaled. The groupbox appears as it should (ie not scaled).
0
11,410,578
07/10/2012 09:42:48
1,051,849
11/17/2011 13:08:10
127
1
Google Maps V3 - json marker loading issue (using Rails 3.1 for data)
We're building a google map app in rails that initially loads some makers using a javascript json marker generating function (using the rails .to_json method on the data object). Then we have a listener on the zoom action that hoovers the new json file directly and feeds it into the same marker function above. On initial load the markers turn up fine, but on zoom no new ones seem to be showing up. Checking in the rails logs, the json file is being called, so the problem is either to do with how that json data is processed, or how the markers are delivered. Can any of you see what the problem is? var map; function initialize() { var myOptions = { zoom: <%= @zoom %>, center: new google.maps.LatLng(<%= @centre %>), mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); stream_json = (<%= raw(@stream.to_json) %>); parse_json(stream_json); google.maps.event.addListener(map, 'zoom_changed', function() { json_url = "/test?bounds="+map.getBounds()+"&zoom="+map.getZoom(); stream_json = $.getJSON(json_url); parse_json(stream_json); }); function parse_json(json) { if (json.length > 0) { var markers = []; for (i=0; i<json.length; i++) { var place = json[i]; alert(place.longitude +','+place.latitude); // addLocation(place); markers[i] = new google.maps.Marker({ map: map, position: new google.maps.LatLng(place.latitude, place.longitude) }); } } }; } google.maps.event.addDomListener(window, 'load', initialize); Many thanks in advance for any pointers you can send our way!
javascript
jquery
google-maps-api-3
ruby-on-rails-3.1
null
null
open
Google Maps V3 - json marker loading issue (using Rails 3.1 for data) === We're building a google map app in rails that initially loads some makers using a javascript json marker generating function (using the rails .to_json method on the data object). Then we have a listener on the zoom action that hoovers the new json file directly and feeds it into the same marker function above. On initial load the markers turn up fine, but on zoom no new ones seem to be showing up. Checking in the rails logs, the json file is being called, so the problem is either to do with how that json data is processed, or how the markers are delivered. Can any of you see what the problem is? var map; function initialize() { var myOptions = { zoom: <%= @zoom %>, center: new google.maps.LatLng(<%= @centre %>), mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); stream_json = (<%= raw(@stream.to_json) %>); parse_json(stream_json); google.maps.event.addListener(map, 'zoom_changed', function() { json_url = "/test?bounds="+map.getBounds()+"&zoom="+map.getZoom(); stream_json = $.getJSON(json_url); parse_json(stream_json); }); function parse_json(json) { if (json.length > 0) { var markers = []; for (i=0; i<json.length; i++) { var place = json[i]; alert(place.longitude +','+place.latitude); // addLocation(place); markers[i] = new google.maps.Marker({ map: map, position: new google.maps.LatLng(place.latitude, place.longitude) }); } } }; } google.maps.event.addDomListener(window, 'load', initialize); Many thanks in advance for any pointers you can send our way!
0
11,410,582
07/10/2012 09:43:00
817,527
06/27/2011 14:05:26
550
9
regular expressions replace in iOS
I am going to need to replace a dirty string for a clean string: -(void)setTheFilter:(NSString*)filter { [filter retain]; [_theFilter release]; <PSEUDO CODE> tmp = preg_replace(@"/[0-9]/",@"",filter); <~PSEUDO CODE> _theFilter = tmp; } This should eliminate all numbers in the `filter` so that: @"Import6652" would yield @"Import" How can I do it in iOS ? Thanks!
ios
regex
nsregularexpression
null
null
null
open
regular expressions replace in iOS === I am going to need to replace a dirty string for a clean string: -(void)setTheFilter:(NSString*)filter { [filter retain]; [_theFilter release]; <PSEUDO CODE> tmp = preg_replace(@"/[0-9]/",@"",filter); <~PSEUDO CODE> _theFilter = tmp; } This should eliminate all numbers in the `filter` so that: @"Import6652" would yield @"Import" How can I do it in iOS ? Thanks!
0
11,410,583
07/10/2012 09:43:02
1,514,272
07/10/2012 09:05:50
1
0
Arduino - How to cycle through hex colours from 000000 to FFFFFF?
I have a project involving an LED module that uses a 3-colour LED which can be controlled by passing in an RGB hex colour, eg 22AAFF How could I cycle from 000000 to FFFFFF if I start with this? long color = 0x000000; I want to have a loop that does every iteration and displays every possible colour, to end up with color = 0xFFFFFF I'm not sure if my understanding of the hex representation of colours makes sense!? Thanks....
c
hex
arduino
rgb
null
null
open
Arduino - How to cycle through hex colours from 000000 to FFFFFF? === I have a project involving an LED module that uses a 3-colour LED which can be controlled by passing in an RGB hex colour, eg 22AAFF How could I cycle from 000000 to FFFFFF if I start with this? long color = 0x000000; I want to have a loop that does every iteration and displays every possible colour, to end up with color = 0xFFFFFF I'm not sure if my understanding of the hex representation of colours makes sense!? Thanks....
0
11,410,584
07/10/2012 09:43:02
1,339,081
04/17/2012 14:42:25
22
0
R: loop to add to table new columns, each populated with data aggregated from different csv file
I am struggling to work out how to do this in R. I have data like this from a set of ~50 csv files, each detailing an individual books sale transaction: **week 1** **author** **title** **customerID** author1 title1 1 author1 title2 2 author2 title3 3 author3 title4 3 **week 2** **author** **title** **customerID** author1 title1 4 author3 title4 5 author4 title5 1 author5 title6 6 ... ~ 50 weeks, each from a separate csv file I want to get a new table, each row representing an author that appears in the complete data set, and with columns for each of the ~50 weeks that I have data for. Each cell should be the number of book sales of that author in that week. That can be calculated simply from summing the number of rows with that author in that week's sales file. So it should look something like this: **author** **week1** **week2** ... **week50** author1 2 1 ... author2 1 0 ... author3 1 1 ... author4 0 1 ... author5 0 1 ... ... Any ideas? I know how to get the list of unique authors to make the first column from. And I know how to load each week's sale data into a data frame. But I need help automating this process: 1) iterating over the unique authors 2) iterating over each week's csv file or data frame 3) summing the sales for that author in that week 4) adding count as the value for that cell Could anyone help? Thanks :-)
r
loops
time-series
trending
null
null
open
R: loop to add to table new columns, each populated with data aggregated from different csv file === I am struggling to work out how to do this in R. I have data like this from a set of ~50 csv files, each detailing an individual books sale transaction: **week 1** **author** **title** **customerID** author1 title1 1 author1 title2 2 author2 title3 3 author3 title4 3 **week 2** **author** **title** **customerID** author1 title1 4 author3 title4 5 author4 title5 1 author5 title6 6 ... ~ 50 weeks, each from a separate csv file I want to get a new table, each row representing an author that appears in the complete data set, and with columns for each of the ~50 weeks that I have data for. Each cell should be the number of book sales of that author in that week. That can be calculated simply from summing the number of rows with that author in that week's sales file. So it should look something like this: **author** **week1** **week2** ... **week50** author1 2 1 ... author2 1 0 ... author3 1 1 ... author4 0 1 ... author5 0 1 ... ... Any ideas? I know how to get the list of unique authors to make the first column from. And I know how to load each week's sale data into a data frame. But I need help automating this process: 1) iterating over the unique authors 2) iterating over each week's csv file or data frame 3) summing the sales for that author in that week 4) adding count as the value for that cell Could anyone help? Thanks :-)
0
11,410,586
07/10/2012 09:43:10
1,001,076
10/18/2011 12:11:36
362
0
Validation on numbers with jquery.bassistance validation
I used the jquery.bassistance validation plugin. For validation on my fields. Now i want validation on my arrival text box. I want that he validate on this box. The only characters that you used in this checkbox are numbers and the :. How can i make that. I used now this code: $(".validate").validate({ rules: { email: { required: true, email: true }, number: { required:true, minlength:3, phoneAus:true }, math: { equal: 11 }, agree: "required" }, messages: { email: "Vul een geldig email adres in", agree: "Je moet nog akkoord gaan met voorwaarden" }, errorLabelContainer: $("form .error-messages") }); But the number validation. Validate on numbers. How can i fix that the number validation. Accept the : sign. Thanks
javascript
jquery
validation
null
null
null
open
Validation on numbers with jquery.bassistance validation === I used the jquery.bassistance validation plugin. For validation on my fields. Now i want validation on my arrival text box. I want that he validate on this box. The only characters that you used in this checkbox are numbers and the :. How can i make that. I used now this code: $(".validate").validate({ rules: { email: { required: true, email: true }, number: { required:true, minlength:3, phoneAus:true }, math: { equal: 11 }, agree: "required" }, messages: { email: "Vul een geldig email adres in", agree: "Je moet nog akkoord gaan met voorwaarden" }, errorLabelContainer: $("form .error-messages") }); But the number validation. Validate on numbers. How can i fix that the number validation. Accept the : sign. Thanks
0
11,410,587
07/10/2012 09:43:12
1,012,478
10/25/2011 09:49:34
102
4
UIPicker not showing UIImages
I have a uipicker and it returns a uiimage and a uilabel. The image is loaded with url's. And i have added these in a queue. But the problem is that my images are not displayed in the uipicker. if i remove the queue then scrolling is not possible. is there any solution for this problem? my code snippet is here - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { if([Category isEqualToString:@"Species"]) { temp_img_url=[arraySpeciesImagenames objectAtIndex:row]; NSOperationQueue *queue = [NSOperationQueue new]; NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(updation_Image) object:nil]; [queue addOperation:operation]; // [operation release]; [queue autorelease]; UILabel *channelLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 0, 200, 50)]; channelLabel.text=[arrayFavSpecies objectAtIndex:row]; channelLabel.textAlignment = UITextAlignmentLeft; channelLabel.backgroundColor = [UIColor clearColor]; UIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250,50)]; // NSLog(@"Total %d species",[arrayFavSpecies count]); [tmpView insertSubview:ImageView_Picker atIndex:0]; [tmpView insertSubview:channelLabel atIndex:1]; return tmpView; } ............. some other codes for other pickers -(void)updation_Image { temp_img_url=[temp_img_url stringByReplacingOccurrencesOfString:@" " withString:@"%20"]; NSURL *url = [NSURL URLWithString:temp_img_url]; NSData *data = [NSData dataWithContentsOfURL:url]; img_Picker = [[[UIImage alloc] initWithData:data] autorelease]; ImageView_Picker = [[UIImageView alloc] initWithImage:img_Picker]; ImageView_Picker.frame = CGRectMake(0,0, 50, 50); //NSLog(@"URL:%@",temp_img_url); }
uiimage
uipickerview
null
null
null
null
open
UIPicker not showing UIImages === I have a uipicker and it returns a uiimage and a uilabel. The image is loaded with url's. And i have added these in a queue. But the problem is that my images are not displayed in the uipicker. if i remove the queue then scrolling is not possible. is there any solution for this problem? my code snippet is here - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { if([Category isEqualToString:@"Species"]) { temp_img_url=[arraySpeciesImagenames objectAtIndex:row]; NSOperationQueue *queue = [NSOperationQueue new]; NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(updation_Image) object:nil]; [queue addOperation:operation]; // [operation release]; [queue autorelease]; UILabel *channelLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 0, 200, 50)]; channelLabel.text=[arrayFavSpecies objectAtIndex:row]; channelLabel.textAlignment = UITextAlignmentLeft; channelLabel.backgroundColor = [UIColor clearColor]; UIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250,50)]; // NSLog(@"Total %d species",[arrayFavSpecies count]); [tmpView insertSubview:ImageView_Picker atIndex:0]; [tmpView insertSubview:channelLabel atIndex:1]; return tmpView; } ............. some other codes for other pickers -(void)updation_Image { temp_img_url=[temp_img_url stringByReplacingOccurrencesOfString:@" " withString:@"%20"]; NSURL *url = [NSURL URLWithString:temp_img_url]; NSData *data = [NSData dataWithContentsOfURL:url]; img_Picker = [[[UIImage alloc] initWithData:data] autorelease]; ImageView_Picker = [[UIImageView alloc] initWithImage:img_Picker]; ImageView_Picker.frame = CGRectMake(0,0, 50, 50); //NSLog(@"URL:%@",temp_img_url); }
0
11,410,589
07/10/2012 09:43:21
1,466,060
06/19/2012 09:55:16
19
1
How can I add submenus for pop up menu programatically?
In my plugin, I have a pop up menu with menu item 'X' and I want to add submenu to this menu item and the number and labels of menu items in the submenu and their action will change. I think I can';t do this from plugin.xml, so how to do this programatically?
eclipse
eclipse-plugin
eclipse-rcp
null
null
null
open
How can I add submenus for pop up menu programatically? === In my plugin, I have a pop up menu with menu item 'X' and I want to add submenu to this menu item and the number and labels of menu items in the submenu and their action will change. I think I can';t do this from plugin.xml, so how to do this programatically?
0
11,349,986
07/05/2012 18:03:26
1,491,943
06/29/2012 18:40:39
1
0
How to make servlet call in select box onclick
How to make servlet call from select box? I have a select box in my jsp page and each and every selection i have to call servlet and display the content in same jsp page. <select> <option value="spain">spain</option> <option value="france">France</option> <option value="italy">Italy</option> <option value="germany">Germany</option> </select> Onclick option one to show the country details of spain. same as each and every option. So how to work with javascript / jquery?
javascript
oracle
jsp
servlets
selectbox
null
open
How to make servlet call in select box onclick === How to make servlet call from select box? I have a select box in my jsp page and each and every selection i have to call servlet and display the content in same jsp page. <select> <option value="spain">spain</option> <option value="france">France</option> <option value="italy">Italy</option> <option value="germany">Germany</option> </select> Onclick option one to show the country details of spain. same as each and every option. So how to work with javascript / jquery?
0
11,350,035
07/05/2012 18:06:59
1,504,422
07/05/2012 15:05:38
1
0
where is defined Interator it interface method hasNext(), next(), remove(); beacause interface never defined method only declare
where is defined Iterator interface method like hasNext(),next(),remove(). beacause interface never defined method only declare Abstract method that are defined in other classes. and how can we directly access hasnext(),next() method through Itertor reference. for example List l=new LinkedList() l.add(1); l.add(2); Itertor iter=l.itertor(); while(iter.hasNext()) { Object o= iter.next(); System.out.pritnln(o); } in the above example using reference it(Itertor reference) can we assign any method in iter reference plese give me example to do so with self created program. i could not understand this concept till now.
java
null
null
null
null
null
open
where is defined Interator it interface method hasNext(), next(), remove(); beacause interface never defined method only declare === where is defined Iterator interface method like hasNext(),next(),remove(). beacause interface never defined method only declare Abstract method that are defined in other classes. and how can we directly access hasnext(),next() method through Itertor reference. for example List l=new LinkedList() l.add(1); l.add(2); Itertor iter=l.itertor(); while(iter.hasNext()) { Object o= iter.next(); System.out.pritnln(o); } in the above example using reference it(Itertor reference) can we assign any method in iter reference plese give me example to do so with self created program. i could not understand this concept till now.
0
11,350,036
07/05/2012 18:07:11
837,306
07/10/2011 04:14:35
86
0
Is closing statement is good enough or must we also close each of the resultset?
We have a java application which we use more then one statement variable. The problem why need more then one statement is that at time while runnning a loop for one result inside the loop we need some other query operation to be done. Most of the places the single stmt is used many times and finally we close. What we would like to confirm now is that we are not closing the resultset variables and we notice the usage of memory fluctuates.So what is the best mechanism to close the resultset immediately after we got the results or towards the end just before stmt is being closed?
java
resultset
null
null
null
null
open
Is closing statement is good enough or must we also close each of the resultset? === We have a java application which we use more then one statement variable. The problem why need more then one statement is that at time while runnning a loop for one result inside the loop we need some other query operation to be done. Most of the places the single stmt is used many times and finally we close. What we would like to confirm now is that we are not closing the resultset variables and we notice the usage of memory fluctuates.So what is the best mechanism to close the resultset immediately after we got the results or towards the end just before stmt is being closed?
0
11,350,039
07/05/2012 18:07:25
1,504,831
07/05/2012 18:01:54
1
0
Two WebCam Recording C#
I am new using C#, so i made a program that shows two webcam at the same time, but now i want to record video from each one and save it into a file. I am using AForge.Net with VideoSourceplayer, not pictureBox. What do you think i can do? Any suggestions?
c#
video
webcam
record
null
07/07/2012 10:50:34
not a real question
Two WebCam Recording C# === I am new using C#, so i made a program that shows two webcam at the same time, but now i want to record video from each one and save it into a file. I am using AForge.Net with VideoSourceplayer, not pictureBox. What do you think i can do? Any suggestions?
1
11,349,854
07/05/2012 17:56:26
1,458,195
06/15/2012 08:49:33
8
0
Vaddin getMainWindow().open(new ExternalResiurce())
Why Vaadin sends many http requess on getMainWindow().open(new ExternalResiurce())???
java
vaadin
null
null
null
null
open
Vaddin getMainWindow().open(new ExternalResiurce()) === Why Vaadin sends many http requess on getMainWindow().open(new ExternalResiurce())???
0
11,350,045
07/05/2012 18:07:46
886,112
08/09/2011 14:15:59
58
0
CGI with bash, executing JQuery on object embedded in site failed
I'm programming a server monitoring system and now I'm stuck with JQuery... First, this is the link to the website running the monitoring system: http://ftpronse.dyndns.org/cgi-bin/index Still an alpha version of course :-) Now, at the bottom of the page there is a table which is an embedded object (I'm using one table for all the pages, so when the table gets updated, the table on ALL the pages gets updated :-) ) When the user is at the "connections" page for example, I want to hide all the columns of the table except the "connections" column... Now, the JQuery code for hiding a column is: $(document).ready(function () { alert('TEST'); $('td:nth-child(1),th:nth-child(1)').hide(); }); But the table is an object, so how can i apply this piece of code the table in the object? Any remarks about my monitoring center always welcome! :P Thanks!
jquery
html
bash
cgi
null
null
open
CGI with bash, executing JQuery on object embedded in site failed === I'm programming a server monitoring system and now I'm stuck with JQuery... First, this is the link to the website running the monitoring system: http://ftpronse.dyndns.org/cgi-bin/index Still an alpha version of course :-) Now, at the bottom of the page there is a table which is an embedded object (I'm using one table for all the pages, so when the table gets updated, the table on ALL the pages gets updated :-) ) When the user is at the "connections" page for example, I want to hide all the columns of the table except the "connections" column... Now, the JQuery code for hiding a column is: $(document).ready(function () { alert('TEST'); $('td:nth-child(1),th:nth-child(1)').hide(); }); But the table is an object, so how can i apply this piece of code the table in the object? Any remarks about my monitoring center always welcome! :P Thanks!
0
11,350,046
07/05/2012 18:07:47
520,692
11/25/2010 22:15:54
1,492
20
Datatable Javascript shows horizontal scroller bar
When I click on any of the columns to sort, I get the error message: DataTables warning (table id = 'IDOFTABLE'): The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width. Can you please help? "bJQueryUI": false, "bProcessing": false, "bServerSide": true, "bFilter": true, "bAutoWidth": false, "bDeferRender": true, "bScrollCollapse": true, "oScroller": { serverWait: true }, "bInfo": true, "aaSorting": [[1, 'asc']], // Default first column sort "sDom": 'tiS',
javascript
jquery
datatable
null
null
null
open
Datatable Javascript shows horizontal scroller bar === When I click on any of the columns to sort, I get the error message: DataTables warning (table id = 'IDOFTABLE'): The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width. Can you please help? "bJQueryUI": false, "bProcessing": false, "bServerSide": true, "bFilter": true, "bAutoWidth": false, "bDeferRender": true, "bScrollCollapse": true, "oScroller": { serverWait: true }, "bInfo": true, "aaSorting": [[1, 'asc']], // Default first column sort "sDom": 'tiS',
0
11,541,861
07/18/2012 12:53:00
1,495,732
07/02/2012 10:08:57
3
0
Saving an image from canvas
Ive been trying to get an image export of a div (a css based word cloud), first using html2canvas to create the canvas element on the page which works great. Secondly I have been tyring to use canvas2image to save out a png or jpeg of that canvas without any success. I can download and get a working example with no errors running locally for this example: http://www.nihilogic.dk/labs/canvas2image/ Though whenever I switch the id of the canvas in which it is saving to my own I get the following error in firebug: "oCanvas is null" Does anyone know why this error may be showing? or have any other suggestions on how I may save this out as an image? Thanks!
javascript
export
save-image
html2canvas
null
null
open
Saving an image from canvas === Ive been trying to get an image export of a div (a css based word cloud), first using html2canvas to create the canvas element on the page which works great. Secondly I have been tyring to use canvas2image to save out a png or jpeg of that canvas without any success. I can download and get a working example with no errors running locally for this example: http://www.nihilogic.dk/labs/canvas2image/ Though whenever I switch the id of the canvas in which it is saving to my own I get the following error in firebug: "oCanvas is null" Does anyone know why this error may be showing? or have any other suggestions on how I may save this out as an image? Thanks!
0
11,541,862
07/18/2012 12:53:03
1,457,863
06/15/2012 05:28:07
318
22
make an edit text appear between the top and the soft keyboard of the device in android
I have a scrollview layout with many ViewsStubs and these views stubs are inflated (displayed) depending on the user actions like.....answering the 1st questions makes the 2nd question and answer field(editText) appear my problem is after answering the 1st question and clicking submit, the next question is made visible but the answer field is hidden under the soft keyboard...user cannot see what he is typing. what i want is any newly displayed editText/spinner/checkbox must appear at the top of the screen (dynamically scroll to these views). how to achieve this??
android
focus
scrollview
null
null
null
open
make an edit text appear between the top and the soft keyboard of the device in android === I have a scrollview layout with many ViewsStubs and these views stubs are inflated (displayed) depending on the user actions like.....answering the 1st questions makes the 2nd question and answer field(editText) appear my problem is after answering the 1st question and clicking submit, the next question is made visible but the answer field is hidden under the soft keyboard...user cannot see what he is typing. what i want is any newly displayed editText/spinner/checkbox must appear at the top of the screen (dynamically scroll to these views). how to achieve this??
0
11,541,863
07/18/2012 12:53:04
701,346
04/10/2011 23:23:42
827
28
Excel 2010 VBA: What is the VB code to emulate selecting a block with the CTRL+A shortcut?
In earlier versions of Excel, pressing CTRL+A in a worksheet would literally select all cells. In Excel 2010 (not sure about 2007 or 2003), I've noticed that if you press CTRL+A within a block of cells that contain values, it seems to know to select only the cells in that block. For example, if all cells in range A1:D10 contain values and you hit CTRL+A while the active cell is in that range, it will select only A1:D10. If you press CTRL+A again, only then will it actually select all cells in the worksheet. So I recorded a macro to see what macro code was being generated when I do this, but it actually writes `Range("A1:D10").Select` when I hit CTRL+A. This is limiting and not dynamic because now I have to write my own logic to determine the boundaries around the active cell. That's not difficult with methods like `ActiveCell.End(xlDown)`, but I'd like to not have to reinvent a wheel here. Is there some Excel VBA method like `ActiveCell.GetOuterRange.Select`? That would be nice.
excel-vba
macros
range
excel-2010
null
null
open
Excel 2010 VBA: What is the VB code to emulate selecting a block with the CTRL+A shortcut? === In earlier versions of Excel, pressing CTRL+A in a worksheet would literally select all cells. In Excel 2010 (not sure about 2007 or 2003), I've noticed that if you press CTRL+A within a block of cells that contain values, it seems to know to select only the cells in that block. For example, if all cells in range A1:D10 contain values and you hit CTRL+A while the active cell is in that range, it will select only A1:D10. If you press CTRL+A again, only then will it actually select all cells in the worksheet. So I recorded a macro to see what macro code was being generated when I do this, but it actually writes `Range("A1:D10").Select` when I hit CTRL+A. This is limiting and not dynamic because now I have to write my own logic to determine the boundaries around the active cell. That's not difficult with methods like `ActiveCell.End(xlDown)`, but I'd like to not have to reinvent a wheel here. Is there some Excel VBA method like `ActiveCell.GetOuterRange.Select`? That would be nice.
0
11,541,865
07/18/2012 12:53:11
696,627
04/07/2011 10:42:17
1,075
20
LINQ 2 SQL: AddObject and InsertOnSubmit
I need to insert a record into Payment table. I found two methods to do it 1. AddObject 2. InsertOnSubmit What is the difference between the two? When to use what? public void InsertEntity(DBML_Project.Payment payment) { //Insert the entity MyDataContext.GetTable<DBML_Project.Payment>().InsertOnSubmit(payment); } public void InsertPayment(IPayment payment) { this.AddObject(payment.GetType().Name, payment); }
c#
.net
entity-framework
linq-to-sql
null
null
open
LINQ 2 SQL: AddObject and InsertOnSubmit === I need to insert a record into Payment table. I found two methods to do it 1. AddObject 2. InsertOnSubmit What is the difference between the two? When to use what? public void InsertEntity(DBML_Project.Payment payment) { //Insert the entity MyDataContext.GetTable<DBML_Project.Payment>().InsertOnSubmit(payment); } public void InsertPayment(IPayment payment) { this.AddObject(payment.GetType().Name, payment); }
0
11,541,882
07/18/2012 12:54:09
1,056,328
11/20/2011 12:06:17
158
0
C# get => modify => set paradigm. how to shorter it into one line function call?
So I use something like: ... var o = class.o; // o is a property o.modifyInternalParameter(a, b, c); // a, b, c were created somewhere before class.o = o; // as you can see o has geter and setter. ... how to create a fuctional wrapper to reather thanb call 3 code lines call some func(class.o, TypeOfO.modifyInternalParameter, {a, b, c}, returnValueIfmodifyInternalParameterHasOne); ?
c#
.net
visual-studio
.net-3.5
null
null
open
C# get => modify => set paradigm. how to shorter it into one line function call? === So I use something like: ... var o = class.o; // o is a property o.modifyInternalParameter(a, b, c); // a, b, c were created somewhere before class.o = o; // as you can see o has geter and setter. ... how to create a fuctional wrapper to reather thanb call 3 code lines call some func(class.o, TypeOfO.modifyInternalParameter, {a, b, c}, returnValueIfmodifyInternalParameterHasOne); ?
0
11,541,887
07/18/2012 12:54:22
1,520,262
07/12/2012 09:09:48
13
0
I/O optimization for Programming Constest
Is there any way to optimize the Input, in the case predefined input formats.<br /> Example problems : - http://www.spoj.pl/problems/MARTIAN/ - http://www.spoj.pl/problems/FISHER/<br /> I can think of scanning one line at a time and parsing it. Is there any better way to do that?<br /> If someone knows a way, please share the optimizing code snippet. Preferably in **C/C++**
io
programming-contest
null
null
null
null
open
I/O optimization for Programming Constest === Is there any way to optimize the Input, in the case predefined input formats.<br /> Example problems : - http://www.spoj.pl/problems/MARTIAN/ - http://www.spoj.pl/problems/FISHER/<br /> I can think of scanning one line at a time and parsing it. Is there any better way to do that?<br /> If someone knows a way, please share the optimizing code snippet. Preferably in **C/C++**
0
11,541,894
07/18/2012 12:54:45
22,595
09/26/2008 08:28:44
7,623
429
How to retrieve result of Oracle database function via ODBC?
I have problem with calling Oracle stored function (not procedure) via ODBC. My function is really simple, it just concatenates two strings. I can call it via: rs = c.execute("SELECT add_str('yogi', 'bubu') FROM dual") for row in c.fetchall(): print(row[0]) But such type of calling database function will not work for functions that changes database. So I tried this: c.execute("{ ? = call add_str('ala', 'bubu') }"); for row in c.fetchall(): print(row[0]) But I got: Error: HY000: The driver did not supply an error! In ODBC trace file it looks like: python.exe odbc a20-e68 ENTER SQLExecDirect HSTMT 00A02CE0 UCHAR * 0x00AA6CE4 [ -3] "{ ? = call add_str('ala', 'bubu') }\ 0" SDWORD -3 python.exe odbc a20-e68 EXIT SQLExecDirect with return code -1 (SQL_ERROR) HSTMT 00A02CE0 UCHAR * 0x00AA6CE4 [ -3] "{ ? = call add_str('ala', 'bubu') }\ 0" SDWORD -3 python.exe odbc a20-e68 ENTER SQLGetDiagRecW SQLSMALLINT 3 SQLHANDLE 00A02CE0 SQLSMALLINT 1 SQLWCHAR * 0x0021F7BC (NYI) SQLINTEGER * 0x0021F808 SQLWCHAR * 0x00A035F8 (NYI) SQLSMALLINT 1023 SQLSMALLINT * 0x0021F818 python.exe odbc a20-e68 EXIT SQLGetDiagRecW with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 SQLHANDLE 00A02CE0 SQLSMALLINT 1 SQLWCHAR * 0x0021F7BC (NYI) SQLINTEGER * 0x0021F808 SQLWCHAR * 0x00A035F8 (NYI) SQLSMALLINT 1023 SQLSMALLINT * 0x0021F818 Similar operation is possible with `JDBC/Jython`: proc = db.prepareCall("{ ? = call add_str('j_bubu', 'j_yogi') }"); proc.registerOutParameter(1, Types.VARCHAR) r = proc.execute(); print(proc.getString(1)) My environment: Database: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production ODBC driver: 11.01.00.06 SQORA32.DLL FileVersion: 11.1.0.6.0 I tried `odbc` module from ActiveState Python 2.7 and `pyodbc` module. My question: Is there any way of calling Oracle database function (not procedure) via their ODBC driver? And how to retrieve its result?
python
oracle
odbc
null
null
null
open
How to retrieve result of Oracle database function via ODBC? === I have problem with calling Oracle stored function (not procedure) via ODBC. My function is really simple, it just concatenates two strings. I can call it via: rs = c.execute("SELECT add_str('yogi', 'bubu') FROM dual") for row in c.fetchall(): print(row[0]) But such type of calling database function will not work for functions that changes database. So I tried this: c.execute("{ ? = call add_str('ala', 'bubu') }"); for row in c.fetchall(): print(row[0]) But I got: Error: HY000: The driver did not supply an error! In ODBC trace file it looks like: python.exe odbc a20-e68 ENTER SQLExecDirect HSTMT 00A02CE0 UCHAR * 0x00AA6CE4 [ -3] "{ ? = call add_str('ala', 'bubu') }\ 0" SDWORD -3 python.exe odbc a20-e68 EXIT SQLExecDirect with return code -1 (SQL_ERROR) HSTMT 00A02CE0 UCHAR * 0x00AA6CE4 [ -3] "{ ? = call add_str('ala', 'bubu') }\ 0" SDWORD -3 python.exe odbc a20-e68 ENTER SQLGetDiagRecW SQLSMALLINT 3 SQLHANDLE 00A02CE0 SQLSMALLINT 1 SQLWCHAR * 0x0021F7BC (NYI) SQLINTEGER * 0x0021F808 SQLWCHAR * 0x00A035F8 (NYI) SQLSMALLINT 1023 SQLSMALLINT * 0x0021F818 python.exe odbc a20-e68 EXIT SQLGetDiagRecW with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 SQLHANDLE 00A02CE0 SQLSMALLINT 1 SQLWCHAR * 0x0021F7BC (NYI) SQLINTEGER * 0x0021F808 SQLWCHAR * 0x00A035F8 (NYI) SQLSMALLINT 1023 SQLSMALLINT * 0x0021F818 Similar operation is possible with `JDBC/Jython`: proc = db.prepareCall("{ ? = call add_str('j_bubu', 'j_yogi') }"); proc.registerOutParameter(1, Types.VARCHAR) r = proc.execute(); print(proc.getString(1)) My environment: Database: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production ODBC driver: 11.01.00.06 SQORA32.DLL FileVersion: 11.1.0.6.0 I tried `odbc` module from ActiveState Python 2.7 and `pyodbc` module. My question: Is there any way of calling Oracle database function (not procedure) via their ODBC driver? And how to retrieve its result?
0
11,443,302
07/11/2012 23:59:47
714,797
04/19/2011 08:24:46
42
0
Compiling Numpy with openblas integration
I am trying to install numpy with openblas , however I am at loss as to how the site.cfg file needs to be written. When the installation procedure [at][1] was followed the installation was completed without errors, however there is performance degradation on increasing the number of threads used by openblas from 1 (controlled by the environment variable OMP_NUM_THREADS). I am not sure if the openblas integration has been perfect. Could any one provide a site.cfg file to achieve the same. P.S.: openblas integration in other toolkits like [Theano][2], which is based on python, provides substantial performance boost on increasing the number of threads, on the same machine. [1]: http://www.kde.cs.tut.ac.jp/~atsushi/?p=493# [2]: http://deeplearning.net/software/theano/
python
numpy
blas
null
null
null
open
Compiling Numpy with openblas integration === I am trying to install numpy with openblas , however I am at loss as to how the site.cfg file needs to be written. When the installation procedure [at][1] was followed the installation was completed without errors, however there is performance degradation on increasing the number of threads used by openblas from 1 (controlled by the environment variable OMP_NUM_THREADS). I am not sure if the openblas integration has been perfect. Could any one provide a site.cfg file to achieve the same. P.S.: openblas integration in other toolkits like [Theano][2], which is based on python, provides substantial performance boost on increasing the number of threads, on the same machine. [1]: http://www.kde.cs.tut.ac.jp/~atsushi/?p=493# [2]: http://deeplearning.net/software/theano/
0
11,442,061
07/11/2012 21:52:15
468,312
10/06/2010 18:10:45
1,413
12
Codeigniter return NULL from validation callback
I'm using a callback to validate URLs submitted by a text input. I need to insert `NULL` in the database if the text input is empty (meaning the user erased his/her URL entry). I'm trying the code below but it just inserts an empty string in the database. $this->form_validation->set_rules('image_url', 'Image URL', 'trim|xss_clean|prep_url|callback__validate_url'); The callback: function _validate_url($str) { if (isset($str)) { $pattern = "/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i"; if (!preg_match($pattern, $str)) { $this->form_validation->set_message('_validate_url', 'URL is not valid'); return FALSE; } else { if (!isset($str)) //if input empty { return NULL; //return NULL to input? } return TRUE; } } return TRUE; } How can I return a value to the input via a callback?
php
validation
codeigniter
null
null
null
open
Codeigniter return NULL from validation callback === I'm using a callback to validate URLs submitted by a text input. I need to insert `NULL` in the database if the text input is empty (meaning the user erased his/her URL entry). I'm trying the code below but it just inserts an empty string in the database. $this->form_validation->set_rules('image_url', 'Image URL', 'trim|xss_clean|prep_url|callback__validate_url'); The callback: function _validate_url($str) { if (isset($str)) { $pattern = "/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i"; if (!preg_match($pattern, $str)) { $this->form_validation->set_message('_validate_url', 'URL is not valid'); return FALSE; } else { if (!isset($str)) //if input empty { return NULL; //return NULL to input? } return TRUE; } } return TRUE; } How can I return a value to the input via a callback?
0
11,442,062
07/11/2012 21:52:18
953,702
09/19/2011 23:41:14
90
3
MediaElement.js setSrc() Loading The File But Not Changing pluginType
I'm working on [a page](http://www.flcbranson.org/embed.php) that uses [mediaelement.js](http://www.mediaelementjs.com/) to play mp3/mp4/wmv (yes, we have a lot of wmv). I have a list of links and those links should change the player. My effort is to make the changes to the player through javascript so that the page doesn't refresh. This code is working, but it refreshes every time. <?php $file = null; $file = $_GET["file"]; $format = null; if (preg_match("/mp4/i", $file)) $format = "mp4"; if (preg_match("/webm/i", $file)) $format = "webm"; if (preg_match("/wmv/i", $file)) $format = "wmv"; if (preg_match("/mp3/i", $file)) $format = "mp3"; if (preg_match("/ogg/i", $file)) $format = "ogg"; $mime = null; if ($format == "mp4") $mime = "video/mp4"; if ($format == "webm") $mime = "video/webm"; if ($format == "wmv") $mime = "video/wmv"; if ($format == "mp3") $mime = "audio/mp3"; if ($format == "ogg") $mime = "audio/ogg"; $element = "video"; if ($format == "mp3" || $format == "ogg") $element = "audio"; // you have to escape (\) the escape (\) character (hehehe...) $poster = "media\\120701Video.jpg"; $height = "360"; if ($format == "mp3") $height = "30"; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Embed</title> <link rel="stylesheet" href="include/johndyer-mediaelement-b090320/build/mediaelementplayer.min.css"> <style> audio {width:640px; height:30px;} video {width:640px; height:360px;} </style> <script src="include/johndyer-mediaelement-b090320/build/jquery.js"></script> <script src="include/johndyer-mediaelement-b090320/build/mediaelement-and-player.js"></script> </head> <body> <ul> <li><a href="embed.php">Reset</a></li> <li><a href="?file=media/120701Video-AnyVideoConverter.mp4">Alternative (mp4)</a></li> <li><a href="?file=media/120701Video-Ffmpeg-Defaults.webm">Alternative (webm)</a></li> <li><a href="?file=media/AreYouHurting-Death.wmv">Alternative (wmv)</a><li> <li><a href="?file=media/AreYouHurting-Death.mp3">Alternative (mp3)</a></li> </ul> <?php if ($file) { ?> <video src="<?php echo $file; ?>" controls poster="<?php echo $poster; ?>" width="640" height="360"></video> <div id="type"></div> <script> var video = document.getElementsByTagName("video")[0]; var player = new MediaElementPlayer(video, { success: function(player) { $('#type').html(player.pluginType); } }); <?php } ?> </script> </body> </html> This code requires `<video>` to be loaded, initially and with a file, so that the player mode (`pluginType`) is set. It will, then, only play formats that the pre-established mode supports (firefox in native mode won't play mp4). <!doctype html> <html> <head> <meta charset="utf-8"> <title>Embed</title> <link rel="stylesheet" href="http://www.mediaelementjs.com/js/mejs-2.9.2/mediaelementplayer.min.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script src="http://www.mediaelementjs.com/js/mejs-2.9.2/mediaelement-and-player.js"></script> </head> <body> <ul> <li><a href="javascript:player.pause(); player.setSrc('media/120701Video-AnyVideoConverter.mp4'); player.load(); player.play();">Alternative (mp4)</a></li> <li><a href="javascript:player.pause(); player.setSrc('media/120701Video-Ffmpeg-Defaults.webm'); player.load(); player.play();">Alternative (webm)</a></li> <li><a href="javascript:player.pause(); player.setSrc('media/AreYouHurting-Death.wmv'); player.load(); player.play();">Alternative (wmv)</a></li> <li><a href="javascript:player.pause(); player.setSrc('media/AreYouHurting-Death.mp3'); player.load(); player.play();">Alternative (mp3)</a></li> </ul> <video controls src="media/WordProductionCenter.mp4"></video> <div id="type"></div> <script> var video = document.getElementsByTagName("video")[0]; var player = new MediaElementPlayer(video, { success: function(player) { $('#type').html(player.pluginType); } }); </script> </body> </html> It seems like I need something like `setType()`, but I see no such option. I've read a couple pages that referenced refreshing the DOM after the javascript runs, but I haven't been able to successfully do it (I know enough about javascript to hack things around and get stuff working, but not enough to create whole new things). It is worth noting that Silverlight doesn't work with Internet Explorer 8 or Safari (not sure if it's my code, mejs, or the browsers). Also, neither Silverlight nor Flash play mp3 or webm (again, not sure where the problem lies). Is there a way to dynamically load different types of files into mediaelement?
javascript
html5-video
mediaelement.js
null
null
null
open
MediaElement.js setSrc() Loading The File But Not Changing pluginType === I'm working on [a page](http://www.flcbranson.org/embed.php) that uses [mediaelement.js](http://www.mediaelementjs.com/) to play mp3/mp4/wmv (yes, we have a lot of wmv). I have a list of links and those links should change the player. My effort is to make the changes to the player through javascript so that the page doesn't refresh. This code is working, but it refreshes every time. <?php $file = null; $file = $_GET["file"]; $format = null; if (preg_match("/mp4/i", $file)) $format = "mp4"; if (preg_match("/webm/i", $file)) $format = "webm"; if (preg_match("/wmv/i", $file)) $format = "wmv"; if (preg_match("/mp3/i", $file)) $format = "mp3"; if (preg_match("/ogg/i", $file)) $format = "ogg"; $mime = null; if ($format == "mp4") $mime = "video/mp4"; if ($format == "webm") $mime = "video/webm"; if ($format == "wmv") $mime = "video/wmv"; if ($format == "mp3") $mime = "audio/mp3"; if ($format == "ogg") $mime = "audio/ogg"; $element = "video"; if ($format == "mp3" || $format == "ogg") $element = "audio"; // you have to escape (\) the escape (\) character (hehehe...) $poster = "media\\120701Video.jpg"; $height = "360"; if ($format == "mp3") $height = "30"; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Embed</title> <link rel="stylesheet" href="include/johndyer-mediaelement-b090320/build/mediaelementplayer.min.css"> <style> audio {width:640px; height:30px;} video {width:640px; height:360px;} </style> <script src="include/johndyer-mediaelement-b090320/build/jquery.js"></script> <script src="include/johndyer-mediaelement-b090320/build/mediaelement-and-player.js"></script> </head> <body> <ul> <li><a href="embed.php">Reset</a></li> <li><a href="?file=media/120701Video-AnyVideoConverter.mp4">Alternative (mp4)</a></li> <li><a href="?file=media/120701Video-Ffmpeg-Defaults.webm">Alternative (webm)</a></li> <li><a href="?file=media/AreYouHurting-Death.wmv">Alternative (wmv)</a><li> <li><a href="?file=media/AreYouHurting-Death.mp3">Alternative (mp3)</a></li> </ul> <?php if ($file) { ?> <video src="<?php echo $file; ?>" controls poster="<?php echo $poster; ?>" width="640" height="360"></video> <div id="type"></div> <script> var video = document.getElementsByTagName("video")[0]; var player = new MediaElementPlayer(video, { success: function(player) { $('#type').html(player.pluginType); } }); <?php } ?> </script> </body> </html> This code requires `<video>` to be loaded, initially and with a file, so that the player mode (`pluginType`) is set. It will, then, only play formats that the pre-established mode supports (firefox in native mode won't play mp4). <!doctype html> <html> <head> <meta charset="utf-8"> <title>Embed</title> <link rel="stylesheet" href="http://www.mediaelementjs.com/js/mejs-2.9.2/mediaelementplayer.min.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script src="http://www.mediaelementjs.com/js/mejs-2.9.2/mediaelement-and-player.js"></script> </head> <body> <ul> <li><a href="javascript:player.pause(); player.setSrc('media/120701Video-AnyVideoConverter.mp4'); player.load(); player.play();">Alternative (mp4)</a></li> <li><a href="javascript:player.pause(); player.setSrc('media/120701Video-Ffmpeg-Defaults.webm'); player.load(); player.play();">Alternative (webm)</a></li> <li><a href="javascript:player.pause(); player.setSrc('media/AreYouHurting-Death.wmv'); player.load(); player.play();">Alternative (wmv)</a></li> <li><a href="javascript:player.pause(); player.setSrc('media/AreYouHurting-Death.mp3'); player.load(); player.play();">Alternative (mp3)</a></li> </ul> <video controls src="media/WordProductionCenter.mp4"></video> <div id="type"></div> <script> var video = document.getElementsByTagName("video")[0]; var player = new MediaElementPlayer(video, { success: function(player) { $('#type').html(player.pluginType); } }); </script> </body> </html> It seems like I need something like `setType()`, but I see no such option. I've read a couple pages that referenced refreshing the DOM after the javascript runs, but I haven't been able to successfully do it (I know enough about javascript to hack things around and get stuff working, but not enough to create whole new things). It is worth noting that Silverlight doesn't work with Internet Explorer 8 or Safari (not sure if it's my code, mejs, or the browsers). Also, neither Silverlight nor Flash play mp3 or webm (again, not sure where the problem lies). Is there a way to dynamically load different types of files into mediaelement?
0
11,443,310
07/12/2012 00:01:01
560,287
01/02/2011 11:32:58
389
46
PHP unable write to sys_get_temp_dir() on Mac
I have really simplified it do to: `mkdir(sys_get_temp_dir().'/test', 0777);` which returns error > Warning: mkdir() [function.mkdir]: Permission denied in Not sure what has happened (had quite a few problems recently with my Mac) although it appears as though it is a simple permissions problem somewhere. sys_get_temp_dir() = /var/folders/aP/aPaKHnXDGqG-75bSdcDjkk+++TI/-Tmp- sh-3.2# ls -ld /var/folders/ drwxr-xr-x 4 root wheel 136 12 Jul 00:51 /var/folders/ sh-3.2# ls -ld /var/folders/aP/ drwxr-xr-x 3 root wheel 102 12 Jul 00:40 /var/folders/aP/ sh-3.2# ls -ld /var/folders/aP/aPaKHnXDGqG-75bSdcDjkk+++TI/ drwxr-xr-x 4 myuser staff 136 12 Jul 00:44 /var/folders/aP/aPaKHnXDGqG-75bSdcDjkk+++TI/ - Using Snow Leopard 10.6.8 - MAMP Pro with Memcache extension.
php
osx
permissions
osx-snow-leopard
user-permissions
null
open
PHP unable write to sys_get_temp_dir() on Mac === I have really simplified it do to: `mkdir(sys_get_temp_dir().'/test', 0777);` which returns error > Warning: mkdir() [function.mkdir]: Permission denied in Not sure what has happened (had quite a few problems recently with my Mac) although it appears as though it is a simple permissions problem somewhere. sys_get_temp_dir() = /var/folders/aP/aPaKHnXDGqG-75bSdcDjkk+++TI/-Tmp- sh-3.2# ls -ld /var/folders/ drwxr-xr-x 4 root wheel 136 12 Jul 00:51 /var/folders/ sh-3.2# ls -ld /var/folders/aP/ drwxr-xr-x 3 root wheel 102 12 Jul 00:40 /var/folders/aP/ sh-3.2# ls -ld /var/folders/aP/aPaKHnXDGqG-75bSdcDjkk+++TI/ drwxr-xr-x 4 myuser staff 136 12 Jul 00:44 /var/folders/aP/aPaKHnXDGqG-75bSdcDjkk+++TI/ - Using Snow Leopard 10.6.8 - MAMP Pro with Memcache extension.
0
11,443,314
07/12/2012 00:01:18
1,133,391
01/06/2012 01:05:15
1
0
How to set IF statement on GROUP BY
Hi I have query that confusing, this is the query SELECT `meta_value`,`meta_count`,`post_id` FROM `wp_post_meta` GROUP BY IF(ISNULL(target_key), '', target_key) ORDER BY `meta_count` DESC LIMIT 30 some of target key is null but some is value exist, how can I make result if target_key is value exist make it GROUP BY but if empty GROUP BY disabled Anyone can help me?
mysql
group-by
null
null
null
null
open
How to set IF statement on GROUP BY === Hi I have query that confusing, this is the query SELECT `meta_value`,`meta_count`,`post_id` FROM `wp_post_meta` GROUP BY IF(ISNULL(target_key), '', target_key) ORDER BY `meta_count` DESC LIMIT 30 some of target key is null but some is value exist, how can I make result if target_key is value exist make it GROUP BY but if empty GROUP BY disabled Anyone can help me?
0
11,471,959
07/13/2012 13:57:09
1,076,978
12/02/2011 08:24:12
31
1
How does apache PHP memory usage really work?
To give some context: I had a discussion with a colleague recently about the use of Autoloaders in PHP. I was arguing in favour of them, him against. My point of view is that Autoloaders can help you minimise manual source dependency which in turn can help you reduce the amount of memory consumed when including lots of large files that you may not need. His response was that including files that you do not need is not a big problem because after a file has been included once it is kept in memory by the Apache child process and this portion of memory will be available for subsequent requests. He argues that you should not be concerned about the amount of included files because soon enough they will all be loaded into memory and used on-demand from memory. Therefore memory is less of an issue and the overhead of trying to find the file you need on the filesystem is much more of a concern. He's a smart guy and tends to know what he's talking about. However, I always thought that the memory used by Apache and PHP was specific to that particular request being handled. Each request is assigned an amount of memory equal to memory_limit PHP option and any source compilation and processing is only valid for the life of the request. Even with op-code caches such as APC, I thought that the individual request still needs to load up each file in it's own portion of memory and that APC is just a shortcut to having it pre-compiled for the responding process. I've been searching for some documentation on this but haven't managed to find anything so far. I would really appreciate it if someone can point me to any useful documentation on this topic.
php
memory
process
apache2
null
07/14/2012 13:25:14
off topic
How does apache PHP memory usage really work? === To give some context: I had a discussion with a colleague recently about the use of Autoloaders in PHP. I was arguing in favour of them, him against. My point of view is that Autoloaders can help you minimise manual source dependency which in turn can help you reduce the amount of memory consumed when including lots of large files that you may not need. His response was that including files that you do not need is not a big problem because after a file has been included once it is kept in memory by the Apache child process and this portion of memory will be available for subsequent requests. He argues that you should not be concerned about the amount of included files because soon enough they will all be loaded into memory and used on-demand from memory. Therefore memory is less of an issue and the overhead of trying to find the file you need on the filesystem is much more of a concern. He's a smart guy and tends to know what he's talking about. However, I always thought that the memory used by Apache and PHP was specific to that particular request being handled. Each request is assigned an amount of memory equal to memory_limit PHP option and any source compilation and processing is only valid for the life of the request. Even with op-code caches such as APC, I thought that the individual request still needs to load up each file in it's own portion of memory and that APC is just a shortcut to having it pre-compiled for the responding process. I've been searching for some documentation on this but haven't managed to find anything so far. I would really appreciate it if someone can point me to any useful documentation on this topic.
2
11,471,964
07/13/2012 13:57:22
1,322,905
04/09/2012 23:50:21
37
0
(Java) trying to read in a text file for a map in a terminal game, but NoSuchElementException
I keep getting the exception NoSuchElement relative to my scanning of the .txt file. Such errors to cause the exception are: "java.util.Scanner.throwFor(Unknown Source) java.util.Scanner.next(Unknown Source) java.util.Scanner.nextInt(Unknown Source)" All I'm doing is reading in 1's and 0's as a test for a basic map in a ASCII terminal game. My code: import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class Adventure { private Scanner in_file; private char[][] level; public Adventure() { level = new char[5][5]; } public static void main(String []args) { Adventure adv = new Adventure(); adv.load_game(); adv.main_game(); } public void load_game() { try { in_file = new Scanner(new File("level.txt")); } catch (FileNotFoundException e) { System.err.println("ERROR: Level could not be loaded!"); System.exit(1); } for (int i = 0; i < level.length; i++ ) { for (int j = 0; j < level[i].length; j++) { if (in_file.hasNextInt()) { if (in_file.nextInt() == 0) level[i][j] = '-'; else if (in_file.nextInt() == 1) level[i][j] = '#'; } } } in_file.close(); } public void new_game() { } public void main_game() { for (int i = 0; i < 20; i++) { for (int j = 0; j < 50; j++) { System.out.print(level[i][j]); } } } public void save_game() { } } My text file, "level.txt": 11111 10001 10001 10001 11111
java
terminal
ascii
java-util-scanner
null
null
open
(Java) trying to read in a text file for a map in a terminal game, but NoSuchElementException === I keep getting the exception NoSuchElement relative to my scanning of the .txt file. Such errors to cause the exception are: "java.util.Scanner.throwFor(Unknown Source) java.util.Scanner.next(Unknown Source) java.util.Scanner.nextInt(Unknown Source)" All I'm doing is reading in 1's and 0's as a test for a basic map in a ASCII terminal game. My code: import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class Adventure { private Scanner in_file; private char[][] level; public Adventure() { level = new char[5][5]; } public static void main(String []args) { Adventure adv = new Adventure(); adv.load_game(); adv.main_game(); } public void load_game() { try { in_file = new Scanner(new File("level.txt")); } catch (FileNotFoundException e) { System.err.println("ERROR: Level could not be loaded!"); System.exit(1); } for (int i = 0; i < level.length; i++ ) { for (int j = 0; j < level[i].length; j++) { if (in_file.hasNextInt()) { if (in_file.nextInt() == 0) level[i][j] = '-'; else if (in_file.nextInt() == 1) level[i][j] = '#'; } } } in_file.close(); } public void new_game() { } public void main_game() { for (int i = 0; i < 20; i++) { for (int j = 0; j < 50; j++) { System.out.print(level[i][j]); } } } public void save_game() { } } My text file, "level.txt": 11111 10001 10001 10001 11111
0
11,471,965
07/13/2012 13:57:27
1,084,133
12/06/2011 18:36:34
266
40
IE (internet exploder) ajax issue with json
Okay i've bashed my head over this enough so I'm resorting to asking the hive :p I'm using google custom searches rest api with jquery to get results and build out the results for the browser the issue I'm having is in ie this function does nothing i get a jqXHR response of 0 i checked in ie's debug bar and when looking at network traffic its attempting to hit "https:///" instead of the url provided in the ajax call can anyone please help me in solving this? Specifics: IE Version: 8 (i know my company is retorted don't ask...) Code: //init varables for getResults var currentIndex; var nextIndex; var prevIndex; var totalResults; var urlParams = parseParamsFromUrl(); var queryParamName = "q"; function getResults(startIndex) { //clear results for new dataset $('.results').html(''); // debugger; $.ajax({ url: 'https://www.googleapis.com/customsearch/v1', data: { key: 'AIzaSyBsiF3yLVphOd6c74PYOA-02iJx6dlmQuI', cx: '003411025563286140424:apyyekjazdi', q: urlParams[queryParamName], start: startIndex }, success: function (data) { //set some variables for later use. currentIndex = data.queries.request[0]['startIndex']; nextIndex = data.queries.nextPage[0]['startIndex']; totalResults = data.searchInformation.totalResults; // debugger; //if there are 0 results return nothing found if (totalResults === '0') { $('.results').html('<h3 class="three column centered">No results found!</h3>'); } //check if theres more than 10 results to show the next button if (totalResults > 10) { $('.next').removeClass('hide'); } if (currentIndex !== 1) { prevIndex = data.queries.previousPage[0]['startIndex']; } //if current index is 1 hide previous button if (currentIndex > 1) { $('.prev').removeClass('hide'); } else { $('.prev').addClass('hide'); } //hide query status $('.resultspinner').hide(); //loop through all promotion results and add before regulars var promoresult; if (typeof data.promotions != 'undefined') { //show promotions div $('.promotions').show(); $.each(data.promotions, function (index, value) { //check if promotion has a description if so set it in the result var promotionbody; if (typeof value.bodyLines !== 'undefined') { promotionbody = value.bodyLines['0']['htmlTitle']; } else { promotionbody = ''; } //check if result has an image if so show in results if not display default if (typeof value.image == 'undefined') { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img src="http://www.insp.com/wp-content/themes/insp_foundation/images/thumbnail.jpg" />\n\ </a>\n\ </div>'; } else { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img width="120" src="' + value.image.source + '" />\n\ </a>\n\ </div>'; } //build layout for result var promoresult = '\n\ <div class="search-result row promotion" id="post-' + index + '">\n\ ' + thumbnail + '\n\ \n\ <div class="post-entry nine columns" >\n\ <h3 class="posttitle">\n\ <a href="' + value.link + '"> ' + value.title + '</a>\n\ </h3>\n\ \n\ <div class="entry">\n\ ' + promotionbody + '\n\ </div>\n\ </div>'; $('.promotions').append(promoresult); }); // $('.promotions').prepend('<h4>Promotions: </h4>'); } //loop through all regular results $.each(data.items, function (index, value) { //check if result has an image if so show in results if not display default if (typeof value.pagemap.metatags['0']['og:image'] == 'undefined') { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img src="http://www.insp.com/wp-content/themes/insp_foundation/images/thumbnail.jpg" />\n\ </a>\n\ </div>'; } else { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img width="120" src="' + value.pagemap.metatags['0']['og:image'] + '" />\n\ </a>\n\ </div>'; } //build layout for result var result = '\n\ <div class="search-result row result" id="post-' + index + '">\n\ ' + thumbnail + '\n\ \n\ <div class="post-entry nine columns" >\n\ <h3 class="posttitle">\n\ <a href="' + value.link + '"> ' + value.pagemap.metatags[0]['og:title'] + '</a>\n\ </h3>\n\ \n\ <div class="entry">\n\ ' + value.htmlSnippet + '\n\ </div>\n\ </div>'; //set data to result $('.results').append(result); }); // $('.results').prepend('<h4>Results: </h4>'); }, error: function (jqXHR, exception) { if (jqXHR.status === 0) { alert('Not connect.\n Verify Network.'); } else if (jqXHR.status == 404) { alert('Requested page not found. [404]'); } else if (jqXHR.status == 500) { alert('Internal Server Error [500].'); } else if (exception === 'parsererror') { alert('Requested JSON parse failed.'); } else if (exception === 'timeout') { alert('Time out error.'); } else if (exception === 'abort') { alert('Ajax request aborted.'); } else { alert('Uncaught Error.\n' + jqXHR.responseText); } }, dataType: 'json' }); }
jquery
ajax
json
internet-explorer
google-custom-search
null
open
IE (internet exploder) ajax issue with json === Okay i've bashed my head over this enough so I'm resorting to asking the hive :p I'm using google custom searches rest api with jquery to get results and build out the results for the browser the issue I'm having is in ie this function does nothing i get a jqXHR response of 0 i checked in ie's debug bar and when looking at network traffic its attempting to hit "https:///" instead of the url provided in the ajax call can anyone please help me in solving this? Specifics: IE Version: 8 (i know my company is retorted don't ask...) Code: //init varables for getResults var currentIndex; var nextIndex; var prevIndex; var totalResults; var urlParams = parseParamsFromUrl(); var queryParamName = "q"; function getResults(startIndex) { //clear results for new dataset $('.results').html(''); // debugger; $.ajax({ url: 'https://www.googleapis.com/customsearch/v1', data: { key: 'AIzaSyBsiF3yLVphOd6c74PYOA-02iJx6dlmQuI', cx: '003411025563286140424:apyyekjazdi', q: urlParams[queryParamName], start: startIndex }, success: function (data) { //set some variables for later use. currentIndex = data.queries.request[0]['startIndex']; nextIndex = data.queries.nextPage[0]['startIndex']; totalResults = data.searchInformation.totalResults; // debugger; //if there are 0 results return nothing found if (totalResults === '0') { $('.results').html('<h3 class="three column centered">No results found!</h3>'); } //check if theres more than 10 results to show the next button if (totalResults > 10) { $('.next').removeClass('hide'); } if (currentIndex !== 1) { prevIndex = data.queries.previousPage[0]['startIndex']; } //if current index is 1 hide previous button if (currentIndex > 1) { $('.prev').removeClass('hide'); } else { $('.prev').addClass('hide'); } //hide query status $('.resultspinner').hide(); //loop through all promotion results and add before regulars var promoresult; if (typeof data.promotions != 'undefined') { //show promotions div $('.promotions').show(); $.each(data.promotions, function (index, value) { //check if promotion has a description if so set it in the result var promotionbody; if (typeof value.bodyLines !== 'undefined') { promotionbody = value.bodyLines['0']['htmlTitle']; } else { promotionbody = ''; } //check if result has an image if so show in results if not display default if (typeof value.image == 'undefined') { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img src="http://www.insp.com/wp-content/themes/insp_foundation/images/thumbnail.jpg" />\n\ </a>\n\ </div>'; } else { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img width="120" src="' + value.image.source + '" />\n\ </a>\n\ </div>'; } //build layout for result var promoresult = '\n\ <div class="search-result row promotion" id="post-' + index + '">\n\ ' + thumbnail + '\n\ \n\ <div class="post-entry nine columns" >\n\ <h3 class="posttitle">\n\ <a href="' + value.link + '"> ' + value.title + '</a>\n\ </h3>\n\ \n\ <div class="entry">\n\ ' + promotionbody + '\n\ </div>\n\ </div>'; $('.promotions').append(promoresult); }); // $('.promotions').prepend('<h4>Promotions: </h4>'); } //loop through all regular results $.each(data.items, function (index, value) { //check if result has an image if so show in results if not display default if (typeof value.pagemap.metatags['0']['og:image'] == 'undefined') { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img src="http://www.insp.com/wp-content/themes/insp_foundation/images/thumbnail.jpg" />\n\ </a>\n\ </div>'; } else { var thumbnail = '\n\ <div class="thumb-box three column"> \n\ <a href="' + value.link + '">\n\ <img width="120" src="' + value.pagemap.metatags['0']['og:image'] + '" />\n\ </a>\n\ </div>'; } //build layout for result var result = '\n\ <div class="search-result row result" id="post-' + index + '">\n\ ' + thumbnail + '\n\ \n\ <div class="post-entry nine columns" >\n\ <h3 class="posttitle">\n\ <a href="' + value.link + '"> ' + value.pagemap.metatags[0]['og:title'] + '</a>\n\ </h3>\n\ \n\ <div class="entry">\n\ ' + value.htmlSnippet + '\n\ </div>\n\ </div>'; //set data to result $('.results').append(result); }); // $('.results').prepend('<h4>Results: </h4>'); }, error: function (jqXHR, exception) { if (jqXHR.status === 0) { alert('Not connect.\n Verify Network.'); } else if (jqXHR.status == 404) { alert('Requested page not found. [404]'); } else if (jqXHR.status == 500) { alert('Internal Server Error [500].'); } else if (exception === 'parsererror') { alert('Requested JSON parse failed.'); } else if (exception === 'timeout') { alert('Time out error.'); } else if (exception === 'abort') { alert('Ajax request aborted.'); } else { alert('Uncaught Error.\n' + jqXHR.responseText); } }, dataType: 'json' }); }
0
11,471,966
07/13/2012 13:57:34
1,350,895
04/23/2012 08:58:22
1
0
warning: 'UITabBarController' may not respond to 'select Tab:'
warning: 'UITabBarController' may not respond to 'select Tab:' I am always getting a warning message like this in xcode 4.2 is there any possibilities to remove this warning
xcode
null
null
null
null
null
open
warning: 'UITabBarController' may not respond to 'select Tab:' === warning: 'UITabBarController' may not respond to 'select Tab:' I am always getting a warning message like this in xcode 4.2 is there any possibilities to remove this warning
0
11,471,970
07/13/2012 13:57:41
1,494,826
07/01/2012 22:15:22
1
0
API Facebook:invite multiple users to a event ERROR
How i can get who blocked my invitations? if i invite users friends to my event a get a error because someone blocked my invitation a than nobody of friends will invite... thx for your help...sorry for my "ENGLISH" you can answer also on Germany and Russia
php
facebook-graph-api
facebook-javascript-sdk
facebook-php-sdk
facebook-rest-api
07/14/2012 05:07:52
not a real question
API Facebook:invite multiple users to a event ERROR === How i can get who blocked my invitations? if i invite users friends to my event a get a error because someone blocked my invitation a than nobody of friends will invite... thx for your help...sorry for my "ENGLISH" you can answer also on Germany and Russia
1
11,471,971
07/13/2012 13:57:45
1,196,822
02/08/2012 09:54:14
8
0
Diplaying round corners in Android browser
I have problem with displaying round edges in Android browser (in Samsung Galaxy Tab). However, it works fine in IOS browser (in iPad and iPhone i.e, Safari). As shown in the following image Link to the image [Round corner display problem in Android browser](http://www.flickr.com/photos/82568586@N06/7561811678/in/photostream/lightbox/) Below is the code <!DOCTYPE html> <html> <head> <title>Sample App</title> <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0,user-scalable=false"> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="javascript/cordova-1.8.0.js"></script> <script type="text/javascript" src="javascript/precache.js"></script> <script type="text/javascript" src="javascript/common.js"></script> <script type="text/javascript" src="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js"></script> </head> <body> <div data-role="page" data-theme="c" id="front"> <div data-theme="b" id="search-container"> <form id="search-field" action="" method="get" data-ajax="false"> <input type="search" name="search" value="" /> </form> </div> </div><!-- /page --> </body> </html> I am not sure if I have to override the default jQuery Mobile styling. If so can anyone let me know the configuration I have to override or if there is any other solution to overcome this issue. Thanks in advance
android
jquery-mobile
rounded-corners
android-browser
null
null
open
Diplaying round corners in Android browser === I have problem with displaying round edges in Android browser (in Samsung Galaxy Tab). However, it works fine in IOS browser (in iPad and iPhone i.e, Safari). As shown in the following image Link to the image [Round corner display problem in Android browser](http://www.flickr.com/photos/82568586@N06/7561811678/in/photostream/lightbox/) Below is the code <!DOCTYPE html> <html> <head> <title>Sample App</title> <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0,user-scalable=false"> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="javascript/cordova-1.8.0.js"></script> <script type="text/javascript" src="javascript/precache.js"></script> <script type="text/javascript" src="javascript/common.js"></script> <script type="text/javascript" src="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js"></script> </head> <body> <div data-role="page" data-theme="c" id="front"> <div data-theme="b" id="search-container"> <form id="search-field" action="" method="get" data-ajax="false"> <input type="search" name="search" value="" /> </form> </div> </div><!-- /page --> </body> </html> I am not sure if I have to override the default jQuery Mobile styling. If so can anyone let me know the configuration I have to override or if there is any other solution to overcome this issue. Thanks in advance
0
11,471,939
07/13/2012 13:55:51
1,523,709
07/13/2012 13:42:34
1
0
SQL - commit only if dataset changes
I`m pulling some data from a website and would like to write it into an sql-db. 14:30 Data_1 14:31 Data_1 14:32 Data_1 14:33 Data_2 Most of the time the data is static so I only commit if the data changes. 14:30 Data_1 14:33 Data_2 The problem with this is that I do miss the last timestamp before the dataset changed: 14:30 Data_1 14:32 Data_1 14:33 Data_2 Is there an elegant way to do this in sql? Thanks a lot, Achim
sql
commit
null
null
null
null
open
SQL - commit only if dataset changes === I`m pulling some data from a website and would like to write it into an sql-db. 14:30 Data_1 14:31 Data_1 14:32 Data_1 14:33 Data_2 Most of the time the data is static so I only commit if the data changes. 14:30 Data_1 14:33 Data_2 The problem with this is that I do miss the last timestamp before the dataset changed: 14:30 Data_1 14:32 Data_1 14:33 Data_2 Is there an elegant way to do this in sql? Thanks a lot, Achim
0
11,471,977
07/13/2012 13:58:06
278,739
02/22/2010 14:14:01
361
25
Fatal error: Class 'Memcached' not found in /my/path
When I try : $mc= new Memcached(); I get Fatal error: Class 'Memcached' not found in /my/path phpinfo says that /etc/php5/apache2/conf.d/20-memcached.ini is loaded as an additional .ini file. The content of this file is this one : ; uncomment the next line to enable the module extension=memcached.so dpkg --get-selections | grep memcached libmemcached6 install memcached install php5-memcached install Kubuntu Apache 2.0 php 5.4.4-1 Why do I have this fatal error ?
php
memcached
fatal-error
null
null
null
open
Fatal error: Class 'Memcached' not found in /my/path === When I try : $mc= new Memcached(); I get Fatal error: Class 'Memcached' not found in /my/path phpinfo says that /etc/php5/apache2/conf.d/20-memcached.ini is loaded as an additional .ini file. The content of this file is this one : ; uncomment the next line to enable the module extension=memcached.so dpkg --get-selections | grep memcached libmemcached6 install memcached install php5-memcached install Kubuntu Apache 2.0 php 5.4.4-1 Why do I have this fatal error ?
0