text:
Q: What is the max number of actor instances for a given actor id for a given actor at any time in service fabric cluster? I am trying to understand the maximum number of actor id instances that will be executing a given method (on given actor interface) at any time in a given service fabric cluster. Here is my example:

*

*Lets say that I just defined an actor class called CustomerActor that derives from service fabric's Actor and implements ICustomerActor interface which has a single method called Process.

*Lets say that I have a client that sends message to ICustomerActor.Process method by using actorIds based on customer id. For this example, my customer id range is between 1 and 99. Therefore my actor id range is Customer/1 through Customer/99.

*Lets say that CustomerActor is configured with number of partitions = 9 and number of nodes = 3, meaning there may be 3 partitions per node.

*Assuming equal distribution of customer actorIds across all partitions, lets assume that partition 1 will serve customer ids 1 through 99/9 = 11, partition 2 will serve customer ids 12 through 22 etc.

*Lets assume that cluster was chugging along fine with equal distribution and no node failures occur for the purpose of this discussion.

*Now all of a sudden the client starts sending multiple requests (in quick succession) for a particular customer id (for whatever reason), say, Customer/8, which is in partition 1 and assume that cluster is currently only servicing customer/8 requests.

*Lets say that client just sent 20 requests for actor with id Customer/8.  Except for this customer actor id, there is no other traffic in the cluster.

*Lets say the client could send all above requests (without blocking on client side) because we are using reminders in CustomerActor class, which returns the control back to client immediately.

Here are my questions:

*

*Since actor model guarantees single thread programming, will there be only one instance of CustomerActor (mapped to actor id: Customer/8) that executes ICustomerActor.Process method in the entire cluster?. If so, does this mean there may be 19 requests queued up at most (assuming the 1st request has not finished yet)?

*Or will there be 3 instances (one per node) of CustomerActor (all mapped to actor id: Customer/8) that execute ICustomerActor.Process method simultaneously in the entire cluster? If so, does this mean there may be 19/3 requests queued up at most (assuming the 1st request on any node has not finished yet)?

*Or will there be 9 instances (one per partition across all nodes) of CustomerActor (all mapped to actor id: Customer/8) that execute ICustomerActor.Process method simultaneously in the entire cluster? If so, does this mean there may be 19/9 requests queued up at most (assuming the 1st request on any partition has not finished yet)?

*Or is there another behavior that I have not accounted for?

A: *

*There's one instance of one Actor, using one ID. Actor access is indeed 'single threaded access', so requests are queued up. (this answer is how it works)

*Actors are hosted inside an ActorService (stateful service), which has primary and secondary replicas. Actors themselves have no primary/secondary concept. ActorID determines the partition of the ActorService it's hosted in.

*Data is sharded across service partitions so no.

more reading:

*

*Actors overview

*Actor service


text:
Q: How to do two queries and combine to one answer? My tables look like this: tables
Output needs to look like this: output
But with my current code all I get is a blank answer nothing under Gamer or gsExperiencePoints. I believe I need to separate the questions and then combine the answer, but I'm not quite sure how to go about that would anyone be able to explain how to do that (I don't want the answer)
SELECT
    gamerFirst + ' ' + gamerLast as 'Gamer',
    gsExperiencePoints
FROM GAMER
    JOIN GAME_STAT ON GAMER.gamerID = GAME_STAT.gamerID
        JOIN GAME ON GAME_STAT.gameID = GAME.gameID
            JOIN DEVELOPER ON GAME.devID = DEVELOPER.devID
WHERE devName = 'Blizzard Entertainment' AND gsExperiencePoints = (SELECT MAX(gsExperiencePoints) AS gsExperiencePoints FROM GAME_STAT)
GROUP BY gsExperiencePoints, gamerFirst, gamerLast

A: If I understand correctly, you only need TOP 1 and ORDER BY:
SELECT TOP 1 gamerFirst + ' ' + gamerLast AS Gamer,
       gsExperiencePoints
FROM GAMER g JOIN
     GAME_STAT gs
     ON g.gamerID = gs.gamerID JOIN
     GAME g
     ON gs.gameID = g.gameID JOIN
     DEVELOPER d
     ON g.devID = d.devID
WHERE devName = 'Blizzard Entertainment'
ORDER BY gsExperiencePoints DESC;

redpajama_set_name: RedPajamaStackExchange


text:
Q: NAnt + MSBuild (4.0) == MSBuild launch failure w/directory not found error Ive got CC.Net and NAnt (and MSBuild) running on a new VM-based build server (Win7-64 Pro).
CC.Net can call MSBuild just fine - but I run into problems there when dealing with project-scope builds. The conditionals just dont have what I need. Not even close.
So I decide to deal with those conditions by calling MSBuild with NAnt, which fails every time. When I run the nant script from the command prompt, I get this:
[loadtasks] Failure scanning "C:\nant\bin\extensions\common\2.0\Collection
Gen.dll" for extensions. Could not load file or assembly 'Microsoft.VSDesigner,
Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of
its dependencies. The system cannot find the file specified.
Buildfile: file:///c:/c7/projects/dyndata/dyndata.build
Target framework: Microsoft .NET Framework 4.0
Target(s) specified: build

build:

[loadtasks] Scanning directory "c:\nantcontrib\bin\lib" for extension assemblies
.
     [echo] Building DynData v7.0.7

BUILD FAILED

c:\c7\projects\dyndata\dyndata.build(24,12):
Failed to start MSBuild.
    c:\c7\projects\dyndata\dyndata.build(24,12):
    External Program Failed: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbui
ld.exe (return code was 1)

Total time: 0.4 seconds.

c:\c7\projects\dyndata\dyndata.build(24,12):
Failed to start MSBuild.
    c:\c7\projects\dyndata\dyndata.build(24,12):
    'C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe' failed to start.

        The directory name is invalid

The Designer assembly is present on this machine, which has VS2010 Pro installed on it.
The build folder is correct.
The framework folder is correct.
Umpteen searches for nant/msbuild and this message have yielded nothing substantive.
These items have been tried and failed to change the results:
Nant msbuild task with .net 4.0 rc
.NET projects build automation with NAnt/MSBuild + SVN  (tho I am using Vault)
I tried to build the nant code so I could debug the problem via VS2010's debugger but the source project is an unworkable mess and wont even begin to build.
Ideas are welcome:)

A: I think the first error about Microsoft.VSDesigner is just a warning - not a failure. On my developer box and build server I have VS2005 and VS2010 Pro installed and I do not have Microsoft.VSDesigner version 7 installed. I have version 8 and 9 installed but not 7.
It looks like the "build" target is running in nant and then then it fails. You are loading the tasks from nantcontrib then trying to start msbuild. How are you starting msbuild? Could you post the part of the nant file that starts it? What version of nant are you using? Does running nant with -v and -debug+ flags show anything helpful?


text:
Q: is there a flash/JavaScript library that I can use for video trimming/cutting in my website? I want to provide functionality to the user so that they can cut video  from particular start time to end time. The most challenging part is I want this functionality ion client side so that user don't have to upload video to cut it. Is there a javaScript or flash library which I can use for this usecase?

A: I'm also looking for this. The only library that supports video cutting I've found so far is http://mbatle.wordpress.com/2011/11/02/illusions-in-the-web-a-real-time-video-editor-built-in-html5/, but I haven't tested it. I'm not sure if it can be used "out of the box". I would also prefer something more lightweight myself, but this might provide some useful insights. GIT repo: http://cgit.collabora.com/git/user/mbatle/webvideoeditor.git/.


text:
Q: Output not displayed i shiny app using shinydashboard I have a sliderInput in a menuItem which can be moved and the selected number needs to be displayed on the screen. Below is the code:
library(shiny)
library(shinydashboard)

sidebar <- dashboardSidebar(
            sidebarMenu(
                # Setting id makes input$tabs give the tabName of currently-selected tab
                menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"),
                         sliderInput("slider", "Slider Input", min = 0, max = 10, step = 1, value = 5))
                )
            )

body <- dashboardBody(
        tabItems(
            tabItem("dashboard", textOutput("Dashboard"))
            )
    )

ui <- dashboardPage(
    dashboardHeader(),
    sidebar,
    body)

server <- function(input, output, session) {
    output$Dashboard <- renderText({
        paste("You've selected:", input$slider)
    })
}

shinyApp(ui, server)

Ideally, I should see the number selected but that does not happen, unable to figure out where I am going wrong.

A: It looks like there's a problem when there is an input inside a menuItem. You can do:
sidebar <- dashboardSidebar(
  sidebarMenu(
    id="tabs",
    menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
    conditionalPanel(
      "input.tabs == 'dashboard'",
      sliderInput("slider", "Slider Input",
                  min = 0, max = 10, step = 1, value = 5))
  )
)

A: Below is the code which works.
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"),
               sliderInput("slider", "Slider Input", min = 0, max = 10, step = 1, value = 5))
    )
  ),
  dashboardBody(
    textOutput("dashboard")

  ))

server <- function(input, output, session) {
  output$dashboard <- renderText({
    paste("You've selected:", input$slider)
  })
}

shinyApp(ui, server)


text:
Q: the imported profile did not contain identities* error while submiting ios application to Apple i am trying to submit an application to the AppStore. At first i prepared the application for upload using iTunesConnect. This step seems to have worked fine. Afterwards i went to xcode and try to submit the application. When i am at the xcode organizer window at archives page , i press distribute , submit to the ios appstore, and then i get the error no identities are available for signing. Then i go to import development profile , i choose my profile which ends to .developmentprofile and then i get the error : The imported profile did not contain identities .Then i go to download entities and i get the error : an administrator must request identities before they are downloaded. I am the administrator . How can i request identities? Is there another way to solve this bug? I would really appreciate it if you would help me with this bug? Thank you in advance

A: I had the same problem: I reset my machine and it worked when I tried again.

A: follow the instructions in the below page:
App submission - iOS developer library


text:
Q: Split matrix according to specified order of values Sorry if this question's been asked before, but I can't seem to find an applicable answer!
I have this sort of matrix in Matlab:
1  0.2   0.3    1  5
1  0.25  0.36   1  6
1  0.3   0.3   -1  5
2  0.1   0.3    1  5
2  0.3   0.3   -1  5
2  0.6   0.4   -1  9 ......

