pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
35,479,689 | 0 | <p>The values are in double and are shown in exponential form so they are shown as lon = 1.371864733333333e+02, lat=36.694250000000004</p> <p>You could reduce the length of numbers after the decimal point.</p> <p>Assuming you're using java you can use the following code to round off the number to 7 decimal places.</p> <pre><code>double lon = 137.186473333333; double lat = 36.694250000000004; DecimalFormat numberFormat = new DecimalFormat(); numberFormat.setRoundingMode(RoundingMode.CEILING); numberFormat.setMaximumFractionDigits(7); numberFormat.setParseIntegerOnly(true); numberFormat.setGroupingUsed(false); lon = Double.parseDouble(numberFormat.format(lon)); lat = Double.parseDouble(numberFormat.format(lat)); String url = "maps.google.com/?q="+lat+","lon; </code></pre> <p>The value in url will be <a href="http://maps.google.com/?q=36.6942500,137.1864733" rel="nofollow">maps.google.com/?q=36.6942500,137.1864733 </a> </p> <p>Even if you require high precision in location 7 decimal places are more than sufficient. </p> |
38,774,618 | 0 | <p>You're setting a foreign key for <code>cards</code> table with the column <code>user_id</code>. But you haven't created a reference yet. Create a reference and then add foreign key to maintain referential integrity. Rollback and modify your migration with</p> <pre><code>1 class AddUserIdToCard < ActiveRecord::Migration[5.0] 2 def change 3 add_reference :cards, :users, index:true 4 add_foreign_key :cards, :users 5 end 6 end </code></pre> <p>Line 3 will create, in the <code>cards</code> table, a reference to <code>id</code> in the <code>users</code> table (by creating a <code>user_id</code> column in <code>cards</code>).</p> <p>Line 4 will add a foreign key constraint to <code>user_id</code> at the database level.</p> <p>For more, read <a href="http://stackoverflow.com/questions/22815009/add-a-reference-column-migration-in-rails-4">Add a reference column migration in Rails 4</a></p> |
38,705,646 | 0 | Can a pure function return a Symbol? <p>This may border on philosophical, but I thought it would be the right place to ask.</p> <p>Suppose I have a function that creates a list of IDs. These identifiers are only used internally to the application, so it is acceptable to use ES2015 <code>Symbol()</code> here.</p> <p>My problem is that, <em>technically</em>, when you ask for a Symbol, I'd imagine the JS runtime creates a unique identifier (random number? memory address? unsure) which, to prevent collisions, would require accessing global state. The reason I'm unsure is because of that word, "technically". I'm not sure (again, from a philosophical standpoint) if this ought to be enough to break the mathematical abstraction that the API presents.</p> <p><strong>tl;dr:</strong> here's an example--</p> <pre><code>function sentinelToSymbol(x) { if (x === -1) return Symbol(); return x; } </code></pre> <p><em>Is this function pure?</em></p> |
12,270,530 | 0 | <p>With VS2012 or with the VS2010 extension mentioned at <a href="http://blogs.msdn.com/b/webdev/archive/2012/06/15/visual-studio-2010-web-publish-updates.aspx" rel="nofollow">http://blogs.msdn.com/b/webdev/archive/2012/06/15/visual-studio-2010-web-publish-updates.aspx</a>, you can create per-profile transforms. There isn't yet tooling to generate the transform files in the IDE, but you can copy one of the existing transform files (e.g. Web.Release.config) and include it in your project.</p> |
19,028,491 | 0 | <p>Why do you use Task.Run? that start a new worker thread (cpu bound), and it causes your problem.</p> <p>you should probably just do that:</p> <pre><code> private async Task Run() { await File.AppendText("temp.dat").WriteAsync("a"); label1.Text = "test"; } </code></pre> <p>await ensure you will continue on the same context except if you use .ConfigureAwait(false);</p> |
19,724,570 | 0 | Silex double form <p>I'm currently using Silex2 FormFactory to build a form and I stumbled on a problem.</p> <p>I have a login page (login.twig), asking for email and a password. This form includes the validation. But I want to have this login form always in my header too (on my layout.twig ). I created the form and linked the action to the location of the login page. I had to manualy write the correct id and name of each input element, and I copied the generated token of the login.twig inside the form. But I doubt this is the correct way to do it?</p> <pre><code><form class="navbar-form pull-right" action="{{ path('auth.login') }}" method="post" novalidate="novalidate">{# disables HTML5 formchecking #} <input class="span2" type="text" id="loginform_email" name="loginform[email]" placeholder="Email"> <input class="span2" type="password" id="loginform_password" name="loginform[password]" placeholder="Password"> <input id="loginform__token" type="hidden" value="9eb2a291d32d114987aee1548da878201dd79a7b" name="loginform[_token]"> <button class="btn" type="submit">Sign in</button> <a href="{{ path('auth.register') }}">register here</a> </form> </code></pre> |
24,278,474 | 0 | containsKey check for hashmap <p>I have read multiple posts to understand this, but I can't seem to quite get in on why we do a check if a map does not contain a key before performing a put operation? For eg,</p> <pre><code> if(!myMap.containsKey(myKey) { myMap.put(myKey,myValue); } </code></pre> <p>Why do we need this check? Either way, map doesn't allow duplicate key, and replaces the key with the new value if the key already exists. So why do we need to check this explicitly? Is this check needed for all implementations of Map? I am sorry if this is a very basic question. I can't seem to find an answer to this exact question. If there are posts that answer this that I may have missed, please point me to them, and feel free to mark mine as duplicate.</p> |
33,488,666 | 0 | Path.GetFullPath returning wrong path in C# <p>According to the MSDN docs, to get the full file path of a file use</p> <pre><code>var fileName = Path.GetFullPath("KeywordsAndPhrases.txt"); </code></pre> <p>Which I would assume delivers the full path of that file for the project it is in.</p> <blockquote> <p>'K:\HeadlineAutoTrader\Autotrader.Infrastructure.HeadlineFeeds\Data\KeywordsAndPhrases.txt'</p> </blockquote> <p>Which it doesn't, it returns;</p> <blockquote> <p>'K:\HeadlineAutoTrader\AutotraderTests\bin\Debug\Data\KeywordsAndPhrases.txt'</p> </blockquote> <p>which somewhat makes sense as the code I'm testing is being run in the test project.</p> <p>So the question is how does one get the full filepath of a text file in a folder in another class library within the same solution?</p> <p>This is a WPF based project, obviously it would be easier in a web app as Server.MapPath works great</p> |
37,538,349 | 0 | <p>To answer it myself, yes. DJ will restart the current processes properly, all in their own place.</p> <pre><code>2016-05-31T06:25:59+0000: [Worker(delayed_job host:*** pid:699)] Exiting... 2016-05-31T06:26:03+0000: [Worker(delayed_job host:*** pid:709)] Exiting... 2016-05-31T06:26:05+0000: [Worker(delayed_job host:*** pid:716)] Exiting... 2016-05-31T06:26:10+0000: [Worker(delayed_job host:*** pid:723)] Exiting... 2016-05-31T06:26:16+0000: [Worker(delayed_job host:*** pid:29890)] Starting job worker 2016-05-31T06:26:16+0000: [Worker(delayed_job host:*** pid:29897)] Starting job worker 2016-05-31T06:26:16+0000: [Worker(delayed_job host:*** pid:29915)] Starting job worker 2016-05-31T06:26:16+0000: [Worker(delayed_job host:*** pid:29907)] Starting job worker </code></pre> <p>Something like that.</p> |
2,820,257 | 0 | <p>That error occurs after a fatal error ( anywhere ), but I think it happens only in older versions of Kohana3. Delete your cookies after this occurs.</p> <p>Try downloading the <a href="http://kohanaframework.org/download/kohana-latest" rel="nofollow noreferrer">latest version of Kohana 3 again</a></p> <p>EDIT:</p> <p>You can get more info on this bug <a href="http://forum.kohanaframework.org/comments.php?DiscussionID=4606&Focus=34920" rel="nofollow noreferrer">here</a></p> |
11,514,918 | 0 | EclipseLink Profiler shows multiple registered object being created <p>In my development environment when i run a ReadAllQuery using a simple get all JQPL query, i noticed after using the EL profiler that there several read object queries that get executed each adding time to my total time. For example, running a query like this returns the following eclipse profile output.</p> <pre><code>@SuppressWarnings("unchecked") public List<Person> getAllPeople(){ EntityManager entityManager = factory.createEntityManager(); List<Person> people = null; try { people = entityManager.createQuery("Select p from Person p where p.active = true").getResultList(); } catch (Exception e) { // TODO: handle exception } finally{ entityManager.close(); if (entityManager.isOpen()) { } } </code></pre> <p>Returns multiple <code>Register the existing object</code> statements and looking at the log output each is being done in a unit of work, why and how can i prevent these?</p> <pre><code>[EL Finest]: connection: 2012-07-16 20:21:26.558--ServerSession(1144634498)--Connection(1713234840)--Thread(Thread["http-bio-8080"-exec-14,5,main])--Connection released to connection pool [read]. Profile(ReadAllQuery, class=org.bixin.dugsi.domain.ApplicantSchool, number of objects=2, total time=3494000, local time=3494000, profiling time=84000, Timer:Logging=412000, Timer:ObjectBuilding=1670000, Timer:SqlPrepare=24000, Timer:ConnectionManagement=215000, Timer:StatementExecute=455000, Timer:Caching=68000, Timer:DescriptorEvents=9000, Timer:RowFetch=97000, time/object=1747000, ) }End profile Register the existing object Address[id=5,persons={[Applicant[major=Bachelors in Islamic Studies,nativeLanguage=<null>,ethnicity=<null>,hispanic=<null>,religiousAffiliation=<null>,schools={[ApplicantSchool[id=8,name=John Hopkisn,fromMonth=May,fromYear=2013,toMonth=March,toYear=2011,schoolType=Highschool,creditsCompleted=unavailable,gpa=unavailable,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>], ApplicantSchool[id=7,name=,fromMonth=<null>,fromYear=<null>,toMonth=<null>,toYear=<null>,schoolType=College,creditsCompleted=,gpa=,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>]]},FirstName=warsame,MiddleName=a,LastName=bashir,primaryTelephone=2342342333,secondaryTelephone=,[email protected],birthDay=Sun Jul 22 00:00:00 CDT 2012,gender=Male,DateAdded=Fri Jul 13 18:16:33 CDT 2012,address=<null>,imagePath=<null>,active=true,marital=Single,school=<null>,nativeLanguage=Arabic,ethnicity=[Asian],hispanic=No,religiousAffiliation=Islam,id=651,version=1,_persistence_school_vh={null},_persistence_address_vh={Address[id=5,persons=org.eclipse.persistence.indirection.IndirectSet@47f322c8,streetAddress=243 city join,streetAddress2=<null>,city=saudi,state_us=South Carolina (SC),zipCode=24234,country=Antarctica,version=1,_persistence_fetchGroup=<null>]},_persistence_fetchGroup=<null>]]},streetAddress=243 city join,streetAddress2=<null>,city=saudi,state_us=South Carolina (SC),zipCode=24234,country=Antarctica,version=1,_persistence_fetchGroup=<null>] Profile( total time=5000, local time=5000, Timer:DescriptorEvents=5000, ) Profile( total time=196000, local time=196000, Timer:Register=196000, ) [EL Finest]: transaction: 2012-07-16 20:21:26.564--UnitOfWork(26103836)--Thread(Thread["http-bio-8080"-exec-14,5,main])--Register the existing object Applicant[major=Bachelors in Islamic Studies,nativeLanguage=<null>,ethnicity=<null>,hispanic=<null>,religiousAffiliation=<null>,schools={[ApplicantSchool[id=8,name=John Hopkisn,fromMonth=May,fromYear=2013,toMonth=March,toYear=2011,schoolType=Highschool,creditsCompleted=unavailable,gpa=unavailable,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>], ApplicantSchool[id=7,name=,fromMonth=<null>,fromYear=<null>,toMonth=<null>,toYear=<null>,schoolType=College,creditsCompleted=,gpa=,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>]]},FirstName=warsame,MiddleName=a,LastName=bashir,primaryTelephone=2342342333,secondaryTelephone=,[email protected],birthDay=Sun Jul 22 00:00:00 CDT 2012,gender=Male,DateAdded=Fri Jul 13 18:16:33 CDT 2012,address=<null>,imagePath=<null>,active=true,marital=Single,school=<null>,nativeLanguage=Arabic,ethnicity=[Asian],hispanic=No,religiousAffiliation=Islam,id=651,version=1,_persistence_school_vh={null},_persistence_address_vh={Address[id=5,persons={[Applicant[major=Bachelors in Islamic Studies,nativeLanguage=<null>,ethnicity=<null>,hispanic=<null>,religiousAffiliation=<null>,schools={[ApplicantSchool[id=8,name=John Hopkisn,fromMonth=May,fromYear=2013,toMonth=March,toYear=2011,schoolType=Highschool,creditsCompleted=unavailable,gpa=unavailable,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>], ApplicantSchool[id=7,name=,fromMonth=<null>,fromYear=<null>,toMonth=<null>,toYear=<null>,schoolType=College,creditsCompleted=,gpa=,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>]]},FirstName=warsame,MiddleName=a,LastName=bashir,primaryTelephone=2342342333,secondaryTelephone=,[email protected],birthDay=Sun Jul 22 00:00:00 CDT 2012,gender=Male,DateAdded=Fri Jul 13 18:16:33 CDT 2012,address=<null>,imagePath=<null>,active=true,marital=Single,school=<null>,nativeLanguage=Arabic,ethnicity=[Asian],hispanic=No,religiousAffiliation=Islam,id=651,version=1,_persistence_school_vh={null},_persistence_address_vh=org.eclipse.persistence.internal.indirection.QueryBasedValueHolder@6b8099d3,_persistence_fetchGroup=<null>]]},streetAddress=243 city join,streetAddress2=<null>,city=saudi,state_us=South Carolina (SC),zipCode=24234,country=Antarctica,version=1,_persistence_fetchGroup=<null>]},_persistence_fetchGroup=<null>] Profile( total time=1349000, local time=1349000, Timer:Logging=1349000, ) </code></pre> |
40,285,494 | 0 | Change color of blank lines - Netbeans <p>I'm getting a weird coloration with my theme in Netbeans and don't know what is the parameter that can set that. It happen only with blank lines (without any charact on it). Does anyone know how i can set that to "Inherit" ?</p> <p><a href="https://i.stack.imgur.com/YYrJW.png" rel="nofollow"><img src="https://i.stack.imgur.com/YYrJW.png" alt="Netbeans weird coloration"></a></p> <p>Thaaaanks :)</p> |
26,274,833 | 0 | <p><code>''</code> is again <code>NULL</code> in Oracle. because Oracle doesnt support empty Strings just like Other High Level languages or DBMS..</p> <p>You need to look for NULL values using <code>IS NULL</code> or <code>IS NOT NULL</code></p> <p>No, other relational operators work against <code>NULL</code>, though it is syntactically valid. <a href="http://sqlfiddle.com/#!4/d41d8/36233" rel="nofollow">SQLFiddle Demo</a></p> <p>It has to be,</p> <pre><code>select * from example_so where mycol IS NULL </code></pre> <p><strong>EDIT:</strong> As per <a href="http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements005.htm" rel="nofollow">Docs</a></p> <blockquote> <p>Oracle Database currently treats a character value with a length of zero as null. However, this may not continue to be true in future releases, and Oracle recommends that you do not treat empty strings the same as nulls.</p> </blockquote> |
6,363,893 | 0 | Separate debug/release output in FlashDevelop <p>I want to have separate output directories for debug and release builds. However, I don't see any proper option in FlashDevelop. Is this thing achievable, and if so, how to do this? If not, how to determine if current build is compiled as debug or release?</p> |
23,609,178 | 0 | <p>As IntelliJ IDEA suggest when extracting constant - make static inner class. This approach works:</p> <pre><code>@RequiredArgsConstructor public enum MyEnum { BAR1(Constants.BAR_VALUE), FOO("Foo"), BAR2(Constants.BAR_VALUE), ..., BARn(Constants.BAR_VALUE); @Getter private final String value; private static class Constants { public static final String BAR_VALUE = "BAR"; } } </code></pre> |
39,550,695 | 0 | How get array value by key in javascript <p>I am getting following <em>javascript</em> array and i need to get value of that array by key. Any suggestion will be appreciated.</p> <pre><code>[Object { 5=7224}, Object { 10=7225}, Object { 25=7226}, Object { 50=7227}] </code></pre> <p>I have created following code - </p> <pre><code>'payment_tariff': { 4142: { 1: [{1: 7223}], 2: [{5: 7224}, {10: 7225}, {25: 7226}, {50: 7227}], 3: [{10: 7228}, {20: 7229}, {50: 7230}, {100: 7231}], 4: [{25: 7232}, {50: 7233}, {100: 7234}, {250: 7235}], 5: [{25: 7236}, {50: 7237}, {100: 7238}, {250: 7239}] } , 4130: { 1: [{1: 7132}], 2: [{5: 7133}, {10: 7134}, {25: 7135}, {50: 7136}], 3: [{10: 7137}, {25: 7138}, {50: 7139}, {100: 7140}], 4: [{25: 7141}, {50: 7142}, {100: 7143}, {250: 7144}], 5: [{25: 7145}, {50: 7146}, {100: 7147}, {250: 7148}] } , 4133: { 1: [{1: 7166}], 2: [{5: 7167}, {10: 7168}, {25: 7169}, {50: 7170}], 3: [{10: 7171}, {25: 7172}, {50: 7173}, {100: 7173}], 4: [{25: 7174}, {50: 7175}, {100: 7176}, {250: 7177}], 5: [{25: 7178}, {50: 7179}, {100: 7180}, {250: 7181}] } , 4134: { 1: [{1: 7188}], 2: [{5: 7189}, {10: 7190}, {25: 7191}, {50: 7192}], 3: [{10: 7193}, {25: 7194}, {50: 7195}, {100: 7298}], 4: [{25: 7197}, {50: 7198}, {100: 7199}, {250: 7200}], 5: [{25: 7201}, {50: 7202}, {100: 7203}, {250: 7204}] } , 4135: { 1: [{1: 7206}], 2: [{5: 7207}, {10: 7208}, {25: 7209}, {50: 7210}], 3: [{10: 7211}, {25: 7212}, {50: 7213}, {100: 7214}], 4: [{25: 7215}, {50: 7216}, {100: 7217}, {250: 7218}], 5: [{25: 7219}, {50: 7220}, {100: 7221}, {250: 7222}] } } </code></pre> <p>I am getting dynamic value of payment_tariff's keys</p> <p>For example, I need to get value of key 5, Where key is some value that will be further processed. </p> |
16,117,699 | 0 | Unable to obtain JDBC connection from datasource <p>I was trying to run the following command in gradle and it gave me the following error :</p> <pre><code> c:\gsoc\mifosx\mifosng-provider>gradle migrateTenantListDB -PdbName=mifosplatfor m-tenants Listening for transport dt_socket at address: 8005 :migrateTenantListDB FAILED FAILURE: Build failed with an exception. * Where: Build file 'C:\gsoc\mifosx\mifosng-provider\build.gradle' line: 357 * What went wrong: Execution failed for task ':flywayMigrate'. > Unable to obtain Jdbc connection from DataSource * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 13.843 secs </code></pre> <p>The script file is here and the line no. of error is shown as 357 but I dont know why it is showing me an error. Is it something about incorrect configuration in mysql server please help me out here: script:</p> <pre><code>task migrateTenantListDB<<{ description="Migrates a Tenant List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)" def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db' def tenantsDbName = 'mifosplatform-tenants'; if (rootProject.hasProperty("dbName")) { tenantsDbName = rootProject.getProperty("dbName") } flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName" flyway.locations= [filePath] flywayMigrate.execute() } </code></pre> |
32,721,031 | 0 | <p>You can call Activity method by using instance of Activity like this, inside MainActivity write below code </p> <pre><code>mDeviceListAdapter = new DeviceListAdapter(MainActivity.this); </code></pre> <p>Inside Adapter</p> <pre><code> private MainActivity _mainActivity; public DeviceListAdapter(MainActivity activity){ this._mainActivity=activity; } </code></pre> <p>Inside your onClick method</p> <pre><code> _mainActivity.yourActivityMethod(address); </code></pre> |
26,835,497 | 0 | <p>If you want to assign the result to a <code>List(Of String)</code> variable then you need a <code>List(Of String)</code> object. You can all <code>ToList</code> on any enumerable list to create a <code>List(Of T)</code>.</p> <p>Also, your <code>AsEnumerable</code> call is pointless because <code>Cast(Of T)</code> already returns an <code>IEnumerable(Of T)</code>.</p> <p>Finally, declaring a variable on one line and then setting its value is so unnecessarily verbose. It's not wrong but it is pointless. In your case, not only are you declaring a variable but you're also creating an object that you never use. Don't create a <code>New</code> object if you don;t actually want a new object, which you don;t because you're getting an object on the very next line.</p> <pre><code>Dim list As List(Of String) = chkparameter.Items. Cast(Of ListItem). Where(Function(x) x.Selected). Select(Function(x) x.Value). ToList() </code></pre> <p>There's also no need to declare the type of the variable because it will be inferred from the initialising expression, i.e. <code>ToList</code> returns a <code>List(Of String)</code> so the type of the variable can be inferred from that. Not everyone likes to use type inference where it's not completely obvious though, so I'll let you off that one. I'd tend to do this though:</p> <pre><code>Dim list = chkparameter.Items. Cast(Of ListItem). Where(Function(x) x.Selected). Select(Function(x) x.Value). ToList() </code></pre> <p>By the way, notice how much easier the code is to read with some sensible formatting? If you're going to use chained function syntax like that, it's a very good idea to put each function on a different line once you get more than two or three.</p> |
27,788,994 | 0 | <p>You can download the Visual FoxPro runtime installers here:</p> <p><a href="http://vfpx.codeplex.com/releases/view/194354" rel="nofollow">http://vfpx.codeplex.com/releases/view/194354</a></p> <p>Versions available for downlaod are:</p> <pre><code>VFP6 SP5 VFP7 SP1 VFP8 SP1 VFP9 SP2 </code></pre> |
38,750,310 | 0 | Having selected data from one datagrid be displayed on another datagrid <p>I am trying to select one customer from a datagrid and then have that customers name be displayed in a list of customers that are being seen that day </p> <p>Here is the XAML:</p> <pre><code><Grid Name="gridListOfAllCustomers" Visibility="Collapsed" Margin="235,26,-740,56" Grid.Row="3" Grid.RowSpan="4" Grid.Column="1"> <DataGrid Name="dataGridListOfAllCustomers" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding Customer}" SelectionChanged="dataGridListOfAllCustomers_SelectionChanged"> <DataGrid.Columns> <DataGridTextColumn Header="Customer User Name" Binding="{Binding UserName}" Width="*"/> <DataGridTextColumn Header="First Name" Binding="{Binding FirstName}" Width="*"/> <DataGridTextColumn Header="Last Name" Binding="{Binding LastName}" Width="*"/> <DataGridTextColumn Header="Birthday" Binding="{Binding Birthday, StringFormat=\{0:dd/MM/yyyy\}}" Width="*"/> </DataGrid.Columns> </DataGrid> </Grid> </code></pre> <p>^ That grid is the one I am selecting data from</p> <pre><code><Grid Name="gridCustomersOfTheDay" Visibility="Collapsed" Margin="10,2,2,42" Grid.Row="4" Grid.RowSpan="4" Grid.ColumnSpan="2"> <Grid.RowDefinitions> <RowDefinition Height="7*"/> <RowDefinition Height="1*"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> <DataGrid Name="dataGridCustomersToday" IsReadOnly="True" AutoGenerateColumns="True" Grid.Row="0" AutoGeneratingColumn="dataGridCustomersToday_AutoGeneratingColumn"/> <Button Name="btnEditCustomersToday" Content="Edit List" Grid.Row="1"/> <Button Name="btnClearCustomers" Content="Clear List" Grid.Row="2" Click="btnClearCustomers_Click"/> </Grid> </code></pre> <p>^ That Grid should display the data</p> <p>This is what happens when I click the button for todays Customers</p> <pre><code>private void btnCustomersToday_Click(object sender, RoutedEventArgs e) { if (btnCustomersToday.IsChecked == true) { dataGridListOfAllCustomers.Visibility = System.Windows.Visibility.Visible; dataGridCustomersToday.Visibility = System.Windows.Visibility.Visible; } else { dataGridListOfAllCustomers.Visibility = System.Windows.Visibility.Collapse; dataGridCustomersToday.Visibility = System.Windows.Visibility.Collapse; } ResponseBase<List<CustomerInfo>> allCustomers = Data.DataManager.GetCustomerList(""); List<CustomerInfo> listOfAllCustomers = allCustomers.Data; dataGridListOfAllCustomers.ItemsSource = listOfAllCustomers; //Field dataGridCustomersToday.ItemsSource = displayWorkList; //Field } </code></pre> <p>And lastly this is for the selection change</p> <pre><code>private void dataGridListOfAllCustomers_SelectionChanged(object sender, SelectionChangedEventArgs e) { CustomerInfo CustomerForTodayList = (CustomerInfo) dataGridListOfAllCustomers.SelectedItem; if (e.AddedItems.Count == 0) { return; } currentCustomersToday.Add(CustomerForTodayList.UserName); String customerID = CustomerForTodayList.UserName; StringValue addCustomer = new StringValue(customerID); displayWorkList.Add(addCustomer); } </code></pre> <p>So the issue is I click the customer and I have to change the visibility of the second datagrid in order for User name of the customer to appear. Also there is a lag on the second customer for some reason. As in when I select the second customer I also need to select a third customer in order for them to appear (I still need to click). </p> <p>I don't even know what could be possible solutions because my understanding of databinding and datagrids is so limited. I have tried reading the documentation and reading tutorials but no one thoroughly explains path and sources as well as how to make a collections and so. </p> |
36,104,316 | 0 | <p>After a very long time trying all sorts of things, I found an excellent module which addresses exactly this problem. Install and go, not configuration, it just works: <a href="https://www.drupal.org/project/menu_trail_by_path" rel="nofollow">https://www.drupal.org/project/menu_trail_by_path</a></p> <p>Versions for D7 and a Release Candidate for D8.</p> |
21,738,953 | 0 | jQuery grep not working on object array but for loop does <p>I'm following this tutorial here: <a href="http://ddmvc4.codeplex.com/" rel="nofollow">http://ddmvc4.codeplex.com/</a> for knockout.js. This is my first go at javascript but I think I know what I'm doing so far.</p> <p>I have a simple object array like so:</p> <pre><code>var DummyCompetition = [ { "Id": 1, "Sport": 'Powerlifting', "Title": 'Íslandsmeistaramót í klassískum kraftlyftingum', "Country": 'Iceland', "DateStart": new Date(2014, 2, 8), "DateEnd": new Date(2014, 2, 8) }, { "Id": 2, "Sport": 'Powerlifting', "Title": 'Íslandsmeistaramót í kraftlyftingum', "Country": 'Iceland', "DateStart": new Date(2014, 4, 8), "DateEnd": new Date(2014, 4, 8) } ] </code></pre> <p>and I try to filter id in a function like so</p> <pre><code>var currentCompetition = $.grep(DummyCompetition, function (c) { return c.Id == id; }); currentCompetition = new Competition(currentCompetition[0]); </code></pre> <p>where id is obtained from the URL <code>var id = url.substring(url.lastIndexOf('/') + 1);</code></p> <p>If I run my page the javascript won't load but if I filter the array with a for loop everything works fine.</p> <pre><code>for (var i = 0; i < DummyCompetition.length; i++) { if (DummyCompetition[i].Id == id) { var currentCompetition = new Competition(DummyCompetition[i]); break } } </code></pre> <p>What am I doing wrong?</p> |
3,202,374 | 0 | <p>Yes, a class like</p> <pre><code>public Geo { private double lat; private double lon; } </code></pre> <p>is sufficient to store a geographical location. You might want to add setter method to make sure, that lat, lon are always in a valid range, otherwise a Geo object might have an invalid state.</p> |
13,728,797 | 0 | Custom Sort of ObservableCollection<T> with base type <p>I have the following simplified classes:</p> <pre><code>public class BaseContainer { public BaseContainer() { Children = new ObservableCollection<BaseContainer>(); } public ObservableCollection<BaseContainer> Children { get; set; } } public class ItemA : BaseContainer { public ItemA() { base.Children.Add(new ItemB() { ItemBName = "bb" }); base.Children.Add(new ItemA() { ItemAName = "ab" }); base.Children.Add(new ItemB() { ItemBName = "ba" }); base.Children.Add(new ItemA() { ItemAName = "aa" }); } public string ItemAName { get; set; } } public class ItemB : BaseContainer { public string ItemBName { get; set; } } </code></pre> <p>I'm trying to sort my ItemA.Children collection based on two conditions:</p> <ol> <li>All Item A's must come first in the collection</li> <li>Item A's should be sorted by ItemAName</li> <li>Item B's should be sorted by ItemBName</li> </ol> <p>So after sorting I'd expect something like this:</p> <ul> <li>ItemA - ItemAName = "aa"</li> <li>ItemA - ItemAName = "ab"</li> <li>ItemB - ItemBName = "ba"</li> <li>ItemB - ItemBName = "bb"</li> </ul> <p>Any ideas on how to accomplish this?</p> <p>I was able to sort by class type name:</p> <pre><code> List<BaseContainer> temp = base.Children.ToList(); temp.Sort((x, y) => string.Compare(x.GetType().Name, y.GetType().Name)); base.Children.Clear(); base.Children.AddRange(temp); </code></pre> <p>But Names are not sorted...</p> <p>Thanks!</p> |
11,606,561 | 0 | jQuery Mobile changePage not working <p>I'm trying to link to the following html page using </p> <pre><code>$.mobile.changePage( "myPage.html", { transition: "slide"} ); </code></pre> <p>However, it's not working. The page will load however the alert box with the spinning cirlce and "loading" message never disappears and the page never fully loads in its css content. Can anybody see why based on the above call and the html below? Thanks</p> <p><strong>HTML Page</strong></p> <pre><code><!DOCTYPE html> <html> <head> <title>Sign up</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /> <link rel="stylesheet" href="./signup.css"> <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script> <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script> <script> // Global declarations - assignments made in $(document).ready() below var hdrMainvar = null; var contentMainVar = null; var ftrMainVar = null; var contentTransitionVar = null; </script> </head> <body> <!-- Page starts here --> <div data-role="page" data-theme="b" id="page1"> <div data-role="header" id="hdrMain" name="hdrMain" data-nobackbtn="true"> <h1>Classroom Tempo</h1> </div> <div data-role="navbar"> <ul> <li><a href="" data-icon="" data-transition="fade" class="ui-btn-active ui-state-persist">Sign-In</a></li> <li><a href="survey_SignUp.html" rel="external" data-icon="" data-transition="fade">Sign-Up</a></li> </ul> </div> <div data-role="content" id="contentMain" name="contentMain"> <form id="form1"> <div id="optionSliderDiv" data-role="fieldcontain"> <label for="optionSlider">How Many Options?</label> <input type="range" name="optionSlider" id="optionSlider" value="2" min="2" max="25" data-highlight="true" /> </div> <fieldset data-role="controlgroup"> <legend>Numbers or Letters?:</legend> <input type="radio" name="numbersOrLetters" id="Numbers" value="Numbers" checked="checked" /> <label for="Numbers">Numbers</label> <input type="radio" name="numbersOrLetters" id="Letters" value="Letters" /> <label for="Letters">Letters</label> </fieldset> <script> $(document).ready(function() { // Assign global variables hdrMainVar = $('#hdrMain'); contentMainVar = $('#contentMain'); ftrMainVar = $('#ftrMain'); contentTransitionVar = $('#contentTransition'); sliderValue = $('#optionSlider'); surveyDescriptionVar = $('#SurveyDescription') form1Var = $('#form1'); confirmationVar = $('#confirmation'); contentDialogVar = $('#contentDialog'); hdrConfirmationVar = $('#hdrConfirmation'); contentConfirmationVar = $('#contentConfirmation'); ftrConfirmationVar = $('#ftrConfirmation'); inputMapVar = $('input[name*="_r"]'); hideContentDialog(); hideContentTransition(); hideConfirmation(); }); $('#buttonOK').click(function() { hideContentDialog(); //hidePasswordMisMatch(); showMain(); return false; }); $('#form1').submit(function() { var err = false; var passwordError = false; // Hide the Main content hideMain(); console.log(sliderValue.val()); // If validation fails, show Dialog content if(err == true){ console.log("we've got an issue"); showContentDialog(); return false; } $('input[name=OnOff]').each(function() { onOffValue = $('input[name=OnOff]:checked').val(); }) $('input[name=numbersOrLetters]').each(function() { numbersOrLetters = $('input[name=numbersOrLetters]:checked').val(); }) console.log(onOffValue); console.log(numbersOrLetters); // If validation passes, show Transition content showContentTransition(); // Submit the form $.post("http://url", form1Var.serialize(), function(data){ console.log(data); hideContentTransition(); showConfirmation(); }); return false; }); </script> </div> <!-- page1 --> <!-- Page ends here --> </body> </html> </code></pre> |
38,576,264 | 0 | How can I programmatically check if a Google User's profile picture isn't default? <p>A Google User's profile picture defaults to <a href="https://i.stack.imgur.com/34AD2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/34AD2.jpg" alt="https://yt3.ggpht.com/-_fExgATRXLY/AAAAAAAAAAI/AAAAAAAAAAA/-fmo8LhN7Pg/s240-c-k-no-rj-c0xffffff/photo.jpg"></a><code>https://yt3.ggpht.com/-_fExgATRXLY/AAAAAAAAAAI/AAAAAAAAAAA/-fmo8LhN7Pg/s240-c-k-no-rj-c0xffffff/photo.jpg</code></p> <p>I want to check to see if a user has updaed their picture to something besides their default based on the URL for the image. Is that possible? Is there another way to check?</p> <p>EDIT: A URL of a google profile picture that has been set is this: <a href="https://i.stack.imgur.com/SmPuE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SmPuE.jpg" alt="https://yt3.ggpht.com/-zSpYe-dpPNk/AAAAAAAAAAI/AAAAAAAAAAA/EVfQSDPEeQc/s240-c-k-no-rj-c0xffffff/photo.jpg"></a> <code>https://yt3.ggpht.com/-zSpYe-dpPNk/AAAAAAAAAAI/AAAAAAAAAAA/EVfQSDPEeQc/s240-c-k-no-rj-c0xffffff/photo.jpg</code></p> |
4,069,877 | 0 | <p>a good solution with ONE sql-query from <a href="http://henrik.nyh.se/2008/11/rails-jquery-sortables" rel="nofollow">http://henrik.nyh.se/2008/11/rails-jquery-sortables</a></p> <pre><code># in your model: def self.order(ids) update_all( ['ordinal = FIND_IN_SET(id, ?)', ids.join(',')], { :id => ids } ) end </code></pre> |
20,220,180 | 0 | Logging to problems log in eclipse <pre><code>PlatformLogUtil.logAsError(Activator.getDefault(), new Status(IStatus.ERROR, "com.sample.example",enter code here "ERROR")); </code></pre> <p>I am using above code for Logging in eclipse problems log. But it is not visible in problems log but able to see in console.</p> <p>Can any one suggest is it right what i am performing in above code or do i need to do some thing else to view in Problem Log in eclipse.</p> |
40,830,442 | 0 | <p> </p> <p>Select Time : </p> <pre><code> <option value="1^<?php echo date("d/m/y")?>;">09:00 AM</option> <option value="2^<?php echo date("d/m/y")?>;">09:20 AM</option> <option value="3^<?php echo date("d/m/y")?>;">09:40 AM</option> <option value="4^<?php echo date("d/m/y")?>;">10:00 AM</option> <option value="5^<?php echo date("d/m/y")?>;">10:20 AM</option> <option value="6^<?php echo date("d/m/y")?>;">10:40 AM</option> <option value="7^<?php echo date("d/m/y")?>;">11:00 AM</option> <option value="8^<?php echo date("d/m/y")?>;">11:20 AM</option> <option value="9^<?php echo date("d/m/y")?>;">11:40 AM</option> <option value="10^<?php echo date("d/m/y")?>;">12:00 PM</option> <option value="11^<?php echo date("d/m/y")?>;">12:20 PM</option> <option value="12^<?php echo date("d/m/y")?>;">12:40 PM</option> <option value="13^<?php echo date("d/m/y")?>;">01:00 PM</option> <option value="14^<?php echo date("d/m/y")?>;">01:20 PM</option> <option value="15^<?php echo date("d/m/y")?>;">01:40 PM</option> <option value="16^<?php echo date("d/m/y")?>;">02:00 PM</option> <option value="17^<?php echo date("d/m/y")?>;">02:20 PM</option> <option value="18^<?php echo date("d/m/y")?>;">02:40 PM</option> <option value="19^<?php echo date("d/m/y")?>;">03:00 PM</option> <option value="20^<?php echo date("d/m/y")?>;">03:20 PM</option> <option value="21^<?php echo date("d/m/y")?>;">03:40 PM</option> <option value="22^<?php echo date("d/m/y")?>;">04:00 PM</option> <option value="23^<?php echo date("d/m/y")?>;">04:20 PM</option> <option value="24^<?php echo date("d/m/y")?>;">04:40 PM</option> <option value="25^<?php echo date("d/m/y")?>;">05:00 PM</option> <option value="26^<?php echo date("d/m/y")?>;">05:20 PM</option> <option value="27^<?php echo date("d/m/y")?>;">05:40 PM</option> <option value="28^<?php echo date("d/m/y")?>;">06:00 PM</option> <option value="29^<?php echo date("d/m/y")?>;">06:20 PM</option> <option value="30^<?php echo date("d/m/y")?>;">06:40 PM</option> <option value="31^<?php echo date("d/m/y")?>;">07:00 PM</option> <option value="32^<?php echo date("d/m/y")?>;">07:20 PM</option> <option value="33^<?php echo date("d/m/y")?>;">07:40 PM</option> <option value="34^<?php echo date("d/m/y")?>;">08:00 PM</option> <option value="35^<?php echo date("d/m/y")?>;">08:20 PM</option> <option value="36^<?php echo date("d/m/y")?>;">08:40 PM</option> <option value="37^<?php echo date("d/m/y")?>;">09:00 PM</option> <option value="38^<?php echo date("d/m/y")?>;">09:20 PM</option> <option value="39^<?php echo date("d/m/y")?>;">09:40 PM</option> </select> </code></pre> function updateCouponTime(passedValue){ myArray=passedValue.split('^'); document.getElementById('time_id').value=myArray[0]; document.getElementById('date').value=myArray[1]; } |
20,460,401 | 0 | <p>Instead of using <code>.</code>, use a character class matching any character other than <code>|</code>:</p> <pre><code>^.+\|([^|]+)$ </code></pre> |
3,494,430 | 0 | <p>After I posted my question, I tried a variant of the code the OP of the other question showed. It works for me. Here it is:</p> <pre><code>- (void) displaySelection:(Selection *)aSet { if (aSet != self.currentSelection) { self.currentSelection = aSet; NSFetchRequest *fetchRequest = [[self fetchedResultsController] fetchRequest]; NSPredicate *predicate = nil; NSEntityDescription *entity = nil; entity = [NSEntityDescription entityForName:@"DocInSelection" inManagedObjectContext:managedObjectContext]; predicate = [NSPredicate predicateWithFormat:@"selection.identifier like %@", currentSelection.identifier]; [fetchRequest setEntity:entity]; [fetchRequest setPredicate:predicate]; [NSFetchedResultsController deleteCacheWithName:@"Root"]; NSError *error = nil; if (![[self fetchedResultsController] performFetch:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } } [self.tableView reloadData]; } </code></pre> |
30,786,737 | 0 | <p>BitConverter class should help you.</p> <p><a href="https://msdn.microsoft.com/en-us/library/a5be4sc9(v=vs.110).aspx" rel="nofollow">BitConverter.GetBytes</a></p> <p>Something like this:</p> <pre><code>float f = 1234.5678F; var bytes = BitConverter.GetBytes(f); var result = string.Format("0x{0:x}{1:x}{2:x}{3:x}", bytes[0], bytes[1], bytes[2], bytes[3]); </code></pre> |
15,413,714 | 0 | <p>try using:</p> <pre><code>RAISERROR('your message here!!!',0,1) WITH NOWAIT </code></pre> <p>you could also try switching to "Results to Text" it is just a few icons to the right of "Execute" on the default tool bar.</p> <p>With both of the above in place, and you still you do not see the messages, make sure you are running the same server/database/owner version of the procedure that you are editing. Make sure you are hitting the RAISERROR command, make it the first command inside the procedure.</p> <p>If all else fails, you could create a table:</p> <pre><code>create table temp_log (RowID int identity(1,1) primary key not null , MessageValue varchar(255)) </code></pre> <p>then:</p> <pre><code>INSERT INTO temp_log VALUES ('Your message here') </code></pre> <p>then after running the procedure (provided no rollbacks) just <code>select</code> the table.</p> |
11,060,872 | 0 | <p>Answer from Symform:</p> <p>Thank you for contacting Symform support. I understand that you are needing the instructions to remove Symform from your Mac.</p> <p>Here is the information:</p> <ol> <li><p>Access the Terminal program on your Mac, by going to the search tool in the upper right-hand corner, and entering in Terminal.</p></li> <li><p>Once Terminal is open, enter in the following command, depending on what you want to do:</p></li> </ol> <p>Normal uninstall will only stop the services and remove the software. It will leave the service configuration and log files in place.</p> <p>sudo /Library/Application\ Support/Symform/scripts/uninstall</p> <p>To completely remove all aspects of the Symform software, configuration, and logs, a purging operation is available as well. This will remove any synchronization and contribution supporting files and directories too.</p> <p>sudo /Library/Application\ Support/Symform/scripts/uninstall --purge</p> <ol> <li>You will need to enter in your Mac password when running either of these commands.</li> </ol> |
20,345,263 | 0 | <p>Signals that an end of file or end of stream has been reached unexpectedly during input. This exception is mainly used by data input streams to signal end of stream. Note that many other input operations return a special value on end of stream rather than throwing an exception.</p> <p>and you can see that as below <a href="http://docs.oracle.com/javase/7/docs/api/java/io/EOFException.html" rel="nofollow">http://docs.oracle.com/javase/7/docs/api/java/io/EOFException.html</a></p> |
6,214,523 | 0 | Parsing URL jQuery AJAX form <p>Basically i'm trying to send a video along with other info through jQuery to PHP to be written to a txt file to be read later.</p> <p>There is a way of inputting a video url into this. I've got everything working except one thing.</p> <p>If i put this through: <a href="http://www.youtube.com/watch?v=g1lBwbhlPtM" rel="nofollow">http://www.youtube.com/watch?v=g1lBwbhlPtM</a> it works fine.</p> <p>but this: <a href="http://www.youtube.com/watch?v=g1lBwbhlPtM&feature=feedu" rel="nofollow">http://www.youtube.com/watch?v=g1lBwbhlPtM&feature=feedu</a> doesn't.</p> <p>I've done some tests and it's because when i send the second url through &feature=feedu gets read as a separate $_POST value.</p> <p>This is the problem:</p> <pre><code> var dataString = 'title='+title+'&content='+content+'&date='+date+'&Submit=YES'; </code></pre> <p>because its reading like </p> <p><code>var dataString = 'title='+title+'&content='+IMAGES, TEXT AND STUFF+'&feature=feedu OTHER IMAGES AND STUFF&date='+date+'&Submit=YES';</code></p> <p>it's out of a textarea that could include images or text and stuff so im looking for something like htmlspecialchars() to sort out that & before sending it through ajax</p> <p>Any ideas how to solve this?</p> <p>EDIT: Here's the full code that's the problem:</p> <pre><code> var title = $('input#title').val(); var content = $('textarea#content').val(); var date = $('input#date').val(); var dataString = 'title='+title+'&content='+content+'&date='+date+'&Submit=YES'; //alert (dataString);return false; $.ajax({ type: "POST", url: "./inc/php/file.php", dataType: "json", data: dataString, success: function(data) { if(data.error == true){ $('.errordiv').show().html(data.message); }else{ $('.errordiv').show().html(data.message); $(':input','#addstuff') .not(':button, :submit, :reset, :hidden') .val('') .removeAttr('checked') .removeAttr('selected'); } }, error: function(data) { $('.errordiv').html(data.message+' --- SCRIPT ERROR'); } }) return false; </code></pre> <p>if content equals:</p> <pre><code>&content= <br>Text 1<br> <img>http://someimage.com/image.jpg</img> <br> Text2<br> <vid>http://www.youtube.com/watch?v=isDIHIHI&feature=feedu</vid> <br>Text 3<br> </code></pre> <p>the content variable gets put through the ajax call as:</p> <pre><code>&content= <br>Text 1<br> <img>http://someimage.com/image.jpg</img> <br> Text2<br> <vid>http://www.youtube.com/watch?v=isDIHIHI </code></pre> <p>with an extra variable that is</p> <pre><code>&feature=feedu</vid> <br>Text 3<br> </code></pre> <p>So how do u stop the ajax reading &feature as a separate $_POST variable?</p> |
37,583,824 | 0 | How to integrate Citrus payment gateway without asking for login to user in ios? <p>Hope you are doing well.</p> <p>I am trying to integrate CitrusPay SDK to my iPhone application. How can i integrate CitrusPay Direct payment without asking user to login to citrus pay.</p> <p>I want to give options to user like :</p> <ol> <li>Pay using Citrus Wallet</li> <li>Pay using Creditcard/Debit Card</li> <li>Pay using Net banking</li> </ol> <p>If user would like to pay using Citrus Wallet then i will ask user to login to citrus using their credentials. If they will go with 2nd or 3rd option like pay using Credit Card/Debit Card or net banking then they don't need to login.</p> <p>I want to implement this function in my app using CitrusPay SDK. Can you point out me for the code of this? </p> <p>I already have a demo of the Citrus pay and i already checked it.</p> <p><a href="https://github.com/citruspay/citruspay-ios-sdk" rel="nofollow">https://github.com/citruspay/citruspay-ios-sdk</a></p> <p>I downloaded the demo from the above link.</p> <p>Please help me out for this.</p> |
7,965,923 | 0 | <p>When changing the data types from xts to numeric, the problem went away and the speed of processing increased dramatically. (seems obvious in hindsight) </p> |
32,865,403 | 0 | My system sound in Swift is not played <p>This what I use:</p> <pre><code>if let filePath = NSBundle.mainBundle().pathForResource("Aurora", ofType: "aiff") { //it doesn't gets here let fileURL = NSURL(fileURLWithPath: filePath) var soundID:SystemSoundID = 0 AudioServicesCreateSystemSoundID(fileURL, &soundID) AudioServicesPlaySystemSound(soundID) } </code></pre> <p>How to do this? I've read a lot about this, but nothing has worked.</p> <p>Testing on a real device.</p> |
29,702,605 | 0 | <p>This is the shortest one.</p> <pre><code>var arr = tF.join(' ').split(/\s+/); </code></pre> |
18,760,926 | 0 | <p>With Core Bluetooth background communication must be implemented either with characteristic change notifications or indications. You are keeping the app running for too long after being brought to background and iOS is killing it forcefully. I suppose you are using the <code>beginBackgroundTaskWithExpirationHandler:</code> method to keep some timers running. This doesn't work for long periods of time. The limit is around 10 minutes but it may depend on other factors too.</p> <p>The <a href="https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW1" rel="nofollow">Core Bluetooth Programming Guide</a> contains a pretty concise description of how backgrounding has to be handled. Practically, your app needs to subscribe on either notifications or indications of the heart rate characteristic and react to it only when the callbacks happen. The app should keep running when backgrounded only if it is doing some uninterruptible task, e.g. non-resumable network operations.</p> |
2,582,431 | 0 | <p>Change <code>while(infile.is_open())</code> to <code>while(infile)</code>. Then you can remove the redundant eof test at the end.</p> <p>It's still open even if you've encountered an error or reached the end of file. It's likely you are in a scenario where failbit is getting set (getline returns nothing), but eof has not been encountered, so the file never gets closed, so your loop never exits. Using the <code>operator bool</code> of the stream gets around all these problems for you.</p> |
15,393,994 | 0 | Data is automatically deleted from SQL Server CE <p>I am trying to write an application in VS2010 c# (Winforms) with SQL Server CE 3.5 as backend. I used the transactions for insertion of data in a table, while testing I inserted 18 rows and everything was OK.</p> <p>But on the next day I found some rows missing, and when I tried to insert new rows, some primary key related error occurred. When I opened the database in SSMS and tried <code>@@Identity</code>, it returned the number 19.</p> <p>I inserted a value into the database from SSMS and when I tried the application everything worked fine. Now the identity column contains values from 1 to 14 and from 19 to 25 (15 to 18 are missing).</p> <p>Now I ask you experts to kindly help me to figure out the reason behind this automatic deletion of data.</p> <p>Thanks a lot </p> |
15,664,919 | 0 | <p>This is a solution I got for you.</p> <p>Is that what you were looking for?</p> <p><a href="http://jsfiddle.net/migontech/YYWQx/6/" rel="nofollow">http://jsfiddle.net/migontech/YYWQx/6/</a></p> <pre><code>$.fn.stars = function() { return $(this).each(function() { // Get the value var val = parseFloat($(this).html()); // Make sure that the value is in 0 - 5 range, multiply to get width var size = Math.max(0, (Math.min(5, val))) * 16; // Create stars holder var $span = $('<span />').width(size); // Replace the numerical value with stars $(this).html($span); }); } $(function() { $('div.star-rating strong').stars(); }); </code></pre> |
9,884,027 | 0 | <p>You are possibly populating the dropdown in the Page_Load function and you do not have a Page.IsPostBack check. Thus everytime the list is populated again. Change the population code to something like:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadTable(); } } </code></pre> |
3,691,946 | 0 | <pre><code>vector<int> v; size_t len = v.size; nth_element( v.begin(), v.begin()+len/2,v.end() ); int median = v[len/2]; </code></pre> |
27,904,177 | 0 | uiimageview animation stops when user touches screen <p>I have a UImageview with animated image. i am adding the uiimageview in code and its a part of a CollectionViewCell When the user touches the cell the animation stops, why does this happen?</p> <p>code:</p> <pre><code> var images: [UIImage] = [] for i in 0...10 { images.append(UIImage(named: "image\(i)")) } let i = UIImageView(frame: CGRect(x: xPos, y: yPos, width: 200, height: 200)) i.animationImages = images i.animationDuration = 0.5 i.startAnimating() i.contentMode = UIViewContentMode.Center i.userInteractionEnabled = false self.addSubview(i) </code></pre> |
34,464,001 | 0 | Refreshing PayPal OAuth token <p>I develop payout system which is based on PayPal's payouts. To make a call to PayPal API it is neccessary to get OAuth token as described in </p> <p><a href="https://developer.paypal.com/docs/integration/direct/make-your-first-call/" rel="nofollow">https://developer.paypal.com/docs/integration/direct/make-your-first-call/</a></p> <p>I found that repeatedly calls to get OAuth token don't refresh it (the token gets the same, expiration time decreases).</p> <p>Is there any way to force OAuth token refresh?</p> |
1,278,405 | 0 | <p>You might consult these other similar questions:</p> <ul> <li><a href="http://stackoverflow.com/questions/1019723/iphone-create-sqlite-database-at-runtime">"iPhone create SQLite database at runtime?"</a></li> <li><a href="http://stackoverflow.com/questions/716839/wheres-the-best-sqlite3-tutorial-for-iphone-sdk">"Where’s the best sqlite3 tutorial for iPhone-SDK?"</a></li> <li><a href="http://stackoverflow.com/questions/487339/add-sqlite-database-to-iphone-app">"Add SQLite Database to iphone app"</a></li> </ul> <p>Additionally, the SQLiteBooks sample code that Apple provides takes you step-by-step through the process of copying an existing database from the resources directory of your application bundle to the application's Documents directory. It is a little more complex when working with the database, however.</p> <p>Mobile Orchard also has a <a href="http://www.mobileorchard.com/iphone-sqlite-tutorials-and-libraries/" rel="nofollow noreferrer">list of resources</a> for SQLite on the iPhone.</p> <p>The source code to my iPhone application <a href="http://www.sunsetlakesoftware.com/molecules" rel="nofollow noreferrer">Molecules</a> is available, and for now it uses SQLite as a data store (that will be changing to Core Data soon). You may be able to pick something up from that.</p> |
11,655,212 | 0 | <p>I think the confusion comes from the idea of normalizing "a value" as opposed to "a vector"; if you just think of a single number as a value, normalization doesn't make any sense. Normalization is only useful when applied to a vector.</p> <p>A vector is a sequence of numbers; in 3D graphics it is usually a coordinate expressed as <code>v = <x,y,z></code>.</p> <p>Every vector has a <em>magnitude</em> or <em>length</em>, which can be found using Pythagora's theorem: <code>|v| = sqrt(x^2 + y^2 + z^2)</code> This is basically the length of a line from the origin <code><0,0,0></code> to the point expressed by the vector.</p> <p>A vector is <em>normal</em> if its length is 1. That's it!</p> <p>To normalize a vector means to change it so that it points in the same direction (think of that line from the origin) but its length is one.</p> <p>The main reason we use normal vectors is to represent a direction; for example, if you are modeling a light source that is an infinite distance away, you can't give precise coordinates for it. But you can indicate where to find it from a particular point by using a normal vector.</p> |
33,090,205 | 0 | <p>I'm running ubuntu linux 14.04.</p> <p>I entered, on the command line, </p> <pre><code>objdump -d untitled </code></pre> <p>where 'untitled' is an executable file</p> <p>It ran successfully with out any 'file truncated' message.</p> <p>I entered, on the command line,</p> <pre><code>objdump -d untitled.o </code></pre> <p>where 'untitled.o' is an object file</p> <p>It ran successfully with out any 'file truncated' message.</p> <p>Therefore, I strongly suspect the 'bufbomb' file is not a valid executable or object file.</p> |
24,793,803 | 0 | How to pool a thrift client (or at least reuse the tcp connections) in java <p>Is there a standard library for thrift in java that will facilitate the reuse of tcp connections for many rpcs that are being issued. It seems that thrift does not support pipelining requests on a single connection (though correct me if I'm wrong), but it seems like it would be greatly beneficial to be able to reuse a thrift tcp connection when one rpc is done with it. How can I achieve this most easily?</p> |
16,408,796 | 0 | Process Builder cannot find the path specified, using AppData folder <p>This is probably a simple question, I'm fairly new to Java but in my search I haven't been able to figure out why exactly this code doesn't work.</p> <pre><code>String execLoc = ((System.getenv("APPDATA"))+"\\ARcraft\\exec\\"); ProcessBuilder getCrafting = new ProcessBuilder("Minecraft.exe"); getCrafting.directory(new File(execLoc)); getCrafting.start(); </code></pre> <p>When I run this, I get back:</p> <pre><code>Cannot run program "Minecraft.exe" (in directory "C:\Users\andrew\AppData\Roaming\ARcraft\exec"): CreateProcess error=2, The system cannot find the file specified </code></pre> <p>I've read other posts with similar issues, and tried a variety of solutions but the fixes that they use don't seem to do anything for me. I've confirmed the file is present and that it runs correctly when executed from the directory being fed back by the program when pasted in command prompt.</p> |
31,955,993 | 0 | When cant a object be added to an object <p>Trying to add a value to a object. The object was generated from the start by a database request, containing a number of entires. A sample entry (say number 0) looks as follows:</p> <pre><code>{ _id: 55c8a069cca746f65c98369d, fulltext: 'Finance', alias: 'Finance', level: 0, fullurl: 'http://v-ghost.port0.org:808/dbfswiki/index.php/FMP', __v: 0, _parrent: [] } </code></pre> <p>Now I want to add an additional array to this object. An empty structure where there will be a number of other listings. I started by using <code>.push</code>, but the object does not have a <code>push</code> function. This one has done a few rounds, so latest version below:</p> <p>The structure I do want is:</p> <pre><code> { _id: 55c8a069cca746f65c98369d, fulltext: 'Finance', alias: 'Finance', level: 0, fullurl: 'http://v-ghost.port0.org:808/dbfswiki/index.php/FMP', __v: 0, _parrent: [] childs: [] } </code></pre> <p>I am not putting anything into childs at this point <em>(childs because children seems to reserved, and while it might work, don't really want to try changing it when the code is already broken)</em>, basically just adding an empty slot to put similar objects into as part of later processing. <strong>Really weird</strong> Changed the code as follows: console.log ("Root record now " + rootRecord); rootRecord.childs = 1; console.log("Alias is " + rootRecord.alias); console.log("Child is " + rootRecord.childs); console.log("The complete structure is: \n"+rootRecord)</p> <p>And I get the following output</p> <pre><code>Alias is Finance Child is 1 The complete structure is: { _id: 55c8a069cca746f65c98369d, fulltext: 'Finance', alias: 'Finance', level: 0, fullurl: 'http://v-ghost.port0.org:808/dbfswiki/index.php/FMP', __v: 0, _parrent: [] } </code></pre> <p>So I can read rootRecord.childs, but its not listed, its almost as it is a "hidden" variable somehow.</p> <p><strong>The offending code</strong></p> <pre><code> console.log("Creating root structure"); var roots = docs[doc]; console.log("Root from docs: \n" + docs[doc]) console.log("Sealed: " + Object.isSealed(docs[doc])); console.log("Frozen " + + Object.isFrozen(docs[doc])); console.log("Is Extendable: " + isExtendable(docs[doc])); console.log("Is Extensible(es6): " + Object.isExtensible(docs[doc])); for (var root in docs[doc]){ var rootRecord = docs[doc][root]; console.log ("Root record now " + rootRecord); rootRecord.childs = []; console.log("Now its " + rootRecord); returnStructure.push(rootRecord); console.log("returnStructure is now:\n" + returnStructure); console.log("And first id is " + returnStructure[0]['_id']) } </code></pre> <p>Gives the following output:</p> <pre><code>Creating root structure Root from docs: { _id: 55c8a069cca746f65c98369d, fulltext: 'Finance', alias: 'Finance', level: 0, fullurl: 'http://v-ghost.port0.org:808/dbfswiki/index.php/FMP', __v: 0, _parrent: [] } Sealed: false Frozen 0 Is Extendable: true Is Extensible(es6): true Root record now { _id: 55c8a069cca746f65c98369d, fulltext: 'Finance', alias: 'Finance', level: 0, fullurl: 'http://v-ghost.port0.org:808/dbfswiki/index.php/FMP', __v: 0, _parrent: [] } Now its { _id: 55c8a069cca746f65c98369d, fulltext: 'Finance', alias: 'Finance', level: 0, fullurl: 'http://v-ghost.port0.org:808/dbfswiki/index.php/FMP', __v: 0, _parrent: [] } returnStructure is now: { _id: 55c8a069cca746f65c98369d, fulltext: 'Finance', alias: 'Finance', level: 0, fullurl: 'http://v-ghost.port0.org:808/dbfswiki/index.php/FMP', __v: 0, _parrent: [] } And first id is 55c8a069cca746f65c98369d </code></pre> <p><strong>Full source code</strong></p> <pre><code>var mongoose = require("mongoose"); var morgan = require('morgan'); // log requests to the console (express4) var methodOverride = require('method-override'); // simulate DELETE and PUT (express4) var async = require('async'); mongoose.connect('mongodb://localhost/ResourceProfiles'); //var ObjectId = require('mongoose').ObjectID; var isExtendable = require('is-extendable'); var Schema = mongoose.Schema, ObjectId = Schema.ObjectId; var Profile = mongoose.model('Profile', { alias: String, img: String, name: String, summary: String, CV: String, keys: String, avail: String, agent: String, __v: {type: Number, select: false}, comp: { type: Number, default: 0 }, comn: { type: Number, default: 0 }, intp: { type: Number, default: 0 }, intn: { type: Number, default: 0 }, orgp: { type: Number, default: 0 }, orgn: { type: Number, default: 0 }, swep: { type: Number, default: 0 }, swen: { type: Number, default: 0 }, pssp: { type: Number, default: 0 }, pssn: { type: Number, default: 0 }, pep: { type: Number, default: 0 }, pen: { type: Number, default: 0 }, gtemp: { type: Number, default: 0 }, gtemn: { type: Number, default: 0 } }); var Skill = mongoose.model('Skill', { alias: String, fulltext: { type: String , required: true , unique: true }, fullurl: String, level: Number, _parrent: [{ type: ObjectId, ref: 'Skill'}], }) console.log("Lets see if we can't figure out this one once and for all"); var queries= []; var maxLevels = 1; [0,1,2,3,4].forEach(function(i){ console.log("Looking for "+ i) queries.push(function (cb) { console.log("Seaching for "+ i) Skill.find({level: i}).exec(function (err, docs) { if (err) { throw cb(err); } // do some stuff with docs & pass or directly pass it cb(null, docs); }); }); }) console.log("All requests generated"); async.parallel(queries, function(err, docs) { // if any query fails if (err) { throw err; } var returnStructure = []; console.log("This is what we got back") for (var doc in docs){ if ( docs[doc].length === 0 ){ console.log("No entries in level " + doc) } else { console.log("Processing " + docs[doc].length + " for level " + doc) if ( doc === "0" ) { console.log("Creating root structure"); var roots = docs[doc]; console.log("Root from docs: \n" + docs[doc]) console.log("Sealed: " + Object.isSealed(docs[doc])); console.log("Frozen " + + Object.isFrozen(docs[doc])); console.log("Is Extendable: " + isExtendable(docs[doc])); console.log("Is Extensible(es6): " + Object.isExtensible(docs[doc])); for (var root in docs[doc]){ var rootRecord = docs[doc][root]; console.log ("Root record now " + rootRecord); rootRecord.childs = []; console.log("Now its " + rootRecord); returnStructure.push(rootRecord); console.log("returnStructure is now:\n" + returnStructure); console.log("And first id is " + returnStructure[0]['_id']) } /*} else if ( doc === "1"){ var skills = docs[doc]; for (var skill in skills){ console.log("Need to find " + skills[skill].alias + " parrent " + skills[skill]._parrent); for (var root in returnStructure) { if ( returnStructure[root]["_id"].toString() === skills[skill]["_parrent"].toString()){ console.log("Found parrent " + returnStructure[root].alias); var newSkill = []; var childs = { childs: {}}; newSkill.push(skills[skill]); newSkill.push(childs); console.log("This is it " + returnStructure); returnStructure[root].childs.push(newSkill); } } console.log(returnStructure); } } else if ( doc === "2"){ var skills = docs[doc]; for (var skill in skills){ console.log("Need to find " + skills[skill].alias + " parrent " + skills[skill]._parrent); for (var root in returnStructure){ //var parrents= returnStructure[root].childs; for (var parrent in returnStructure[root].childs){ console.log("Lets compare \n" + returnStructure[root].childs[parrent]._id + "\n" + skills[skill]._parrent); if( returnStructure[root].childs[parrent]._id.toString() === skills[skill]["_parrent"].toString() ){ console.log("Hello found " + returnStructure[root].childs[parrent].childs); skills[skill].childs = []; console.log(skills[skill]) returnStructure[root].childs[parrent].childs.push(skills[skill]) } } } } */ } // } } } }) </code></pre> |
34,975,405 | 0 | <p>You could try this code to obtain the machine epsilon for <code>float</code> values:</p> <pre><code>#include<iostream> #include<limits> int main(){ std::cout << "machine epsilon (float): " << std::numeric_limits<float>::epsilon() << std::endl; } </code></pre> |
10,648,709 | 0 | <p>I used RelayCommands and this has a constructor where you can create a canExecute Predicate and then if it returns false the bound button will be disabled automatically.</p> <p>On the delegate command you should rewrite the CantDoAnything() method to represent your enable and disable logic. And the binding you should simply bind to the Command.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ff654427" rel="nofollow">DelegateCommand constructor on MSDN</a> </p> <p><a href="http://stackoverflow.com/questions/7350845/canexecute-logic-for-delegatecommand">DelegateCommand CanExecute BugFix</a></p> |
22,949,145 | 0 | <p>You can make the database sort for you! </p> <p><code>Product.order(name: :asc, status: :desc)</code></p> <p>Check out the guide here <a href="http://guides.rubyonrails.org/active_record_querying.html#ordering" rel="nofollow">http://guides.rubyonrails.org/active_record_querying.html#ordering</a> for more information</p> |
5,901,406 | 0 | C# -- Is this checking necessary " obj is Person && obj != null" <p>I saw the following code,</p> <pre><code>public override bool Equals(object obj) { // From the book http://www.amazon.co.uk/Pro-2010-NET-4-0-Platform/dp/1430225491 // Page 254! if (obj is Person && obj != null) ... } </code></pre> <p>Based on my understanding, I think the code should be rewritten as follows:</p> <pre><code>public override bool Equals(object obj) { if (obj is Person) ... } </code></pre> <p>Is that correct?</p> <p>Based on <a href="http://msdn.microsoft.com/en-us/library/scekt9xw%28v=vs.80%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/scekt9xw%28v=vs.80%29.aspx</a></p> <p><em>An is expression evaluates to true if the provided expression is non-null, and the provided object can be cast to the provided type without causing an exception to be thrown.</em> </p> <p>I think the extra checking for null is NOT necessary at all. In other words, that code "obj != null" should never be hit at all.</p> <p>Thank you</p> <p>// Updated //</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Employee { public static void CheckIsEmployee(object obj) { if (obj is Employee) { Console.WriteLine("this is an employee"); } else if (obj == null) { Console.WriteLine("this is null"); } else { Console.WriteLine("this is Not an employee"); } } } class NotEmployee { } class Program { static void Main(string[] args) { Employee e = new Employee(); Employee.CheckIsEmployee(e); Employee f = null; Employee.CheckIsEmployee(f); NotEmployee g = new NotEmployee(); Employee.CheckIsEmployee(g); } } } </code></pre> <p>Output results:</p> <pre><code>this is an employee this is null this is Not an employee </code></pre> |
2,624,787 | 0 | jQuery version conflicts - how to manage? <p>I made a Wordpress Plugin which includes a jQuery file. Now I've got the problem, that people who use my plugin may have a different jQuery Version on their Wordpress Blogs, so what shall I do to manage that? My plugin often doesn't work with 'other' jQuery Versions.</p> <p>Maybe there is anyone who is addicted with the wordpress api. Maybe there are some hooks I didn't know (this is my first plugin). I will be pleased if these ones can have a short look in my sources: <a href="http://wordpress.org/extend/plugins/slide2comment/" rel="nofollow noreferrer">http://wordpress.org/extend/plugins/slide2comment/</a></p> |
31,823,189 | 0 | reloading media folder in wagtail <p>I'm trying to add images to the the cms. I can see how do do it through the cms. Is it possible to add them just by adding them to the media directory and reloading them. It would make it easier to manage as I could use the shell to move things around.</p> |
31,745,369 | 0 | calculate distance from beacon when user is moving in a vehicle <p>How to calculate distance using BLE beacons if the user is moving in a vehicle with 2-15kmph speed?Also,if the distance won't give me accurate results is there any other mechanism with the help of which I can calculate the nearest beacon.The default implementation does not give me proper results as there is a 20sec lag in distance estimates. Secondly,in which cases should ARMA filter be used.</p> |
22,456,693 | 0 | <p>Most likely, the sequence of save and restore was incorrect. The table had attributes that shouldn't have been saved and should have been removed before saving. The restore has resulted in a database catalog on the new system with inconsistent elements.</p> <p>If not, then the next likelihood (and just about the only other possibility) is that the database catalog had inconsistencies already before the restore was done. Those could have been introduced by improper shutdowns or other actions.</p> <p>First step should be:</p> <pre><code>RCLDBXREF OPTION(*CHECK) </code></pre> <p>If problems are reported, run:</p> <pre><code>RCLDBXREF OPTION(*FIX) </code></pre> <p>If the system is too old for the RCLDBXREF command, use:</p> <pre><code>RCLSTG SELECT(*DBXREF) </code></pre> <p>No "*CHECK" option is available for the older version.</p> <p>Depending on size and complexity of your database, number of resynchronizations needed and general performance characteristics of your server, either of those can run from 10 minutes to a few hours. Most unexplained database catalog problems (other than those needing PTFs) can be cleared by either of those.</p> <p>The RCLDBXREF command is usually preferred, but some problems will require the RCLSTG alternative. Significant restrictions exist for RCLSTG, so be sure to read the command [Help].</p> |
15,714,623 | 0 | <p>Location of your database is </p> <p>/data/data/YOUR_PACKAGE/databases/ab.db</p> <p>You can find it on Android manifest file. </p> <pre><code><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="0.0" package="YOUR_PACKAGE" android:versionName="1.0"> </code></pre> |
20,231,612 | 0 | <p>In the construct method, you should do <code>$this->Result = $Result;</code> instead of <code>return $Result;</code>,</p> <p>then use <code>return $this->Result;</code> in <code>returnLucky()</code>.</p> <p>And you should avoid use variable like <code>$result</code> and <code>$Result</code>, which is confusing.</p> |
1,210,335 | 0 | Changing mouse-cursor on a html-page <p>I need a way of changing the mouse-cursor on a html-page. I know this can be done with css, but I need to be able to change it at runtime, like for instance having buttons on the page, and when they're clicked they change the cursor to a specific custom graphic. I think the best (or only?) way of doing this is through javascript? I hope there's a way of doing this nicely that will work on all of the major browsers. I would be very grateful if someone could help me with this.</p> <p>Thanks in advance</p> |
4,344,060 | 0 | <p>This will hide the label while you have active MDI Children en show it again once there is no active child anymore.</p> <pre><code> private void Form1_MdiChildActivate(object sender, EventArgs e) { if (ActiveMdiChild != null) label1.SendToBack(); else label1.BringToFront(); } </code></pre> <p>I hope this helps.</p> |
7,978,242 | 0 | <p>maybe this can help, i am using EasyPhp(instead of XAMPP) and zend's auto generated .htaccess and i have this in apache</p> <pre><code>NameVirtualHost 127.0.0.1:80 <VirtualHost abc:80> DocumentRoot "C:/www/www/abc/public" ServerName .local SetEnv APPLICATION_ENV development <Directory "C:/www/www/abc/public"> Options Indexes MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> </code></pre> <p>and this is what the directory look like</p> <pre><code> Directory di c:\www\www\abc [.] [..] .buildpath .project [.settings] .zfproject.xml [application] [cache] [data] [docs] [library] [public] [scripts] [tests] Directory di c:\www\www\abc\library [.] [..] [abc] [tcpdf] [Zend] [ZendX] </code></pre> |
23,766,875 | 0 | Laravel Forms without using Blade <p>Is it possible to build a laravel application without using Blade to create the forms? I write the application's code, and my designer takes care of all the visual elements/css. He uses Dreamweaver and other software to generate the forms. Now is it possible for me to use these forms as they are, and still use Laravel's methodologies like routing?</p> <p>The first place I'm stuck at is that I have a registration form, however it does not use blade and hence I am not entirely sure how to submit the form. Any help here is appreciated, I am here to learn!</p> <p>Some sample code from the form itself -</p> <pre><code><form data-abide> <div class="row"> <div class="large-6 columns"> <label>First Name <input type="text" name="first_name" placeholder="" pattern="alpha" maxlength="25" autofocus required /> </label> </div> <div class="large-6 columns"> <label>Last Name <input type="text" name="last_name" placeholder="" pattern="alpha" maxlength="25" required /> </label> </div> </div><!-- .row --> <div class="row"> <div class="large-12 columns"> <label>Choose your username <input type="text" name="username" placeholder="Only letters, numbers and periods please!" pattern="^[a-zA-Z][a-zA-Z0-9\.]{3,20}$" maxlength="45" required /> </label> <small class="error">You can only use letters, numbers and periods. Your username must have at least 4 characters.</small> </div> </div><!-- .row --> <div class="row"> <div class="large-12 columns"> <button class="button" type="submit">Sign up</button> </div> </div><!-- .row --> </form> </code></pre> |
1,324,669 | 0 | <p>I'm not following how your first line of code relates to the "Example". Could you describe the effect you're trying to achieve in words?</p> <p>Your first line reads:</p> <blockquote> <p>(1) Add the class <code>linksbelow</code> to all the <code>tr</code> elements that contain a <code>table.navitem</code> immediately after a <code>tr</code> that contains a <code>table.navheader</code> within <code>.Nav table</code></p> </blockquote> <p>And the example reads:</p> <blockquote> <p>(2) Add a class to any element that matches <code>.Nav table .navheader</code>. The classname is dependent on the result of (1). If the operation in (1) succeeded (presumably meaning if it matched any elements) then the classname should be <code>linksbelow</code>, otherwise <code>Nolinksbelow</code>.</p> </blockquote> |
6,093,908 | 0 | <p>Instead of polling with epoll, since you're only waiting on one timer you can just check if it's expired by <code>read</code>ing it. The number of times it has expired will then be stored in the buffer that you're <code>read</code>ing into, or if it hasn't expired, the <code>read</code> will fail with the error EAGAIN.</p> <pre><code>// set up timer // ... uint64_t expirations; if ((read(timer_fd, &expirations, sizeof(uint64_t))==-1) && errno == EAGAIN) { printf("Timer has not expired yet.\n"); } else { printf("Timer has expired %llu times.\n", expirations); } </code></pre> <p>Note that you'll need to initialize <code>timer_fd</code> with the flag <code>TFD_NONBLOCK</code>, or else the <code>read</code> will block if it hasn't expired yet rather than fail, but you already do that.</p> |
4,645,809 | 0 | JPEG to JFIF conversion <p>I need to convert jpeg image to jfif format this is because i need to send MMS data. Can any one tell me how do convert it using java.</p> |
21,866,826 | 0 | Need Help Understanding Javascript Closure <p>I am learning about javascript closures and am having difficulty understanding the concept. If someone would be kind enough to guide me through this example, i.e., where inputs and outputs are going, I'd appreciate it.</p> <pre><code>var hidden = mystery(3); var jumble = mystery3(hidden); var result = jumble(2); function mystery ( input ){ var secret = 4; input+=2; function mystery2 ( multiplier ) { multiplier *= input; return secret * multiplier; } return mystery2; } function mystery3 ( param ){ function mystery4 ( bonus ){ return param(6) + bonus; } return mystery4; } results; </code></pre> <p>Thank you.</p> |
21,814,724 | 0 | <p>Put the <code>filemanager</code> folder in your project folder</p> <pre><code>relative_urls:false, image_advtab: true , external_filemanager_path:"/yourprojectname/filemanager/", filemanager_title:"Filemanager" , external_plugins: { "filemanager" : "filemanager/plugin.min.js"} </code></pre> |
31,856,049 | 0 | <blockquote> <p>The getElementsByClassName() method returns a collection of an element's child elements with the specified class name, as a NodeList object.</p> </blockquote> <p>You need to do this:</p> <pre><code>document.getElementsByClassName("aero")[0].innerHTML="<span>"+count+"</span>"; </code></pre> <p>Refer <a href="http://www.w3schools.com/jsref/met_element_getelementsbyclassname.asp" rel="nofollow">getElementsByClassName() - W3</a></p> |
4,632,673 | 0 | <p>I get that same result. But, if I inject a <code>setprecision</code>, I get the right value:</p> <pre><code>#include <iostream> #include <iomanip> #include <cmath> int main (void) { double x=2147483647.0; double y=sqrt(x); std::cout << std::setprecision(10) << y << std::endl; return 0; } </code></pre> <p>gives me:</p> <pre><code>46340.95 </code></pre> <p>In fact, if you use the folowing code:</p> <pre><code>#include <iostream> #include <iomanip> #include <cmath> int main (void) { double x=2147483647.0; double y=sqrt(x); std::cout << y << std::endl; std::cout << std::setprecision(0) << std::fixed << y << std::endl; std::cout << std::setprecision(1) << std::fixed << y << std::endl; std::cout << std::setprecision(2) << std::fixed << y << std::endl; std::cout << std::setprecision(3) << std::fixed << y << std::endl; return 0; } </code></pre> <p>you get:</p> <pre><code>46341 46341 46341.0 46340.95 46340.950 </code></pre> <p>So it appears that the default setting (at least for my environment) is a precision of zero.</p> <p>If you <em>want</em> a specific format, I suggest you explicitly request it.</p> |
1,678,730 | 0 | <p>Create a form, stick a textbox and an "OK" button on it, create a public property which contains the textbox's contents you can access afterwards.</p> |
19,642,124 | 0 | <p>InAppSettingsKit comes with an extension that allows you to do exactly this.</p> <p>Check the <a href="https://github.com/futuretap/InAppSettingsKit#custom-viewcontrollers" rel="nofollow">Custom ViewControllers</a> section in the Readme. Of course this works only within the app, not in the settings app. There are several option to differentiate the settings plists between Settings.app and in-App. See "<a href="https://github.com/futuretap/InAppSettingsKit#custom-inapp-plists" rel="nofollow">Custom inApp plists</a>".</p> |
22,262,694 | 0 | How to extend a users session server side? <p>I'm using SimpleMembership with ASP.NEt MVC.</p> <p>I have a session time out of 30 minutes, on a sliding scale.</p> <p>There are times that I would like to reset the timer for say user 105, without them clicking on a link, with server side logic. Is there a way I can reset a users session timer with server side code?</p> |
29,718,076 | 0 | <p>Using Debug key store including android's debug.keystore present in .android folder was generating a strange problem; the log-in using facebook login button on android app would happen perfectly as desired for the first time. But when ever I Logged out and tried logging in, it would throw up an error saying: This app has no android key hashes configured. Please go to http:// .... </p> <p>Creating a Keystore using keytool command(keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -validity 10000) and putting this keystore in my projects topmost parent folder and making a following entry in projects build.gradle file solved the issue:</p> <pre><code> signingConfigs { release { storeFile file("my-release-key.keystore") storePassword "passpass" keyAlias "alias_name" keyPassword "passpass" } } </code></pre> <p>Please note that you always use the following method inside onCreate() of your android activity to get the key hash value(to register in developer.facebook.com site of your app) instead of using command line to generate hash value as command line in some cased may out put a wrong key hash:</p> <pre><code> public void showHashKey(Context context) { try { PackageInfo info = context.getPackageManager().getPackageInfo("com.superreceptionist", PackageManager.GET_SIGNATURES); for (android.content.pm.Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); String sign=Base64.encodeToString(md.digest(), Base64.DEFAULT); Log.e("KeyHash:", sign); // Toast.makeText(getApplicationContext(),sign, Toast.LENGTH_LONG).show(); } Log.d("KeyHash:", "****------------***"); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } </code></pre> |
10,974,953 | 0 | XCode Storyboard - View appearing in Landscape? <p>Building an application which started as fairly simple, but now got pretty complicated. I am facing a strange problem. I am now using only storyboards to define all of my views. The problem I am facing is, some view-controllers in storyboard are appearing in Landscape mode and others in Portrait mode.</p> <p>I know it won't make a difference in final application, but it is making it hard for me to design and visualize things. Has someone else faced this problem?</p> |
17,567,401 | 0 | How to stop when a condition in if statement is satisfied, when debugging <p>How to stop when a condition in if statement is satisfied, when debugging? For example:</p> <pre><code>if (!check()) { int a = 0; } </code></pre> <p>The int a = 0; is dummy code and then I put a breakpoint there. If I put a breakpoint inside an empty if loop the debugger won't stop there, it only stops at instructions it can execute. Even if you do int a; just a declaration it won't stop.</p> <p>Can I do this in other way rather than writing dummy code?</p> <p>Thanks</p> |
4,030,649 | 0 | <p>Drupal help you build fast, and it looks like promising but fails to fullfil the needs of client, designer also programmer. You need to write one module page, and some functions. </p> <p>5th solution you gave has little trouble than others. Write a function that to have "teaser like" behavior, I will return formatted node according to its type. Don't lay on drupal's teaser system. If teasers will have different heights, add height to teaser function. </p> |
2,503,071 | 0 | How to Implement Loose Coupling with a SOA Architecture <p>I've been doing a lot of research lately about SOA and ESB's etc. </p> <p>I'm working on redesigning some legacy systems at work now and would like to build it with more of a SOA architecture than it currently has. We use these services in about 5 of our websites and one of the biggest problems we have right now with our legacy system is that almost all the time when we make bug fixes or updates we need to re-deploy our 5 websites which can be a quite time consuming process. </p> <p>My goal is to make the interfaces between services loosely coupled so that changes can be made without having to re-deploy all the dependent services and websites.</p> <p>I need the ability to extend an already existing service interface without breaking or updating any of its dependencies. Have any of you encountered this problem before? How did you solve it?</p> |
39,361,547 | 0 | Modal is unresponsive and locks everything on screen <p>I'm trying to make a modal for the logging the user in. However, when my modal pops up, everything (including the modal itself is getting faded or greyed out). I'm unable to click on anything be it the background or the buttons on the modal. Usually, I should be able to dismiss the modal by clicking elsewhere or on the close button of the modal. But now, I'm unable to close it by any means. I have to reload the page to close the modal.</p> <p>Two scripts which I had to load to get the modal working at all:</p> <pre><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </code></pre> <p>Here's my modal code:</p> <pre><code> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content" style="z-index:99999999;"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Modal Header</h4> </div> <div class="modal-body"> <p>Some text in the modal.</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> </code></pre> <p>Here's the link that calls the modal: </p> <pre><code><div id="fh5co-page"> <header id="fh5co-header" role="banner" style="Border-bottom:solid;position:fixed;border-width:1px;background-color:rgba(127,127,127,0.85);"> <div class="container"> <div class="header-inner"> <a href="#"><img alt="XYZ" class="img-responsive" src="{% static 'assets/images/XYZimage.png' %}" style="float:left;height:70px;width:180px;"></a> <nav role="navigation" style="float:right;margin-top:4%;"> <ul> <li><a href="about.html">View Packages</a></li> <li><a href="about.html">Try a test!</a></li> <li class="cta"><a href="#" data-toggle="modal" data-target="#myModal">Open Modal</a></li> </ul> </nav> <div style="clear:both;"></div> </div> </div> </header> </code></pre> <p>What needs to change here? Please help! Thanks!</p> <p>Screenshot:<a href="https://i.stack.imgur.com/qY1eR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qY1eR.png" alt="enter image description here"></a></p> <p>CSS code for class cta, header-inner, fh5co-header, and fh5co-page:</p> <pre><code>#fh5co-header nav ul li.cta { margin-left: 20px; } #fh5co-header nav ul li.cta a { padding-left: 16px !important; padding-right: 16px !important; padding-top: 7px !important; padding-bottom: 7px !important; border: 2px solid rgba(255, 255, 255, 0.7); -webkit-border-radius: 30px; -moz-border-radius: 30px; -ms-border-radius: 30px; border-radius: 30px; } #fh5co-header nav ul li.cta a:hover { background: #fff; color: #00B906; } #fh5co-header nav ul li.cta a:hover:after { display: none; } #fh5co-offcanvas ul li.cta { margin-left: 0; margin-top: 20px; display: block; float: left; } #fh5co-offcanvas ul li.cta a { padding-left: 16px !important; padding-right: 16px !important; padding-top: 7px !important; padding-bottom: 7px !important; border: 2px solid rgba(255, 255, 255, 0.7); -webkit-border-radius: 30px; -moz-border-radius: 30px; -ms-border-radius: 30px; border-radius: 30px; } #fh5co-offcanvas ul li.cta a:hover { background: #fff; text-decoration: none; } #fh5co-offcanvas ul li.cta a:hover:after { display: none; } #fh5co-page { position: relative; z-index: 2; background: #fff; } #fh5co-offcanvas, .fh5co-nav-toggle, #fh5co-page { -webkit-transition: 0.5s; -o-transition: 0.5s; transition: 0.5s; } #fh5co-offcanvas, .fh5co-nav-toggle, #fh5co-page { position: relative; } #fh5co-page { z-index: 2; -webkit-transition: 0.5s; -o-transition: 0.5s; transition: 0.5s; } .offcanvas-visible #fh5co-page { -moz-transform: translateX(-275px); -webkit-transform: translateX(-275px); -ms-transform: translateX(-275px); -o-transform: translateX(-275px); transform: translateX(-275px); } #fh5co-header { position: absolute; z-index: 1001; width: 100%; margin: 10px 0 0 0; } @media screen and (max-width: 768px) { #fh5co-header { margin: 0px 0 0 0; } } #fh5co-header .header-inner { height: 70px; /* padding-left: 20px; padding-right: 20px; */ float: left; width: 100%; -webkit-border-radius: 7px; -moz-border-radius: 7px; -ms-border-radius: 7px; border-radius: 7px; } #fh5co-header h1 { float: left; padding: 0; font-weight: 700; line-height: 0; font-size: 30px; } #fh5co-header h1 a { color: white; } #fh5co-header h1 a > span { color: #00B906; } #fh5co-header h1 a:hover, #fh5co-header h1 a:active, #fh5co-header h1 a:focus { text-decoration: none; outline: none; } #fh5co-header h1, #fh5co-header nav { /* margin: 38px 0 0 0; */ margin: 0 0 0 0; } #fh5co-header nav { float: right; padding: 0; } @media screen and (max-width: 768px) { #fh5co-header nav { display: none; } } #fh5co-header nav ul { padding: 0; margin: 0 -0px 0 0; line-height: 0; } #fh5co-header nav ul li { padding: 0; margin: 0; list-style: none; display: -moz-inline-stack; display: inline-block; zoom: 1; *display: inline; } #fh5co-header nav ul li a { color: rgba(255, 255, 255, 0.7); font-size: 18px; padding: 10px; position: relative; -webkit-transition: 0.2s; -o-transition: 0.2s; transition: 0.2s; } #fh5co-header nav ul li a i { line-height: 0; font-size: 20px; position: relative; top: 3px; } #fh5co-header nav ul li a:after { content: ""; position: absolute; height: 2px; bottom: 7px; left: 10px; right: 10px; background-color: #fff; visibility: hidden; -webkit-transform: scaleX(0); -moz-transform: scaleX(0); -ms-transform: scaleX(0); -o-transform: scaleX(0); transform: scaleX(0); -webkit-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); -moz-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); -ms-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); -o-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); } #fh5co-header nav ul li a:hover { text-decoration: none; color: white; } #fh5co-header nav ul li a:hover:after { visibility: visible; -webkit-transform: scaleX(1); -moz-transform: scaleX(1); -ms-transform: scaleX(1); -o-transform: scaleX(1); transform: scaleX(1); } #fh5co-header nav ul li a:active, #fh5co-header nav ul li a:focus { outline: none; text-decoration: none; } #fh5co-header nav ul li.cta { margin-left: 20px; } #fh5co-header nav ul li.cta a { padding-left: 16px !important; padding-right: 16px !important; padding-top: 7px !important; padding-bottom: 7px !important; border: 2px solid rgba(255, 255, 255, 0.7); -webkit-border-radius: 30px; -moz-border-radius: 30px; -ms-border-radius: 30px; border-radius: 30px; } #fh5co-header nav ul li.cta a:hover { background: #fff; color: #00B906; } #fh5co-header nav ul li.cta a:hover:after { display: none; } #fh5co-header nav ul li.active a { text-decoration: none; color: white; } #fh5co-header nav ul li.active a:after { visibility: visible; -webkit-transform: scaleX(1); -moz-transform: scaleX(1); -ms-transform: scaleX(1); -o-transform: scaleX(1); transform: scaleX(1); } </code></pre> <p>Screenshot of Modal with Z-index higher than page header element: <a href="https://i.stack.imgur.com/L9Cl5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L9Cl5.png" alt="enter image description here"></a></p> <p>Screenshot of Modal with Z-index lower than page header: <a href="https://i.stack.imgur.com/MXTwc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MXTwc.png" alt="enter image description here"></a></p> |
19,768,210 | 0 | <p>Since no one else has taken a stab at it, I'll present my understanding of the problem (disclaimer: I'm not an expert on reinforced learning and I'm posting this as an answer because it's too long to be a comment)</p> <p>Think of it this way: when starting at, for example, node d, a random walker has a 50% chance to jump to either node e or node a. Each such jump reduces the reward (r) with the multiplier y (gamma in the picture). You continue jumping around until you get to the target node (f in this case), after which you collect the reward r.</p> <p>If I've understood correctly, the two smaller 3x2 squares represent the expected values of reward when starting from each node. Now, it's obvious why in the first 3x2 square every node has a value of 100: because y = 1, the reward never decreases. You can just keep jumping around until you eventually end up in the reward node, and gather the reward of r=100.</p> <p>However, in the second 3x2 square, with every jump the reward is decreased with a multiplier of 0.9. So, to get the expected value of reward when starting from square c, you sum together the reward you get from different paths, multiplied by their probabilities. Going from c to f has a chance of 50% and it's 1 jump, so you get r = 0.5*0.9^0*100 = 50. Then there's the path c-b-e-f: 0.5*(1/3)*(1/3)*0.9^2*100 = 4.5. Then there's c-b-c-f: 0.9^2*0.5^2*(1/3)^1*100 = 6.75. You keep going this way until the reward from the path you're examining is insignificantly small, and sum together the rewards from all the paths. This should give you the result of the corresponding node, that is, 50+6.75+4.5+... = 76.</p> <p>I guess the programmatic way of doing to would be to use a modified dfs/bfs to explore all the paths of length N or less, and sum together the rewards from those paths (N chosen so that 0.9^N is small).</p> <p>Again, take this with a grain of salt; I'm not an expert on reinforced learning.</p> |
33,929,762 | 0 | <p>I found that the Invoice resource was returning a type which ng-tables doesn't like. ng-tables version 0.4.3 expects a $defer object to be returned, so I had to wrap my query in a defer.resolve. Now it works.</p> <pre><code> $defer.resolve( Invoice.query params.url(), (data) -> orderedData = (if params.sorting then $filter('orderBy')(data, params.orderBy()) else data) # Sort return orderedData ) </code></pre> |
8,851,511 | 0 | Synchronize threads to the WEBrick server start <p>I am trying to start a small WEBrick server to mock a real API, to test a Ruby http client I am developing. I am using a modified solution of the one based in <a href="http://dynamicorange.com/2009/02/18/ruby-mock-web-server/#comment-4546" rel="nofollow">this</a> blog comment.</p> <p>It works fine, but the problem is that each time the server starts, the parent thread has to wait an arbitrary amount of time for the server to load. And after adding several tests it gets really slow.</p> <p>So my question is: <strong>is there a way to synchronize the parent thread to continue right after the server thread has finished starting WEBRick?</strong></p> <p>I tried looking at the WEBrick reference, searched the web and even had a look in the WEBrick code, but I got nothing I could use without some really nasty monkey patching.</p> <p>I'm open to other approaches to the problem, but I would like to keep it as dependency-free to gems and libraries as possible. Also, the solutions <strong>must</strong> run in <strong>Ruby 1.9.2</strong>, on <strong>Linux</strong>.</p> <p>Thanks in advance for the answers!</p> <pre><code>require "rack" class ApiMockServer def initialize(port = 4000, pause = 1) @block = nil @parent_thread = Thread.current @thread = Thread.new do Rack::Handler::WEBrick.run(self, :Port => port, :Host => "127.0.0.1") end sleep pause # give the server time to fire up… YUK! end def stop Thread.kill(@thread) end def attach(&block) @block = block end def detach() @block = nil end def call(env) begin unless @block raise "Specify a handler for the request using attach(block). The " + "block should return a valid rack response and can test expectations" end @block.call(env) rescue Exception => e @parent_thread.raise e [ 500, { 'Content-Type' => 'text/plain', 'Content-Length' => '13' }, [ 'Bad test code' ]] end end end </code></pre> |
4,791,400 | 0 | <p>You could add a variable to indicate when an animation is active and don't allow another one to start, if the previous one hasn't finished.</p> <pre><code>var isAnimating = false; $(function () { $('#dropMenu .level1 .submenu.submenu').hover(function() { if (!isAnimating) { $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).hide(1000); $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).show(1000); isAnimating = true; } }, function() { $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).show(1000); $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).hide(1000); isAnimating = false; });}); </code></pre> |
5,186,492 | 0 | Registering Custom WMI C# class/event <p>I have a project with a class that extend a WMI event and used to publish data through WMI. the class look like this (just few rows of the entire class):</p> <pre><code>[InstrumentationClass(InstrumentationType.Instance)] public class PointInstrumentation { private bool enabled = true; // static data public string UserName { get; set; } public string EffectiveUserName { get; set; } public string Environment { get; set; } public string Universe { get; set; } public int AppProcessId { get; set; } public string ProcessName { get; set; } public string AppHostName { get; set; } public string Keyword { get; set; } public string Version { get; set; } public string OrbAddress { get; set; } public string ApiVersion { get; set; } </code></pre> <p>..</p> <pre><code> public void Publish() { System.Management.Instrumentation.Instrumentation.Publish(this); </code></pre> <p>..</p> <p>as you can see, its extends using attribute declation "[InstrumentationClass(InstrumentationType.Instance)]"</p> <p>my issue is that when i register the dll, i don't see PointInstrumentation class in the WMI explorer, hence, i can't query what is being published.</p> <p>Can anyone please explain me what am i doing wrong and what the appropriate way to register WMI (c#) classes.</p> <p>Thanks</p> |
30,670,329 | 0 | <p>The problem is that <code>use</code> paths are <em>absolute, not relative</em>. When you say <code>use A;</code> what you are actually saying is "use the symbol <code>A</code> in the root module of this crate", which would be <code>lib.rs</code>.</p> <p>What you need to use is <code>use super::A;</code>, that or the full path: <code>use foo::A;</code>.</p> <p>I wrote up a an article on <a href="https://gist.github.com/DanielKeep/470f4e114d28cd0c8d43">Rust's module system and how paths work</a> that might help clear this up if the <a href="http://doc.rust-lang.org/book/crates-and-modules.html">Rust Book chapter on Crates and Modules</a> doesn't.</p> |
20,872,934 | 0 | <p>ASCII code of <code>'2'</code> is 50, and so on.</p> |
10,104,861 | 0 | The “System Roots” keychain cannot be modified <p>I have created the certificate and drop to Keychain Access for testing the application in ios device.This worked fine ,but i have one problem ,i am export the certificate from keychain Access for phonegap application.Now the keychain Access showing a warning ("The “System Roots” keychain cannot be modified.") while i am dragging Development Push SSL Certificate to Keychain Access and the old Development Provisioning Profiles do not working now .The ios application with old Development Provisioning Profiles give an error "Command /usr/bin/codesign failed with exit code 1"</p> <p>How can avoid this issue?</p> <p>if anybody know please help me.</p> |
27,876,649 | 0 | <p>The error line is the last line of your <code>models.py</code>:</p> <pre><code>votes = models.IntegerField(default= </code></pre> <p>It should be:</p> <pre><code>votes = models.IntegerField(default=0) </code></pre> |
22,311,005 | 0 | Android Google Map V2 - "unfortunately App has stopped" <p>I'm trying to display google map on my android app when user click on a button. when I click the button the app stops.No error in the code. I believe I've done everything right 1-I got the API KEY</p> <p>2-I added the Google_Play_Services_lib.jar to the dependencies folder</p> <p>3-added extra support tool</p> <p>4-included the permissions,my key to the manifest</p> <p>5-added fragment to my xml layout fie for the map</p> <p>please help I feel like I've read and watched every tutorial there is...nothing worked!</p> <p>My Log: </p> <pre><code>03-10 20:27:10.057: I/Process(17287): Sending signal. PID: 17287 SIG: 9 03-10 20:27:15.072: D/libEGL(17688): loaded /vendor/lib/egl/libEGL_adreno.so 03-10 20:27:15.072: D/libEGL(17688): loaded /vendor/lib/egl/libGLESv1_CM_adreno.so 03-10 20:27:15.082: D/libEGL(17688): loaded /vendor/lib/egl/libGLESv2_adreno.so 03-10 20:27:15.082: I/Adreno-EGL(17688): <qeglDrvAPI_eglInitialize:316>: EGL 1.4 QUALCOMM build: (CL4169980) 03-10 20:27:15.082: I/Adreno-EGL(17688): OpenGL ES Shader Compiler Version: 17.01.10.SPL 03-10 20:27:15.082: I/Adreno-EGL(17688): Build Date: 09/26/13 Thu 03-10 20:27:15.082: I/Adreno-EGL(17688): Local Branch: 03-10 20:27:15.082: I/Adreno-EGL(17688): Remote Branch: 03-10 20:27:15.082: I/Adreno-EGL(17688): Local Patches: 03-10 20:27:15.082: I/Adreno-EGL(17688): Reconstruct Branch: 03-10 20:27:15.122: D/OpenGLRenderer(17688): Enabling debug mode 0 03-10 20:27:16.683: D/AndroidRuntime(17688): Shutting down VM 03-10 20:27:16.683: W/dalvikvm(17688): threadid=1: thread exiting with uncaught exception (group=0x41931898) 03-10 20:27:16.693: E/AndroidRuntime(17688): FATAL EXCEPTION: main 03-10 20:27:16.693: E/AndroidRuntime(17688): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newandroid/com.example.newandroid.Mymap}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment 03-10 20:27:16.693: E/AndroidRuntime(17688): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295) 03-10 20:27:16.693: E/AndroidRuntime(17688): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 03-10 20:27:16.693: E/AndroidRuntime(17688): at android.app.ActivityThread.access$700(ActivityThread.java:159) </code></pre> <p>My code for Mymap activity p</p> <pre><code>ackage com.example.newandroid; import android.os.Bundle; //import android.app.Activity; import android.support.v4.app.FragmentActivity; public class Mymap extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mymap); } } </code></pre> <p>My layout </p> <pre><code><?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" > <fragment android:name="com.google.android.gms.maps.SupportMapFragment" xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> </code></pre> <p>Manifest</p> <pre><code> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.newandroid" android:versionCode="1" android:versionName="1.0" > <permission android:name="com.example.newandroid.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="com.example.newandroid.permission.MAPS_RECEIVE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="MainActivity"> android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.example.newandroid.Mymap" android:label="@string/title_activity_mymap" android:parentActivityName="com.example.newandroid.MainActivity" > <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.newandroid.MainActivity" /> </activity> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyAq44a-wWB4W6muJJqZ1DMH-livYscbiyk"/> </application> </manifest> </code></pre> <p>this is the MainActivity where the button is ,when clicked it should start Mymap activity.this is Mainactivity code</p> <pre><code>import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // TODO Auto-generated method stub } public void view_map(View view) { Intent intent = new Intent(this, Mymap.class); startActivity(intent); // Do something in response to button } } </code></pre> |
22,798,966 | 0 | <p>Right. Actually, you don't use xml for functions (that would be torture). You put your xml layouts in the <code>/layout</code> folder and then refer to elements to do stuff (like add listeners/whatnot) by doing something like <code>Button yourButton = (Button) <Activity instance>.findViewByID(R.id.your_button)</code>. </p> <p>See: <a href="http://developer.android.com/guide/topics/ui/declaring-layout.html" rel="nofollow">http://developer.android.com/guide/topics/ui/declaring-layout.html</a></p> <p>And if you really don't like xml, you can just do everything in java...</p> |
13,056,879 | 0 | <p>hi its an old library try this library <a href="https://github.com/vixnet/codeigniter-twitter" rel="nofollow">new twitter library</a></p> |
530,326 | 0 | <p><a href="http://freecol.sf.net/" rel="nofollow noreferrer">FreeCol</a>, an open source clone of the classic Sid Meier game, Colonization.</p> |
6,576,640 | 0 | <p>First off, there's lots of different home screen implementations on Android. The stock Android one, Samsung, HTC and Motorola all have their own variants, then third party ones like Launcher Pro. All use different stores as to what to keep on the home screen, may provide different profiles for the home screen (home, work, etc).</p> <p>Second, the home screen is prime real estate. And it is also the user's real estate. If there was programmatic access to the home screen, what happened to the Windows quick launch, desktop, favorites menu (in older versions of IE), and older pin area of the start menu (the very top of it in Win 95/98).</p> <p>To quote Raymond Chen <a href="http://blogs.msdn.com/b/oldnewthing/archive/2006/11/01/922449.aspx" rel="nofollow">"I bet somebody got a really nice bonus for that feature"</a>. So, in short, even if it was possible, please don't. As awesome as you think your program is, the user might not think the same.</p> |
39,432,927 | 0 | annotation information lost in scala 2.12 trait <p>Just updated a scala 2.11 + JavaFX project to 2.12.0-RC1, the code use java <code>@FXML</code> annotation intensively, e.g.</p> <pre><code>trait MainController { @FXML def onRun(event: ActionEvent) { val script = currentEngine.executeScript("editor.getValue()").toString runScript(script) } } <MenuItem mnemonicParsing="false" onAction="#onRun" text="Run"> <accelerator> <KeyCodeCombination alt="UP" code="R" control="UP" meta="UP" shift="UP" shortcut="DOWN"/> </accelerator> </MenuItem> </code></pre> <p>At runtime it throws error while executing <code>FXMLLoader.load</code>: </p> <pre><code>javafx.fxml.LoadException: Error resolving onAction='#onRun', either the event handler is not in the Namespace or there is an error in the script. </code></pre> <p>Seems that the <code>@FXML</code> annotation information has been lost during compilation. I have heard that in 2.12 all traits are compiled to interfaces, but how does this change cause the problem? Is there any workaround?</p> |
Subsets and Splits