The matrix is actually much longer and goes on to a value of 346 in the first column.
How can I split the matrix up into smaller matrices according to a specific order of the values in the first column? For example, I need the matrix of all the values where the first column = 160, 130, 256, 2 in that order?

A: Say M is your MatLab matrix. Then find(M(:,1) == 7) gives you the indices of those rows you are looking for. Also, you may do something like M(M(:,1) == 7,:) to access the corresponding submatrix

A: To do this with grep:
grep -E '^(160|130|256|2)[ \t]'

Update
In matlab you could use the comparison operator, e.g. if data is the matrix:
 data(data(:, 1) == 1, :)

Will return the sub-matrix where the first column value is one. To apply it to your example something like this would do:
subm = [];
for i=[160, 130, 256, 2]
   subm = [subm; data(data(:, 1) == i, :);
end


text:
Q: How to omit the last variable in an arglist using VBA When calling a function which has 3 arguments (a, b & c respectively) where the last two are optional. Excel seems to force me to always supply the latest variable. When not supplying argument c , I recieve a Compile Error /  Syntax Error.
But I don't understand why?
How to omit the last variable from an argument list?
Function
Function passing_variables(a, Optional b = 1, Optional c = 1)
    passing_variables = a * b * c
End Function

Does not work
Sub main_procedure
    Cells(17, 2) = passing_variables(2, 4 , )
End Sub

Works
Sub main_procedure
    Cells(17, 2) = passing_variables(2, ,4)
End Sub

Possible workaround is to provide named variables as stated by Microsoft Language reference

A: Maybe just a typo
Sub main_procedure
    Cells(17, 2) = passing_variables(2, 4)
End Sub

A: You just omit it. For example:
Sub Test()
    Debug.Print MyFunction(Var1:=2, Var2:=4)
    Debug.Print MyFunction(Var1:=2, Var2:=4, Inverse:=True)
End Sub

Function MyFunction(Var1 as Long, Var2 as Long, Optional Inverse as Boolean = False)
    MyFunction = Var1 * Var2
    If Inverse Then MyFunction = MyFunction * -1
End Function

In the first call, "Inverse" is omitted.


text:
Q: How can I add two and more buttons in python turtle I want to make 2 and more buttons working
I tried to change def name,add another py file and I have one result.Just one button was working
t.setpos(-170,-30)
t.pendown()
t.forward(300)
t.left(90)
t.forward(150)
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.penup()
t.write("START", font=("Calibri",80))
def btnclick(x,y):
   if x>-170 and x<130 and y>-30 and y<120:
      print("hello")
turtle.onscreenclick(btnclick)
turtle.listen()
t.setpos(170,-30)
t.pendown()
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.penup()
t.write("CREDITS", font=("Calibri",80))
def btnclick(x,y):
   if x>170 and x<430 and y>-30 and y<120:
      print("hello1")
turtle.onscreenclick(btnclick)
turtle.listen()

I want to make 2 and more buttons working

A: You have redefined the function btnclick() hence definition changes and previous one will not work. You should use if else in btnclick() to identify the clicktype and then suitable code inside the condition.
Here all three buttons are working fine simultaneously...
e.g.,
import turtle
t = turtle.Turtle()
t.pendown()
t.forward(300)
t.left(90)
t.forward(150)
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.penup()
t.write("START", font=("Calibri",80))
def btnclick(x,y):
    if x>-170 and x<130 and y>-30 and y<120:
        print("hello")
    elif x>170 and x<430 and y>-30 and y<120:
        print("hello1")
    elif x>-30 and x<-30+300 and y>-180 and y<-180+150:
        print('hello2')
turtle.onscreenclick(btnclick)
turtle.listen()
t.setpos(170,-30)
t.pendown()
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.penup()
t.write("CREDITS", font=("Calibri",80))
t.setpos(-30,-180)
t.pendown()
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.left(90)
t.forward(300)
t.left(90)
t.forward(150)
t.penup()
t.write("UB", font=("Calibri",80))
turtle.done()

I think this should help you....


text:
Q: Validation required in question preview screen in Android app What is there to preview without entering any details? There must be some validations before allowing to preview questions like "title is required", "tags are required", "body must contains >300 characters", etc.
One great thing to check is: such validations are already implemented in Answer section but not here yet.

A: We actually did this on purpose since you used to not be able to view the preview screen if the question wasn't postable for any reason, including automatic quality checks and not having any tags. This was a not friendly user experience since you can hit "preview" as many times as you want before actually submitting the question and having those checks work, so we removed it.
You make a good point though, and as of version 0.1.51 coming out soon you won't be able to preview a question without having at least a title and some body text.


text:
Q: Database_cleaner gem isn't cleaning I'm using Mongoid as my database and have configured my spec_helper.rb file as instructed on other Stackoverflow questions, however I'm still getting an error that the Object exists on subsequent tests.  So, database_cleaner isn't cleaning my test db as it should.
Here is my spec_helper.rb:
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rails/mongoid'
require 'mongoid-rspec'
require 'database_cleaner'

Mongoid.load!(Rails.root.join("config", "mongoid.yml"))

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
RSpec.configure do |config|
  config.mock_with :rspec
  #config.use_transactional_fixtures = true
  config.infer_base_class_for_anonymous_controllers = false
  config.order = "random"

  config.before(:suite) do
    DatabaseCleaner[:mongoid].strategy = :truncation
    DatabaseCleaner[:mongoid].clean_with(:truncation)
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end

And my rspec test file is simple:
describe Stock do
  it "should get created with only name and symbol" do
    stock = Stock.create(name: "Netflix", symbol: "NFLX")
    expect(stock.errors.full_messages).to eq []
  end
end

The output I'm getting is fine on first run (after I manually reset the db) with rake db:reset RAILS_ENV=test however every run after that I am getting:
Failures:

  1) Stock should get created with only name and symbol
     Failure/Error: expect(stock.errors.full_messages).to eq []

       expected: []
            got: ["Symbol is already taken"]

       (compared using ==)
     # ./spec/models/stock_spec.rb:6:in `block (2 levels) in <top (required)>'

What am I missing?

A: Well, after alot more reading, I've come to determine that database_cleaner and Mongo aren't playing well together.  While it's probably not the cleanest solution, it is simple:
In my spec_helper.rb file, I ended up adding this line to the RSpec.configure block:
config.after(:each) do
  Mongoid.purge!
end


text:
Q: Decrypt AES256 value created in Salesforce using C# Running the following Apex code in Salesforce, I encrypt a string:
public static String getEncryptedData() {
    Blob cryptoKey = Crypto.generateAesKey(256);

    String dataToEncrypt =  'Test string';

    Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, Blob.valueOf(dataToEncrypt));

    return EncodingUtil.base64Encode(encryptedData);
}

Assuming this implementation is correct, I need to decrypt it in C#. I have the following, but am seeing a "Padding is invalid and cannot be removed" error. (Sample key & encrypted string value, of course):
private string Decrypt(string encryptedbase64Password)
{
    RijndaelManaged aes256 = new RijndaelManaged();
    aes256.KeySize = 256;
    aes256.Mode = CipherMode.CBC;
    aes256.Padding = PaddingMode.PKCS7;
    aes256.BlockSize = 128;

    // Salesforce.com stores the first 16 bytes as the IV
    // Extract first 16 bytes as IV, the rest as the Key
    string keyAndIv = "Ii7oSjjWuhp6J6/hj/wmivqx1h3N2HzJ2ByJOy1n89E="; // sample from SFDC
    // hard coded for this example:
    encryptedbase64Password = "hRVlbM79aEQi8Tz7JJIL7CEhSxZAJvCh8Ni6ORP1C55+qbJzjDshBYBjyP12/zT2";
    byte[] allBytes = Convert.FromBase64String(keyAndIv);
    byte[] iv = new byte[16];
    Array.Copy(allBytes, 0, iv, 0, iv.Length);
    byte[] key = new byte[allBytes.Length - 16];
    Array.Copy(allBytes, 16, key, 0, key.Length);

    aes256.Key = key;
    aes256.IV = iv;

    ICryptoTransform decrypto = aes256.CreateDecryptor();
    byte[] encryptedbytes = Convert.FromBase64String(encryptedbase64Password);
    byte[] decryptedText = decrypto.TransformFinalBlock(encryptedbytes, 0, encryptedbytes.Length);
    string result = Convert.ToBase64String(decryptedText);

    return result;
}

What am I doing wrong?

A: User 'Doublehead Software" posted a correct solution over on the Salesforce developer boards.  It appears as though CryptoStream handles the padding issue correctly.  Full solution:
string plaintext;
byte[] Key = Convert.FromBase64String("Ii7oSjjWuhp6J6/hj/wmivqx1h3N2HzJ2ByJOy1n89E=");
string encryptedbase64Password = "hRVlbM79aEQi8Tz7JJIL7CEhSxZAJvCh8Ni6ORP1C55+qbJzjDshBYBjyP12/zT2";
byte[] IV = new byte[16];
byte[] phase = Convert.FromBase64String(encryptedbase64Password);
Array.Copy(phase, 0, IV, 0, IV.Length);
byte[] cipherText = new byte[phase.Length - 16];;
Array.Copy(phase, 16, cipherText, 0, cipherText.Length);

using (AesManaged aesAlg = new AesManaged())
{
    aesAlg.KeySize = 256;
    aesAlg.Mode = CipherMode.CBC;
    aesAlg.Padding = PaddingMode.PKCS7;
    aesAlg.Key = Key;
    aesAlg.IV = IV;
    // Create a decryptor to perform the stream transform.
    // NOTE: This is the difference between my original solution and the correct one.
    ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
    // Create the streams used for decryption.
    using (MemoryStream msDecrypt = new MemoryStream(cipherText))
    {
        using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
        {
            using (StreamReader srDecrypt = new StreamReader(csDecrypt))
            {
                // Read the decrypted bytes from the decrypting stream and place them in a string.
                plaintext = srDecrypt.ReadToEnd();
            }
        }
    }
}


text:
Q: Can a WinPhone Xamarin app be developed from Windows 10 Home I am trying to build and run the WinPhone project created from the default Blank App multi-project template for Xamarin.Forms Portable but I'm getting an error. The error refers to Hyper-V being needed for the WinPhone emulator. I do not have access to Hyper-V because I'm running Windows 10 Home edition.
My questions is this: is it even possible to develop an app that targets windows phones from a Windows Home computer? My thoughts were maybe I could emulate using something other than Hyper-V but I'm not sure where to start, or if I would hit other road-blocks.
In response to the other question related to this one, I'm specifically interested in windows 10 home edition, while the other post relates to windows 8. I'd like to know about possible solutions which may not have applied when the other question was asked 3 years ago.

A: Hyper-V cannot be installed in Windows 10 Home version.
The Windows Phone emulator won't run.
You could develop the application but can only test on a real device.


text:
Q: Why can't I extend this list onto another list def longest(s1, s2):
    combo = list(s1).extend(list(s2))
    print(combo)

Why doesn't combo become a concatenated list of s1 and s2? When I test it, it prints None instead.

A: The method list.extend mutates your list and returns None, thus you do not want to capture its returned value.
Also note that list.extend takes any iterable, so you do not need to cast s2 to a list.
def longest(s1, s2):
    s1.extend(s2)
    print(s1)

Although, as stated above this mutates your list s1 which might have side effects outside the function, you probably want to create a new list by concatenation instead.
def longest(s1, s2):
    combo = s1 + s2
    print(combo)

If you are using Python3, then a neater syntax exists.
def longest(s1, s2):
    combo = [*s1, *s2]
    print(combo)

A: The = is assignment operator, which assign the value on its right side to the variable on its left side. Keep this in mind all the time.
If there is just a Sting or Integer or List, it would be easy to understand. Since it is a value already. In your case, the value on right side provided by a built-in function list.extend. So we all know the return value is always None, not a list.
The basis understanding of assignment operator would help you out.


text:
Q: Does MySQL apply Encryption for Data at Rest by default? I went through this page of MySQL Doc . It is still not clear to me if the data stored in the filesystem (majorly as .ibd file) is encrypted by default or not for MySQL v8.0.x? I see bunch of info on the Tablespaces stating:

The mysql system tablespace contains the mysql system database and MySQL data dictionary tables. It is unencrypted by default.

Does it also mean that the stored data is not encrypted by default? Can someone help me point to the official doc where it says so?

A: Yes, data is unencrypted by default.
Prior to MySQL 8.0.16, you have to explicitly set the encryption to enable it, see e.g. for File-Per-Table Tablespace Encryption:

Prior to MySQL 8.0.16, the ENCRYPTION clause must be specified to enable encryption.

which of course implies that if you don't specify it, it is disabled by default.
Since MySQL 8.0.16, the behaviour is inherited:

As of MySQL 8.0.16, the default_table_encryption system variable defines the default encryption setting for schemas and general tablespaces. CREATE TABLESPACE and CREATE SCHEMA operations apply the default_table_encryption setting when an ENCRYPTION clause is not specified explicitly.

By default, a table inherits the encryption setting of the schema or general tablespace it is created in. For example, a table created in an encryption-enabled schema is encrypted by default. This behavior enables a DBA to control table encryption usage by defining and enforcing schema and general tablespace encryption defaults.

but the default value for default_table_encryption is off:

Default Value     OFF

Defines the default encryption setting applied to schemas and general tablespaces when they are created without specifying an ENCRYPTION clause.

The default_table_encryption variable is only applicable to user-created schemas and general tablespaces. It does not govern encryption of the mysql system tablespace.

Note that exisiting objects will not be encrypted automatically if you change the defaults, you have to alter them explicitly.


text:
Q: jQuery slimScroll plugin doesn't include indents inside child node jQuery slimScroll plugin after initialization doesn't take into account while calculates slimScrollDiv height. So, there's parent height less than real child's height. Difference is accurate equal to height of vertical margin and horizontal border width in child block. Therefore, scrollbar is always visible. Need to avoid this.
.parent(ref="dropdownScroll")
  .child
    ul
      li

window.$(this.$refs.dropdownScroll).slimScroll({
   height: 'auto',
   railVisible: true,
   size: '12px',
   color: '#ccc',
   railColor: '#fff',
   railOpacity: 1,
});

.child
  margin-bottom 30px
  border 1px solid black

So, child is scrolling, even if no reason for it.

A: I don't know how it works, but replace margin-top instead margin-bottom has handled this issue. There's a few children and everything is ok


text:
Q: erase one line layer by another line layer I keep on having this issue and I can't find the "perfect answer":
First of all, I work in ArcGIS 9.3.1.
I have 2 layers: roads1950, roads2000. I need to make a layer with roads which were built/changed between 1950-2000. The most perfect thing was to have a "erase-like" tool that would cut out the identical to roads1950 features in roads2000. The problem is that the erase tool only works with polygon layers. I could do a merge and sow out the doubles but it's a (very) long process and it isn't accurate.
Do you know of a tool/method that could help me ?

A: For the Erase tool, only the erase features must be polygons. Input features can be point, lines or polygons. How about buffering a few meters the roads2000 layer and using it as the erase features on the roads1950.
As a side note, in ArcGIS Desktop 10, erase features can be of any type.
Ref:

*

*http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=How%20Erase%20%28Analysis%29%20works

*http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000000m000000.htm

A: Think you are looking for Symmetrical Difference
http://webhelp.esri.com/arcgiSDEsktop/9.3/index.cfm?TopicName=How%20Symmetrical%20Difference%20%28Analysis%29%20works
Features or portions of features in the input and update features that do not overlap will be written to the output feature class.

A: If by "method" you mean arcobjects, then consider the ITopologicalOperator.Difference method. It works with lines, but they need to precisely coincide.

A: If the older roads (the ones you want to "erase") have exactly the same geometry as the older roads in the 2000 dataset, you can do a Select by Location with the choice "are identical to" in order to select the pre1950 road features in the 2000 road dataset.  Start the edit session before your selection, then just delete the selected set and you're left with post1950 road features.

A: You might try creating a topology with both datasets and set a rule saying roads1950 must be overlapped by roads2000.  The errors would be roads abandoned since 1950.
Then set a different rule saying roads2000 must be overlapped by roads1950.  The errors would be the roads built since 1950.


text:
Q: GetThreadDescription() -> What is the proper declaration in C#? What is the proper method declaration / DllImport for GetThreadDescription() for C#?
Here is what I have thus far:
[DllImport("kernel32.dll", SetLastError = true)]
    public static extern UIntPtr GetThreadDescription(UIntPtr hThread, [Out, MarshalAs(UnmanagedType.LPWStr)] out string ppszThreadDescription);
[DllImport("kernel32.dll")]
        static extern UIntPtr OpenThread(ThreadAccess dwDesiredAccess, bool bInheritHandle, uint dwThreadId);

   public static void Suspend(this Process process)
    {
        foreach (ProcessThread thread in process.Threads)
        {
            var pOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)thread.Id);
            if (pOpenThread == UIntPtr.Zero)
            {
                break;
            }
            string threaddescription = string.Empty;
            GetThreadDescription(pOpenThread, out threaddescription);
            System.Diagnostics.Debug.WriteLine("Thread Description: " + threaddescription);
            SuspendThread(pOpenThread);
        }
    }

The string it returns is empty. Changing the MarshalAs to different types of strings has, thus far, yielded nothing. I checked pinvoke.net, and could not find it.


text:
Q: How to create a binary tree from a frequency dictionary I'm fairly new to coding and I'm having difficulty creating a huffman algorithm to encode and decode text files. I understand most of the concepts pretty well but there's not much on exactly how you would create and traverse the tree.
Here's my code so far:
with open(input('enter a file: ')) as name:
    fh = name.read()
    print(fh)

#create the frequency dicitonary
freqdict = {}
for ch in fh:
    if ch in freqdict:
        freqdict[ch] += 1
    else:
        freqdict[ch] = 1
freqdict = sorted(freqdict.items(), key = lambda x:
x[1], reverse = True)
print(freqdict)

class Node:
    def __init__(self, left = None, right = None,
data):
        self.left = left
        self.right = right
        self.data = data

    def children(self):
        return (self.left, self.right)

    def nodes(self):
        return (self.left, self.right)

    def __str__(self):
        return str(self.left, self.right)

A: Modified version of : https://rosettacode.org/wiki/Huffman_coding#Python
This is a Huffman encoder/decoder for any message in 'txt'
This encodes the txt message into a shortened binary variable for storage ( You can store the compressed_binary to disk.  You can also decode the compressed_binary using decompressHuffmanCode, which recreates the original string from the compressed string of compressed_binary
from heapq import heappush, heappop, heapify
from collections import defaultdict
from functools import reduce

def encode(symb2freq):
    heap = [[wt, [sym, ""]] for sym, wt in symb2freq.items()]
    heapify(heap)
    while len(heap) > 1:
        lo = heappop(heap)
        hi = heappop(heap)
        for pair in lo[1:]:
            pair[1] = '0' + pair[1]
        for pair in hi[1:]:
            pair[1] = '1' + pair[1]
        heappush(heap, [lo[0] + hi[0]] + lo[1:] + hi[1:])
    return dict(sorted(heappop(heap)[1:], key=lambda p: (p, len(p[-1]))))

# recreates the original message from your huffman code table
# uncomment print(a) to see how it works
def decompressHuffmanCode(a, bit):
    # print(a)
    return ('', a[1] + s[a[0]+bit[0]]) if (a[0]+bit[0] in s) else (a[0]+bit[0], a[1])

txt="CompresssionIsCoolWithHuffman"

# Create symbol to frequency table
symb2freq = defaultdict(int)
for ch in txt:
    symb2freq[ch] += 1
enstr=encode(symb2freq)

# Create Huffman code table from frequency table
s=dict((v,k) for k,v in dict(enstr).items())

# Create compressible binary. We add 1 to the front, and remove it when read from disk
compressed_binary = '1' + ''.join([enstr[item] for item in txt])

# Read compressible binary so we can uncompress it. We strip the first bit.
read_compressed_binary = compressed_binary[1:]

# Recreate the compressed message from read_compressed_binary
remainder,bytestr = reduce(decompressHuffmanCode, read_compressed_binary, ('', ''))
print(bytestr)

which results in:
CompresssionIsCoolWithHuffman

This is a quick implementation that should help. Things that can be dealt for programmatically is the buffer, but i just wanted to show you a quick implementation using your frequency codes

A: I think it will be sufficient to use the python dictionary structure to represent trees and nodes. You don't really need a separate class for it.
You want to initialize all your nodes:
def huffman_tree(freq_dict):
    vals = freq_dict.copy()
    nodes = {}
    for n in vals.keys():
        nodes[n] = []

Here we have initialized a dictionary nodes to represent nodes and leafs. Let's populate it with data; within the same function:
    while len(vals) > 1:
        s_vals = sorted(vals.items(), key=lambda x:x[1])
        a1 = s_vals[0][0]
        a2 = s_vals[1][0]
        vals[a1+a2] = vals.pop(a1) + vals.pop(a2)
        nodes[a1+a2] = [a1, a2]

You see that I first now sort the data from our frequency-dictionary, ascending. You did it earlier, so you shouldn't have to do that now (although you did it descending). Though, doing it later rather than sooner, and within such a while-loop, lets you be more freely with which frequency-dictionary you pass to your program. What we're doing here furthermore, is that we're taking two and two items from the freq_dict when sorted, adding them together and storing them in the freq_dict.
Now we need to go through our freq_dict, and construct some sort of symbols-dictionary, representing a rules-set for exchanging text with symbols. Still within the same function:
    symbols = {} # this will keep our encoding-rules
    root = a1+a2 # a1 and a2 is our last visited data,
                 # therefore the two largest values
    tree = label_nodes(nodes, root, symbols)

    return symbols, tree

The line with tree = ... might seem like a bit of magic here, but that's because we haven't created the function yet. But imagine there's a function that recursively go through each node from the root to the leafs, adding a string-prefix of either '0' or '1' representing the encoded symbol (and that's why we sorted ascending, so that we got the most frequent word at the top, receiving the smallest encoded symbol):
def label_nodes(nodes, label, symbols, prefix = ''):
    child = nodes[label]
    tree = {}
    if len(child) == 2:
        tree['0'] = label_nodes(nodes, child[0], symbols, prefix+'0')
        tree['1'] = label_nodes(nodes, child[1], symbols, prefix+'1')
        return tree
    else: # leaf
        symbols[label] = prefix
        return label

This function does just that. And now we're ready to use it:
def huffman_encode(string, symbols):
    return ''.join([symbols[str(e)] for e in string])

text =  '''This is a simple text, made to illustrate how
        a huff-man encoder works. A huff-man encoder works
        best when the text is of reasonable length and has
        repeating patterns in its language.'''

fd = freq_dict(text)
symbols, tree = huffman_tree(fd)
huffe = huffman_encode(text, symbols)
print(huffe)

Out: 001001011001110100011011101000110110100100111101011000110011010010000011011000110000110110010011011100011010111010000011011110110111010100101001011101100111011111001010101100001110011101111110010011101010101010101011010011100111101100101001011111100110001101010000100010001111101110111110100001110001111100110111110011111100011111111101110000001110011110110010100101111110011000110101000010001000111110111011111010000111000111110011011111001111110001110011101010101010101010010000000011101101111100110010001000011011110010000110110001100001101101110100011011101100101011110000010100011110111000101000100010010000011001000010001111011011110010110101000111010011100110100011100111010101010101010111100000100110000101010111101010001111010110011010101011101100011100100000110111010100001110101011001101100101010100011110111101110101111010001111111

Decoding is a simple matter of traversing the tree:
def huffman_decode(encoded, tree, string=False):
    decoded = []
    i = 0
    while i < len(encoded):
        sym = encoded[i]
        label = tree[sym]
        # Continue untill leaf is reached
        while not isinstance(label, str):
            i += 1
            sym = encoded[i]
            label = label[sym]
        decoded.append(label)
        i += 1
    if string == True:
        return ''.join([e for e in decoded])
    return decoded

print(huffman_decode(huffe, tree, string=True))

Out: This is a simple text, made to illustrate how
          a huff-man encoder works. A huff-man encoder works
          best when the text is of reasonable length and has
          repeating patterns in its language.

This answer is in large parts stolen from my own GitHub: https://github.com/RoyMN/Python/tree/master/tools/text_handler


text:
Q: Prove that the equation $x^3+y^3+z^3-(x^2z+y^2x+z^2y)=2$ has no solution in natural numbers I asked myself which primes $p$ can be written as $p=x^3+y^3+z^3-(x^2z+y^2x+z^2y)$ with $x,y,z \in \mathbb{N}$.
 But for $p \neq 2$ we have the solution $x=y=\frac{p-1}{2}$ and $z=\frac{p+1}{2}$. So the only prime for which I can not find a solution is $p=2$. But I can not prove that there is not a solution.
Any ideas?

A: EDIT: You're right stackExchangeUser; my proof doesn't work. With a similar tack, we can still salvage this:
\begin{align*}
&x^3 + y^3 + z^3 - (x^2 z + y^2 x + z^2 y) \\
= ~ &(x + y + z)^3 - 4(x^2 z + y^2 x + z^2 y) - 3(x^2y + y^2 z + z^2 x) - 6xyz
\end{align*}
So, we are solving,
$$(x + y + z)^3 = 2 + 4(x^2 z + y^2 x + z^2 y) + 3(x^2y + y^2 z + z^2 x) + 6xyz$$
Suppose first the left side is divisible by $2$. Again, at least one of $x, y, z$ must be even. If all of them are even, we see that the left side is $0$ mod $8$, but the right side is $2$ mod $8$. Thus, exactly one must be even. But then, the $3(x^2y + y^2 z + z^2 x)$ term is odd, which makes the right hand side odd, and we get a contradiction again.
Thus, the left side is odd. Similarly, either all of $x, y, z$ are odd, or exactly one is. If exactly one of them is odd, then the right hand side is even, hence all $x, y, z$ are odd.
Finally, considering the original formulation, and the fact that $x^2 \equiv 1$ mod $8$ for all odd $x$, we get,
$$x^3 + y^3 + z^3 - (x^2 z + y^2 x + z^2 y) \equiv x + y + z - (z + x + y) \equiv 0$$
mod $8$, which cannot equal $2$.


text:
Q: Append aggregate data column to panel data in R I'm working with a set of panel data which looks like this:
> head(data)
      date  id    value
1998-12-31  AB89  120.3
1998-12-31  BC12  89.3
1998-12-31  SU16  56.3
.
.
.
1999-06-31  SU16  526.3
1999-06-31  AB89  80
1999-06-31  ZP32  15
.
.
.

And so on.  I would like to append a column to the data so that it gives the quintile that row belongs to on that date.  E.g.:
> head(data)
      date  id    value   quintile
1998-12-31  AB89  120.3   1
1998-12-31  BC12  89.3    2
1998-12-31  SU16  56.3    5
.
.
.
1999-06-31  SU16  526.3   1
1999-06-31  AB89  80      4
1999-06-31  ZP32  15      5
.
.
.

To clarify, AB89's value of 120.3 would put it in the first quintile out of all the possible values on 1998-12-31.
I've looked at plyr and tried playing around with the function ddply but it's taking me a long time to figure it out.

A: If you use dplyr you could do something like this. Please note that I modified your data. In the data, date is in character. But, even if you have date object, you should have the same result.
library(dplyr)

foo %>%
    group_by(date) %>%
    mutate(quintile = ntile(desc(value),5))

#         date   id value quintile
#1  1998-12-31 AB89 120.3        1
#2  1998-12-31 BC12  89.3        2
#3  1998-12-31 SU16  56.3        3
#4  1998-12-31 SU16  20.3        4
#5  1998-12-31 SU18   9.3        5
#6  1999-06-31 SU16 526.3        1
#7  1999-06-31 AB89  80.0        3
#8  1999-06-31 ZP32  15.0        5
#9  1999-06-31 AB99  40.0        4
#10 1999-06-31 AS33 130.0        2
#11 1999-06-31 ZP32 200.0        1

DATA
foo <- structure(list(date = c("1998-12-31", "1998-12-31", "1998-12-31",
"1998-12-31", "1998-12-31", "1999-06-31", "1999-06-31", "1999-06-31",
"1999-06-31", "1999-06-31", "1999-06-31"), id = c("AB89", "BC12",
"SU16", "SU16", "SU18", "SU16", "AB89", "ZP32", "AB99", "AS33",
"ZP32"), value = c(120.3, 89.3, 56.3, 20.3, 9.3, 526.3, 80, 15,
40, 130, 200)), .Names = c("date", "id", "value"), class = "data.frame", row.names = c(NA,
-11L))


text:
Q: Custom Razor HTML Markup I'm looking into creating a custom helper to do the following:
 Item

I know that @Html.RouteLink(...) will handle the anchor for you but I wanted to insert the " " tag to it.
Other than to write a custom method to manipulate the string, I was wondering if there was a cleaner solution to this?
Thanks

A: Two options:

*

*Use new { @class = "myClass" } as parameters to the helper and apply css to the link to make it bold.

*Manually create the anchor's URL (<a href="@Url.RouteUrl(...)) to the path you want using Url.RouteUrl

A: You can write your extension of ActionLink. Look at this article. the author wrote about extending to have Img link, but you can get the idea and info to do your own extension

A: I would create an anchor with a class so you put your styling in CSS instead of making the html heavier and define the style of the page.


text:
Q: error C2593: 'operator =' is ambiguous when i compile in VS 2003 ent i get these errors
C:\SRC\Program\_Interface\FuncTextCmd.cpp(953): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(958): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(963): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(968): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(973): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(978): error C2593: 'operator =' is ambiguous
C:\SRC\Program\_Interface\FuncTextCmd.cpp(982): error C2593: 'operator =' is ambiguous

this is this part of FuncTextCmd.cpp it's referring to
BOOL TextCmd_CHANGEGLOW( CScanner& scanner )
{//98
#ifdef __WORLDSERVER
CUser* pUser    = (CUser*)scanner.dwValue;
scanner.GetToken();
CString strcr = scanner.Token;
CString CHANGEGLOW;

if( 2 <= strcr.GetLength() && strcr.GetLength() <= 7)
{
strcr.MakeLower();

if( strcmp( strcr, "RED" ) == 0 )
{
CHANGEGLOW = 1;//line 953
}
else
if( strcmp( strcr, "BLUE" ) == 0 )
{
CHANGEGLOW = 2;//line 958
}
else
if( strcmp( strcr, "GREEN" ) == 0 )
{
CHANGEGLOW = 3;//line 963
}
else
if( strcmp( strcr, "YELLOW" ) == 0 )
{
CHANGEGLOW = 4;//line 968
}
else
if( strcmp( strcr, "ORANGE" ) == 0 )
{
CHANGEGLOW = 5;//line 973
}
else
if( strcmp( strcr, "PINK" ) == 0 )
{
CHANGEGLOW = 6;//line 978
}
else if( strcmp( strcr, "PURPLE" ) == 0 )
{
CHANGEGLOW = 7;//line 982
}
else
{
strcr += "unknown glow";
pUser->AddText( strcr );
return FALSE;
}
}
else
{
strcr += "unknown glow";
pUser->AddText( strcr );
return FALSE;

}//2

#endif // __WORLDSERVER
return TRUE;
}

this is for a game by the way it's in c++
the part above is saying if the user types said colors in the chat box then the glow around their body will change to what they typed but this is only the command the main part of this feature is handled in Mover.cpp of my source then part for glow can be seen below
void CMover::CreateAbilityOption_SetItemSFX( int nAbilityOption )
{
extern DWORD CHANGEGLOW;
DWORD dwSfx = 0;

switch( nAbilityOption )
{
case 3: dwSfx = XI_GEN_ITEM_SETITEM03; break;
case 4: dwSfx = XI_GEN_ITEM_SETITEM04; break;
case 5: dwSfx = XI_GEN_ITEM_SETITEM05; break;
case 6: dwSfx = XI_GEN_ITEM_SETITEM06; break;
case 7: dwSfx = XI_GEN_ITEM_SETITEM07; break;
case 8: dwSfx = XI_GEN_ITEM_SETITEM08; break;
case 9: dwSfx = XI_GEN_ITEM_SETITEM09; break;
case 10: dwSfx = CHANGEGLOW; break;
}

switch( CHANGEGLOW )
{
case 1: dwSfx = RED; break; //make sure that the uppercase RED is what
//you defined in defineobj.h
case 2: dwSfx = BLUE; break; //make sure that the uppercase BLUE is what
// you defined //in defineobj.h
case 3: dwSfx = GREEN; break; //make sure that the uppercase GREEN is what you
//defined in defineobj.h
case 4: dwSfx = YELLOW; break; //make sure that the uppercase YELLOW is what you
//defined in defineobj.h
case 5: dwSfx = ORANGE; break; //make sure that the uppercase ORANGE is what you
//defined in defineobj.h
case 6: dwSfx = PINK; break; //make sure that the uppercase PINK is what you
//defined in defineobj.h
case 7: dwSfx = PURPLE; break; //make sure that the uppercase PURPLE is what you
//defined in defineobj.h
}

//else
//case 10: dwSfx = XI_GEN_ITEM_SETITEM10; break;

CSfxPartsLinkShoulder* pSfx = NULL;
D3DXVECTOR3 v3Scal = D3DXVECTOR3( 1.0f, 1.0f, 1.0f );

if( nAbilityOption == 3 )
{
    // ¾î±ú
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 0;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 1;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
/*
else
if( nAbilityOption == 4 )
{
    // ¸öÅë
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 6;
    pSfx->SetScale(D3DXVECTOR3( 2.2f, 2.2f, 2.2f ));
}
*/
else
if( nAbilityOption == 4 )
{
    // ¸öÅë
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 6;
    pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f ));
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 5 )
{
    // ¾î±ú
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 0;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 1;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¾î±ú, Æȸñ Áß°£
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 4;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 5;
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 6 )
{
    // ¾î±ú
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 0;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 1;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¾î±ú, Æȸñ Áß°£
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 4;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 5;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // Æȸñ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 2;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 3;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 7 )
{
    // ¾î±ú
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 0;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 1;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¾î±ú, Æȸñ Áß°£
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 4;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 5;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // Æȸñ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 2;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 3;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¼Õ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 8;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 9;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 8 )
{
    // ¾î±ú
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 0;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 1;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¾î±ú, Æȸñ Áß°£
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 4;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 5;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // Æȸñ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 2;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 3;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¼Õ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 8;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 9;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;

    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 9;
    pSfx->m_v3Offset.y = 0.2f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 9 )
{
    // ¾î±ú
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 0;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 1;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¾î±ú, Æȸñ Áß°£
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 4;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 5;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // Æȸñ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 2;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 3;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¼Õ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 8;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 9;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¹ß
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 26;
    pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f ));
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 29;
    pSfx->SetScale(D3DXVECTOR3( 1.5f, 1.5f, 1.5f ));
    pSfx->m_nOldAbilityOption = nAbilityOption;

    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 9;
    pSfx->m_v3Offset.y = 0.2f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
else
if( nAbilityOption == 10 )
{
    // ¾î±ú
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 0;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 1;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¾î±ú, Æȸñ Áß°£
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 4;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 5;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¸öÅë
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 6;
    pSfx->SetScale(D3DXVECTOR3( 3.0f, 4.5f, 3.0f ));
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 7;
    pSfx->SetScale(D3DXVECTOR3( 3.0f, 3.0f, 3.0f ));
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¼Õ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 8;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 9;
    pSfx->m_v3Offset.y = 0.1f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // Æȸñ
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 2;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 3;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    // ¹ß
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 26;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, dwSfx, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 29;
    pSfx->m_nOldAbilityOption = nAbilityOption;

    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 8;
    pSfx->m_v3Offset.y = 0.2f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
    pSfx = (CSfxPartsLinkShoulder*)CreateSfx( D3DDEVICE, XI_SETIEM_EFFECTHAND, GetPos(), GetId(), GetPos(), GetId(), -1 );
    pSfx->m_nPartsLink = 9;
    pSfx->m_v3Offset.y = 0.2f;
    pSfx->m_nOldAbilityOption = nAbilityOption;
}
}

#endif //__CLIENT

A: In the first code snippet, you defined CHANGEGLOW to be a CString, and then you assign a number. It is no surprise that this doesn't work. Given that in the second snippet you declared it as DWORD I guess that's what you actually wanted. So the fix probably is to just change CString to DWORD in that definition. Actually, probably extern DWORD because otherwise it's a local variable to the function and assigning it won't have any lasting effect.
Actually I wonder why you locally declare it anyway. Since you cannot reuse the identifier globally, and have to define it somewhere globally anyway, is there any reason not to have a global declaration at the beginning of the file (or, better, in some header file)?

A: You're trying to assign numeric literals (1, 2, 3 etc) to a variable of type CString. Even if that compiled, it would seem like a bad idea to me. Perhaps you want a different variable type, e.g. int? Given that you're later going to switch on the value of it, it looks like you want some sort of numeric type, anyway...

A: Your type is wrong in FuncTextCmd.cpp. You have
CString CHANGEGLOW;

when it should be
DWORD CHANGEGLOW;


text:
Q: How to draw a 3d Teechart which have cubes in it I have data like this(x_pos, y_pos, z_pos, Length, height, depth). I need to draw cube by using this information. Can any one help me to do draw Teechart for this. give me some sample code for this.

A: Yes, you can do it with custom canvas drawing using the Cube(Rectangle r, int z0, int z1) method in TChart's AfterDraw event, for example:
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
  int x = 100;
  int y = 100;
  int z = 0;
  int width = 50;
  int height = 50;
  int depth= 10;

  DrawCube(x, y, z, width, height, depth, g);
}

private void DrawCube(int x, int y, int z, int width, int height, int depth, Steema.TeeChart.Drawing.Graphics3D g)
{
  Rectangle r = new Rectangle(x, y, width, height);
  g.Cube(r, z, z + depth);
}


text:
Q: Android image squashed I have an image with a resolution of 1024x1024 pixels.

But, when I try to use this image in my Android app (background activity) it is squashed.

Can anyone tell me how to avoid this?
Now this issue has been fixed by using following code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:scaleType="centerCrop"
        android:src="@drawable/image" />
</RelativeLayout>

But this solution can not use for following code:
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:scaleType="centerCrop"
        android:background="@drawable/frontscreenbg"/>

    <ScrollView android:id="@+id/scrollviewParentLoginContainer"
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:wheel="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fillViewport="true">

        <LinearLayout
            android:id="@+id/linearLayoutLoginContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical"
            android:paddingLeft="24dp"
            android:paddingRight="24dp">

Please help me.

A: Don't set the image as the background of your root layout. Try this:
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/your_background_image"
        android:scaleType="centerCrop"/>
      ...
     /* Your other UI elements */
      ...
</RelativeLayout>

You can't set scale type in a RelativeLayout

A: You have to set the Scale Type option of your ImageView to CENTER_CROP (see here: http://developer.android.com/reference/android/widget/ImageView.ScaleType.html)
you can do it programmatically using the setScaleType() method of ImageView or adding it to your xml layout using android:scaleType="centerCrop"
EDIT:
If you want to add the background directly to your layout, you have to create a custom drawable object inside the /res/drawable directory. Try to use something like this:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/background_image"
    android:tileMode="repeat" />

A: Just use following code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:scaleType="centerCrop"
        android:src="@drawable/image" />
</RelativeLayout>

This should resolve your issue.


text:
Q: What is ideal software setup for programming web applications (editing php, javascript, xhtml, css)? I've been developing web applications for 2 years now, and have been into simpler web pages for many more. I've been using Notepad, then ConText, then Crimson Editor (was my favorite for a long time) and I've been trying with Notepad++. I have NetDrive setup so I can edit and save files directly on the ftp server. On Firefox I use the Web Developer extension, Firebug and a couple more.
As my skills grow and need to do more stuff than before, I'm facing some limitations such as doing some versioning, tracking changes on the code, reverting back to an older version, these things I do them manually. Also I want to be portable so I'm trying to setup everything webdev-related in a Dropbox folder so I can sync it and have a functioning developer setup everywhere I go.
I'm wondering what software would you suggest for web app developing and how can it be setup to be portable or in the cloud?

A: I thinks it depends on whether you achieve a full-featured IDE or a collection of tools that do their job separately.
After using many editors on different platforms, I use Eclipse and Vi now: For small scripts that have to be changed quickly, Vi is the perfect editor, and it's available for every important platform, but it takes some time to lern the shortcuts.
But since most Web projects grow rapidly in size, I got need of a IDE which suits all my needs:

*

*Subversion integrated

*Code completion and helpful function for different languages (Python, PHP, HTML, even C++)

*Availability on Mac, Windows and Linux

*Open Source

*Extensible via Plugins

*Fully configurable

Eclipse does this all and much more. All the project stuff is placed in a workspace-directory, which you can sync via Dropbox or anything else if you want (since I would recommend storing project files in a repository rather than on a simple Webdav place).

A: Jetbrains' Web IDE is currently in beta and should be released before the end of the year. You can already download and use EAP releases. It will be commercial but might have a free/community version (as was recently announced for IntelliJ IDEA).
It's getting quite good with support for PHP, HTML, CSS and Javascript. It also has good version control integration (Git and Subversion are the two I've used) and has local change tracking (so you don't even need to check in to something to see old versions and revert them; it does this automatically).
That and a convenient distro like XAMPP is all you really need (well and Firebug).

A: I use Zend Studio (http://www.zend.com/en/products/studio/) as my IDE. It's not perfect (nor free), but I haven't found anything I like better and it has definitely sped up my development time. It really shines as a PHP editor, has a nice XML editor, decent HTML editor, and so-so JavaScript editor. But since it's built on the Eclipse platform, it should be possible to install plug-ins/mods. If you're like me and your main focus is PHP, with the other three languages taking a backseat, then I imagine this will suit you fine.
I wish I could tell you more about versioning, but I don't know much about this :/ I do know that Studio has a built in SVN manager. It also supports remote connections through FTP. I also use Dropbox, and there is no problem in using the two combined.
I've checked out NetBeans, and a few other IDEs, but there are so many small features/shortcuts that Studio has that the others don't that force me back to Studio. I will add these caveats though: Studio is memory hungry, and code hinting is much slower in the latest version than the previous (though they claim this will be resolved.) I suggest downloading the demo and seeing how you like it for yourself.

A: Try which editor you like the best. I used Aptana and different other editors (eg.: Zendstudio) a while ago, but I always go back to Geany (but I am on Linux) and a bunch of commandline tools.
You have to figure out yourself what is the best enviroment for you.

A: The editor part is totally up to you, I use both PHP Eclipse and Vim. I don't think versioning integration in IDE is that important but code completion and syntax error control sure do help.
Look into SVN and TortoiseSVN - it provides comfortable version control and you can use your sources from anywhere with an svn client and it's a must when you start working on one project with other people.

A: For the last year I've been contentedly developing using NetBeans 6.7 with [xdebug][2], Firebug 1.4 and [Darcs][3] as version control.  The whole setup is portable, so I can use it on any windows machine and has proved very reliable; can't recommend it enough.
NetBeans covers all the bases: HTML, CSS, JavaScript and PHP with auto-complete and the xdebug integration, once you get it working, is excellent.  Darcs is console only, but its so straightforward to use that you just don't miss the GUI.  I use [Console2][4] to work with Darcs.


text:
Q: Wrap tag around a certain number of elements in grid So currently I have this functionality where I have a Component that uploads images, and it takes up the full width.
But when I click it, the view becomes a grid-view with two columns, where my component now resizes to fill the first row, first column, while the images uploaded will take up the other spaces (so starting from first row, second column -- then second row, first column and so on.
So my problem is now that I want my images to be draggable, which is wrapped around in a draggable tag, but how can I do this but maintain it for just the images?
My code is as follows (I'm using tailwindCSS and Vue btw):

    <draggable v-model="images" v-bind="dragOptions" draggable=".item">
      <transition-group
        :class="
          images.length == 0 ? '' : 'grid sm:grid-cols-4 grid-cols-2 gap-4'
        "
      >
        <ImageUploader
          @addImage="addImage"
          ref="deleteRef"
          :key="'uploader'"
          :shouldShowLabel="images.length != 0"
          :class="images.length == 0 ? 'mt-4 flex-grow' : 'flex'"
        />

      </transition-group>
    </draggable>

I have some images to illustrate:
Before Upload:

After Upload:

So the thing is when I shift my images, my images array will have an undefined element, which I suspect to be from the ImageUploader component. Is there any way I can take it out so it is not draggable (so the images array will not be corrupted?). Right now I'm making my ImageUploader Component not draggable by using a different key, but yeah.
TLDR: I need my view to look like a grid with 2 columns, but i only want my elements after the first one to be wrapped in my vue draggable so they can be dragged except for the first element.
Much appreciated!!

A: I'm not really sure what you mean. But to my understanding you don't want your <ImageUploader/> component to be draggable?
Try moving it outside of the draggable component. :)

 <ImageUploader
          @addImage="addImage"
          ref="deleteRef"
          :key="'uploader'"
          :shouldShowLabel="images.length != 0"
          :class="images.length == 0 ? 'mt-4 flex-grow' : 'flex'"
        />
    <draggable v-model="images" v-bind="dragOptions" draggable=".item">
      <transition-group
        :class="
          images.length == 0 ? '' : 'grid sm:grid-cols-4 grid-cols-2 gap-4'
        "
      >

      </transition-group>
    </draggable>


text:
Q: What are the abbreviations most commonly used on the Internet? Every so often I see various abbreviations used on forums and blogs and whatnot, such as FYI (For Your Information) and AFAIK (As Far As I Know).
What other common abbreviations are there, and what are their meanings?

A: Here are some that I've seen quite often (there are many more here):

*

*AFAIC: As Far As I'm Concerned

*AFAIK: As Far As I Know

*AFAIR: As Far As I Recall

*AFK: Away From Keyboard

*ATM: At The Moment

*BSOD: Blue Screen Of Death

*BTDT: Been There, Done That

*BTW: By The Way

*FAQ: Frequently Asked Questions

*FTR: For The Record

*FWIW: For What It's Worth

*FYI: For Your Information

*GIGO: Garbage In, Garbage Out

*IANAL: I Am Not A Lawyer

*IIRC: If I Recall Correctly

*IMHO: In My Humble Opinion

*IMNSHO: In My Not So Humble Opinion

*IOW: In Other Words

*IRL: In Real Life

*LOL: Laughing Out Loud

*OOTB: Out Of The Box

*RTFM: Read The Manual

*TLA: Three Letter Acronym

*YMMV: Your Mileage May Vary

A: One I've seen only recently is

*

*tl;dr

which apparently means "too long; didn't read".

A: WTF - What the F*** (or 'Why the face' - Modern Family. Phil: "I'm cool dad, that's my thang. I'm hip, I surf the web, I text. LOL: laugh out loud, OMG: oh my god, WTF: why the face")

A: i've noticed the emergence of the letter "F" in common acronyms, added for color. i.e. BTFW (by the f-ing way), etc. @Kramii's answer includes my favorite: RTFM!


text:
Q: Why didn't Sabrina know about the Feast of Feasts? Sabrina's aunts called the Feast of Feasts an annual celebration, meaning it's occurred over a dozen since Sabrina was born. It involves fourteeen families from the local group of witches, which seems to be a relatively small, insular group, in a fairly small town to begin with. It's unclear whether it's always the same 14 (in which case the Spellmans have always been a part of it).
However, when her aunts tell her about it, she reacts with shock, suggesting that she didn't know about it. Further, other students know about it (such as the weird sisters).
Why had Sabrina not heard about this tradition before?

A: Sabrina supposedly has a free will choice to follow either the Path of the Light or the Path of the Night, because she's a hybrid. Since she has human emotions, and thus some sense of morality, most of the evil stuff witches would be forced to do is hidden away from her. Dealing with demons, giving your soul to the Dark One, loss of free will, human sacrifice and blood rituals, etc, are all hidden from her to try and make the upsides of being on the Path of the Night more attractive than the powerless Path of the Light followers.
Her humanity revolts against those ideas, trying to help people that are being bullied or hurt, and she comes to learn that she'll not only be forbidden from helping people, but will actively be forced to hurt people, even perhaps people she loves or feels sorry for. Since she's already been foretold as being the most powerful witch alive, or even perhaps ever (we're not told exactly what, but it's implied), it's important that the Dark One gets her under control any way possible. Hiding this information from her was a 16 year deception aimed to try and get her to commit to being the Dark Lord's slave.
Basically, she didn't know, because she would have chosen the Path of the Light in a heartbeat, and the Dark One's plans would have been ruined, or at least significantly delayed, since ultimately it was her humanity that leads her to make the decision that she did make. The Dark One was simply trying to use persuasion instead of force, since it was the path of least resistance.

A: Because the audience didn't know. Even though she was raised in the witch world she is being used as surrogate for the audience to know things. That's why she knows all the languages required for spell work but doesn't know what a Malum Malice is.


text:
Q: How to generate the links from layered navigation but only for a specific product on the product page - magento I have specific product - "Toyota Corolla Headlight"
It has 4 multiselect attributes and they are presented in layered navigation:

*

*year: with values - 1999,2000

*model: with value - Corolla

*make: with value - Toyota

*type: with values - Headlight, Fog Lights, Headlight Bulb

It possible to display it as links on product page?
Example
Toyota Corolla 1999 Headlight

Toyota Corolla 1999 Fog Lights

Toyota Corolla 1999 Headlight Bulb

The basic idea - get links from layered navigation but only for the specific product.
I could not find such a solution.
I understand that it is difficult - but maybe i can start to get the values of specific product attributes as links.
Please help!
FIRST UPDATE
$attributes = Mage::helper('amshopby/attributes')->getFilterableAttributes();
foreach ($attributes as $attribute) {
    if ($attribute->getAttributeCode() == 'year') {
        $filterBlockName = 'amshopby/catalog_layer_filter_attribute';
        $result = Mage::app()->getLayout()->createBlock($filterBlockName)->setAttributeModel($attribute)->init();
        foreach($result->getItems() as $option) {
            echo '
getUrl() . '">'.$option->getLabel().'
';

        }
    }
}

This code returns all existing values from attribute "year" with the correct links, But I need only the values of the current product.
DEBUG INFO
    var_dump($_product->getData());
    ["year"]=> string(8) "12,11"

    var_dump($result->getData());
    "year" ["attribute_id"]=> string(3) "151"

    var_dump($option->getData()); - not work

    var_dump($option->debug());
    ["label"]=> string(4) "1999" ["value"]=> string(2) "12" ["count"]=> string(1) "3" ["option_id"]=> string(2) "12"
    ["label"]=> string(4) "2000" ["value"]=> string(2) "11" ["count"]=> string(1) "2" ["option_id"]=> string(2) "11"

Next, I will think how to combine the values of each other.

A: This should skip all options except the ones in the product
$product = // load the current product here
$attributes = Mage::helper('amshopby/attributes')->getFilterableAttributes();
foreach ($attributes as $attribute) {
    if ($attribute->getAttributeCode() == 'year') {
        $filterBlockName = 'amshopby/catalog_layer_filter_attribute';
        $result = Mage::app()->getLayout()->createBlock($filterBlockName)->setAttributeModel($attribute)->init();
        foreach($result->getItems() as $option) {
            if (!in_array($option->getOptionId(), explode(',', (string)$product->getData($attribute->getAttributeCode()))) continue;

            echo '
getUrl() . '">'.$option->getLabel().'
';

        }
    }
}


text:
Q: Execution Plan in Microsoft SQL Server I have a stored procedure in my database. As per my knowledge it's pre-compiled subroutine.
Question 1: If I execute following queries from Hibernate, will database create a separate execution plan for each query? In which case SQL Server update/change stored procedure Execution Plan?
EXECUTE myProcedure 'vicky.thakor', 'Routine Check Up'

and
EXECUTE myProcedure 'chirag.thakor', 'Routine Check Up'

Question 2: This is bit of programming question but you guys may explain me bit of it. In Java there is something called PreparedStatement. PreparedStatement is similar to pre-compiled query.
PreparedStatement generates query like following and put value in place of ?.
SELECT * FROM user_master WHERE user_name = ?

But database will receive the final query like
SELECT * FROM user_master WHERE user_name = 'vicky.thakor'

then how database help to get best performance when using PreparedStatement.

A: First of all: stored procedures in SQL Server are NOT "pre-compiled" or anything.
Just like an ad-hoc SQL query, a stored procedure is analyzed when it's first used, an execution plan is determined and cached.
When the stored procedure is executed again, then that pre-existing execution plan is reused. Same applies to a properly parametrized SQL ad-hoc query.
The point is: as long as the actual SQL statement is IDENTICAL (down to the last comma or space), then a possibly pre-existing, cached execution plan is reused and the whole step of determining an execution plan can be skipped. If the SQL statement text varies - even by a single space - the whole process of analyzing and coming up with an execution plan for that query is run again.
I don't know about how Java handles it's prepared statements, but in C# using ADO.NET, when you run a query something like
SELECT * FROM user_master WHERE user_name = @userName

and you supply a value for @userName (e.g. 'vicky.thakor'), then the SQL Server will NOT received what you seem to think it will receive - the parameter is NOT replaced in the query text - instead, SQL Server will execute this as
EXEC sp_executesql @stmt, N'@userName', @userName = 'vicki.thakor'

SQL Server will receive a parametrized query and a list of parameters and their values.
Therefore, if you call this same query again, with a different value for @userName, the actual SQL statement text is identical and the cached execution plan is reused - only the value of the parameter has changed.


text:
Q: Change the NAT setttings on mobile dongle Is it possible to change the NAT type on a mobile dongle modem? I've searched the web but couldn't find anything. Should I contact the ISP for this, is it even possible. At the moment it is set as strict and I want to change it to open.

A: The NAT configuration is controlled by the mobile broadband provider's infrastructure setup. There's no way for you to change it.


text:
Q: PostgreSQL user access Can a read-only user create the temp tables in PostgreSQL.
If not, is there any way to give access only to create temp tables.
please advice, thank you

A: You have to give him the "TEMPORARY" privilege:
GRANT TEMPORARY ON DATABASE {dbname} TO {role}

For a full explanation of permissions you can check the docs: https://www.postgresql.org/docs/15/sql-grant.html


text:
Q: How can I delete derived data in Xcode 9? I have installed Xcode 9 today morning. It works fine but I want to understand the way to delete the derived data.
Is there any specific way to remove it?

A: Open Xcode -> click on Xcode menu on top bar -> preferences -> location tab. Here you can see the path of derived data. Click on the right arrow and delete all files from there.

A: Open Xcode -> click Preferences...

Now tap on Location tab then click on arrow same as below image


text:
Q: Creating a recursive LPeg pattern In a normal PEG (parsing expression grammar) this is a valid grammar:
values <- number (comma values)*
number <- [0-9]+
comma  <- ','

However, if I try to write this using LPeg the recursive nature of that rule fails:
local lpeg   = require'lpeg'

local comma  = lpeg.P(',')
local number = lpeg.R('09')^1
local values = number * (comma * values)^-1
--> bad argument #2 to '?' (lpeg-pattern expected, got nil)

Although in this simple example I could rewrite the rule to not use recursion, I have some existing grammars that I'd prefer not to rewrite.
How can I write a self-referencing rule in LPeg?

A: Use a grammar.

With the use of Lua variables, it is possible to define patterns incrementally, with each new pattern using previously defined ones. However, this technique does not allow the definition of recursive patterns. For recursive patterns, we need real grammars.
LPeg represents grammars with tables, where each entry is a rule.
The call lpeg.V(v) creates a pattern that represents the nonterminal (or variable) with index v in a grammar. Because the grammar still does not exist when this function is evaluated, the result is an open reference to the respective rule.
A table is fixed when it is converted to a pattern (either by calling lpeg.P or by using it wherein a pattern is expected). Then every open reference created by lpeg.V(v) is corrected to refer to the rule indexed by v in the table.
When a table is fixed, the result is a pattern that matches its initial rule. The entry with index 1 in the table defines its initial rule. If that entry is a string, it is assumed to be the name of the initial rule. Otherwise, LPeg assumes that the entry 1 itself is the initial rule.
As an example, the following grammar matches strings of a's and b's that have the same number of a's and b's:
equalcount = lpeg.P{
  "S";   -- initial rule name
  S = "a" * lpeg.V"B" + "b" * lpeg.V"A" + "",
  A = "a" * lpeg.V"S" + "b" * lpeg.V"A" * lpeg.V"A",
  B = "b" * lpeg.V"S" + "a" * lpeg.V"B" * lpeg.V"B",
} * -1

It is equivalent to the following grammar in standard PEG notation:
  S <- 'a' B / 'b' A / ''
  A <- 'a' S / 'b' A A
  B <- 'b' S / 'a' B B

A: I know this is a late answer but here is an idea how to back-reference a rule
local comma  = lpeg.P(',')
local number = lpeg.R('09')^1
local values = lpeg.P{ lpeg.C(number) * (comma * lpeg.V(1))^-1 }

local t = { values:match('1,10,20,301') }

Basically a primitive grammar is passed to lpeg.P (grammar is just a glorified table) that references the first rule by number instead of name i.e. lpeg.V(1).
The sample just adds a simple lpeg.C capture on number terminal and collects all these results in local table t for further usage. (Notice that no lpeg.Ct is used which is not a big deal but still... part of the sample I guess.)


text:
Q: ClosedXml.Excel HasDuplicates Extension Method Missing following Upgrade I've been tasked with taking a legacy project written with WPF, that was integrated into a bigger application and making it stand-alone. It hasn't been touched for some time, and from experience, this will always lead to issues when trying to bring the associated packages up to date. My team regularly do maintenance to keep technologies up to date, but the codebase was maintained by a different team, so they haven't followed any maintenenace schedules. I'm finding an issue with ClosedXml whereby part of our code references an extension method HasDuplicates() (found in ClosedXml.Excel) that was available in 0.74.0 but when upgrading the the latest version (0.95.4) isn't present. Searching for help isn't returning anything useful, but am sure somewhere there must be a release note that states it has been removed or renamed but I can't find it!
Using 0.74.0, this code compiles:
if (serializedPeriodAllocations.Select(o => o.Period).HasDuplicates())
        {
            throw new Exception("Duplicate period allocations found!");
        }

But when I upgrade ClosedXml to 0.95.4 or above, it doesn't and I get the following error:
CS1061  'IEnumerable<int>' does not contain a definition for 'HasDuplicates' and no accessible extension method 'HasDuplicates' accepting a first argument of type 'IEnumerable<int>' could be found (are you missing a using directive or an assembly reference?)

Does anyone know if there is any documentation that will help me figure out why it no longer works, and if it's possible to upgrade?

A: After further investigation, I found an Extensions class within the project that contained a HasDuplicates extension, which was coded like this:
    public static bool HasDuplicates<T>(this ICollection<T> source)
    {
        return source.Distinct().Count() != source.Count;
    }

I added in an override for the extension that accepted IEnumerable:
    public static bool HasDuplicates<T>(this IEnumerable<T> source)
    {
        var enumerable = source as T[] ?? source.ToArray();
        return enumerable.Distinct().Count() != enumerable.Length;
    }

After removing the using for ClosedXml.Excel, the HasDuplicates() doesn't return an error, as expected.


text:
Q: best way to synchronise method I am working on a task management type application. So when someone completes the task the task creator emails a message with the task URL. I am using spring MVC to create this application. So now the problem is when two tasks are created  at almost the same time, the email for the 1st task I get the URL generated for 2nd task.
I wrote the following method to perform this functionality
 @RequestMapping(value = "commentTask", method = RequestMethod.POST)
@ResponseBody public List<List<Task>> reply(@ModelAttribute Task task,@RequestParam ("parentId") long parentId,HttpSession session) {
    List<List<Task>> listTasks = null;

    taskEntryService.insertTask(task,session);

    listTasks = taskEntryService.selectAssignedTask(task.getAssignTo(), parentId);

    String taskurl = siteUrl + "showAssignedTask?assignto="+ task.getAssignTo() + "&taskId="+parentId;

    if(task.getTaskUpdateEmailNotify().equalsIgnoreCase("1")){

            try {

                if(task.getStatus() == 4){

                    String completedTaskBody = taskCompletedEmailBody(taskurl, task.getAssignToName(), task.getTaskTitle(), task.getAssignerName(), task.getSummary());

                    sendmailService.sendMail("no-reply@gmail.com", task.getTaskCreatorEmail(), "Your Task has been Completed", completedTaskBody);
            }
            } catch (AddressException e) {
                e.printStackTrace();
            }

    }

    return listTasks;
}

So what is the best way to syncronize this method.
Please let me know if more detail is required

A: The easiest way to synchronize access to this method would of course be to mark it as synchronized in the signature.
 @RequestMapping(value = "commentTask", method = RequestMethod.POST)
 @ResponseBody
 public synchronized List<List<Task>> reply(@ModelAttribute Task task,
      @RequestParam ("parentId") long parentId,
      HttpSession session) {

It seems unlikely to me that synchronization here will solve your problem since the code does not seem like it has any particular race condition: it takes care to construct the full URL from the provided Task object. I suspect that somehow either your Task object is not thread-safe or that the wrong parentId is being passed in.


text:
Q: A trigonometric identity. I have determined that there is a trigonometric identity (in radians) that goes as follows:
$$(2\cos(n))^k=\cos(nk)+\sum_{i=1}^{\infty}\frac{k!}{i!(k-i)!}(\cos(n(k-2i)))$$
For $n,k\in\mathbb{C}$.
The derivation is found here for those who are interested.
I was wondering if this is a well known identity and if there are anything I should note, such as whether or not it will converge.
Also, as a bonus, I would be happy to see if someone could simplify this into something simpler.  (Someone had mentioned "De Moivre" expansion, though I don't know what that means here...)
Some links would be nice, as I would like to read about this.
Update:
I am rewriting $\cos(nk)=2^k\cos^k(n)-\sum_{i=1}^{\infty}\frac{k!}{i!(k-i)!}(\cos(n(k-2i)))$ so that I may have $\cos(nk)=P_n(\cos(k))$ where $P_n$ is a polynomial, possibly with an infinite amount of terms if $n$ is not a whole number.


text:
Q: How to get the discount amount code of voucher applied in prestashop I am attaching the below snapshots of prestashop shopping cart So how I will get the code of discount amount from the voucher redeemed.
http://imgur.com/a/bvx7J
http://imgur.com/a/XgT9p

A: You can use the getCartRules() function to fetch all the cart rules applied on any cart. This function is defined in the Cart.php class file.
You can use the following code to fetch all the coupon details on current cart:
$this->context->cart->getCartRules();

and you can use below code to know if the customer is using the voucher for the first time.
if ($context->cart->id_customer) {
        $quantityUsed = Db::getInstance()->getValue('
        SELECT count(*)
        FROM '._DB_PREFIX_.'orders o
        LEFT JOIN '._DB_PREFIX_.'order_cart_rule od ON o.id_order = od.id_order
        WHERE o.id_customer = '.$context->cart->id_customer.'
        AND od.id_cart_rule = '.(int)$this->id.'
        AND '.(int)Configuration::get('PS_OS_ERROR').' != o.current_state
        ');
        if ($quantityUsed == 0) {
          // Customer is using the coupon for first time.
        }
    }


text:
Q: Does Quantum Mechanics need imaginary numbers? In quantum mechanics, we assume wavefunctions are complex valued, and that probability amplitudes are given by the modulus of the wavefunction squared. This formalism can correctly explain interference effects, e.g. the double-slit experiment. I understand all of this.
Now, let's consider classical optics. If we have a linearly polarized EM wave, the electric field is defined in all space by a single real number. If we want to find intensity of light at any given point, we time-average the square of the electric field at that point. Alternatively, instead of representing the electric field with a time-varying real number at every point, we can also represent the electric field by a complex phasor which rotates in time. Then then intensity of the light at any point is (up to a factor of $\sqrt{2}$) just the modulus of the phasor squared. And if the light interferes with itself (e.g. in an interferometer) the new phasor at the point of interference is simply the sum of the old phasors, identical to interference in quantum mechanics.
So my question is: if, instead of assuming we have a complex valued wavefunction, we assume we have a REAL wavefunction (which is just the real part of our normal wavefunction), and all our probability measurements are inherently time-averaged (like our intensity measurements for an EM wave), would we run into any contradictions with logic/experiment?
(I realize this wouldn't be a particularly USEFUL formulation of quantum mechanics. Complex numbers are obviously more elegant--we invented phasors for a reason, after all. I just want to know if it's equivalent.)
Edit: I realize complex numbers can be thought of as simply two real numbers. I'm interested in the case of representing the wavefunction as a SINGLE real number. I guess what I'm looking for is a concrete difference between wavefunctions and electric fields.


text:
Q: T/SQL: Format results of SELECT on XML stored as nvarchar(max) I am not sure why, but our nLog configuration is now stored as an nvarchar(max) column in a table. With a standard SELECT on the column, I get output like:
<variable name="HeaderLayout"....

I have tried using "FOR XML AUTO", as well as a series of REPLACE functions to get nice, pretty XML output from this column. Option A doesn't automatically cast the replacement markers to < or >, option B is really clumsy. Can someone please recommend a good why to retrieve the configuration as formatted XML?
As a bonus, I'd like to be able to take the formatted XML, make a change and then INSERT with a minimum of effort, but for now, I'd just settle for being able to make the SELECT results more readable.
Thank you!

A: First cast the value to XML. That will create an XML with your entire XML as a single value.
Then you get that value from the XML using the value function and finally you cast the fetched value back to XML.
Here is some code using a table variable you can test on.
declare @T table
(
  Col nvarchar(max)
)

insert into @T(Col)
values('<root><item ID="1">textvalue</item></root>')

select cast(cast(T.Col as xml).value('.', 'nvarchar(max)') as xml) as XMLCol
from @T as T

Result:
XMLCol
-------------------------------------------
<root><item ID="1">textvalue</item></root>

A: Try FOR XML AUTO, TYPE. And can you provide an example of your query?


text:
Q: Is it possible to add exact coordinates for pinch function in XCTest class? I use XCTest to test zoom out of uiview (func pinch(withScale scale: CGFloat, velocity: CGFloat)) and there is a problem when above the target view there are several UIViews in the right-top and left bottom. It can't zoom out it properly and it acts as a pan, not as a pinch.
I've tried to hide the above view and it works.
func execute() {
    let element = self.finder.find(viewId)
    element.pinch(withScale: 0.5, velocity: -1.0)
}

I need to find out the way to control the coordinates when it start to zoom out or some workaround to work this well enough.


text:
Q: Scrape a list item to a Google Spreadsheet with the importXML function I'm trying to make a spreadsheet that automatically pulls some information of a bookstore website. Actually the only information that i need from the webpage is:

*

*Title

*Author

*Price

*ISBN or EAN (International Standard Book Number or International Article Number)

I'm trying to do this with the importxml function and for the title, author & price this works perfectly when i paste the Xpath link into the formula/function.
It also pulls the ISBN or EAN from the webpage but i think because the number is an HTML list object something goes wrong. As you can see in the screenshot it automatically puts the number on the next row in the spreadsheet.

If anyone has a solution for this that would be more than welcome.
Link to the actual spreadsheet:

Google Spreadsheet

Greets
Pablo

A: You could wrap a query around it and off set the value by 1:
=query(importxml(A5,"/html/body/div[8]/div/div/div[2]/div[2]/ul/li[2]/text()"),"offset 1",0)
Locale settings may need this:
=query(importxml(A5;"/html/body/div[8]/div/div/div[2]/div[2]/ul/li[2]/text()");"offset 1";0)

A: You can use
=INDEX(IMPORTXML(A5;"/html/body/div[8]/div/div/div[2]/div[2]/ul/li[2]/text()");2)

A: Try with
=IMPORTXML(A5;"//ul[@class='c-list c-list--semantic']/li[./span[text()='Productcode (EAN):']]/text()[2]")

BTW, your other xpath expressions can also be truncated. For example, to get the price you can use
=IMPORTXML(A5;"//*[@id='productDetail']//span[@class='c-product__detail__price--largest']/text()")


text:
Q: Knowing the IP Address and check if it is registered in my database I need to get the computer IP address and I need to check if that IP address is in my database. If it was, I need to display the name registered to that IP address that was in my database.
Actually I am confused because there were no error detected yet there were no output displayed.
Here's my code

<?php
$ipname = gethostbyname(trim(`hostname`));
$ip_query = "SELECT ip_address FROM table 5";
$ip_add = mysql_query($ip_query);

if ($ip_add === $ipname){
echo "{$ip_add['guest_name']}";
}
?>

A: the way you are retrieving the IP won't work in some cases, so first you need to get it using the function implemented here. for the query itself the query is retrieving the first 5 rows only, so you need to add "where" part so the query should be something like that $ip_query = "SELECT ip_address FROM table where ip = $ipname"; then after that you shouldn't compare the output of mysql_query, the output is a mysql resource you should use another function to get the result
$num_rows = mysql_num_rows($ip_add)
if ($num_rows>=1) {
$ip = mysql_result($ip_add,0,'ip_address');

// then compare the ip variable with the one you have from the function

}

A: Find, IP Address through given function. Check in query there itself. If ip address exist, Print guest name.
[NOTE: I Used YourTableName as table name. Put appropriate table name in query.]
<?php
$ipname = getIpAddress();

$query = mysql_query("SELECT guest_name FROM `YourTableName` WHERE ip_address = '$ipname'");
$countUser = mysql_num_rows($query);

if($countUser > 0){
  while($row = mysql_fetch_array($query)){
    echo "User Name: ".$row['guest_name']."<br>";
  }
} else {
  //Your Logic
}

function getIpAddress() {
  if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    return $_SERVER['HTTP_CLIENT_IP'];
  } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
    return trim($ips[count($ips) - 1]);
  } else {
    return $_SERVER['REMOTE_ADDR'];
  }
}
?>

NOTE: The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead